Transaction Webhooks Decoding rc4 using nodejs

blaiblai Member
I am using the php test script found here.
https://wiki.foxycart.com/integration/foxycart/test_xml_post

Running the PHP script will post the data to my nodejs application. However, I am having trouble decrypting the FoxyData being sent.

I believe the issue I am having is trying to reverse the urlencode that is done in the PHP.

decodeURIComponent(foxyData) will result in URI malformed.

I believe that decodeURIComponent in nodejs expects the output to be an ascii string.

Any thoughts?




Tagged:
Comments
  • blaiblai Member
    It appears that PHP is using encoding of 'ISO-8859-1' and nodejs is 'UTF-8'.
  • blaiblai Member
    Solutions was to use var binaryData = unescape(foxyData); instead of qs.unescape
  • brettbrett FoxyCart Team
    Hey @blai.

    Sorry about that. We've got a new webhook system coming very soon that'll have a native JSON format (and that only encrypts, using AES, if the endpoint's not SSL). Should be a lot easier to work with.
Sign In or Register to comment.