Reputation: 2050
I am using node.js bodyparser to get urlencoded string and manipulating the string to simulate a querystring with cmd=_notify-validate
preceded. Whenever an IPN response is sent, I keep getting INVALID
message. I am suspecting that this might have to do with encoding/decoding issue. The code below is the body part of Paypal INVALID
message, that is the querystring I manipulated. Can someone verify if this is the right format to send IPN response? If not, how should I format the string?
body: 'cmd=_notify-validate&payment_type=instant&payment_date=Sat Oct 01 2016 10:15:51 GMT 0900 (%uB300%uD55C%uBBFC%uAD6D %uD45C%uC900%uC2DC)&payment_status=Completed&address_status=confirmed&payer_status=verified&first_name=John&last_name=Smith&[email protected]&payer_id=TESTBUYERID01&address_name=John Smith&address_country=United States&address_country_code=US&address_zip=95131&address_state=CA&address_city=San Jose&address_street=123 any street&[email protected]&[email protected]&[email protected]&residence_country=US&item_name1=something&item_number1=AK-1234&tax=2.02&mc_currency=USD&mc_fee=0.44&mc_gross=12.34&mc_gross_1=12.34&mc_handling=2.06&mc_handling1=1.67&mc_shipping=3.02&mc_shipping1=1.02&txn_type=cart&txn_id=939521005¬ify_version=2.1&custom=xyz123&invoice=abc1234&test_ipn=1&verify_sign=AFcWxV21C7fd0v3bYYYRCpSSRl31ACcRGK9bZMBhEskX.HORa2EqEcwh',
Upvotes: 0
Views: 93
Reputation: 36
I ran into the same issue today. My initial solution was to remove the date field from IPN Simulator, which made it work. So i started to investigate in the Date field. The + sign after GMT (as you can see in your formatted string is not there). This has to do with PayPal not encoding the '+' correctly and receiving server is translating this as a white space.
Solution: So if i change this on my server and replace the introduced white space with a + sign instead, everything works fine. (Ugly solution indeed)
Think this is on PayPal's side to fix, as the translation of a + to white space is correct, so they need to encode the data sent correctly.
Upvotes: 2