spookylukey / django-paypal

A pluggable Django application for integrating PayPal Payments Standard or Payments Pro
MIT License
729 stars 208 forks source link

IPN listener show Invalid form #94

Closed alhamar closed 9 years ago

alhamar commented 9 years ago

If I will test the IPN listener as in Local Development Testing.

the only message I will get inside the paypal-ipn table is:

flag-info: Invalid form - no charset passed, can't decode!!

spookylukey commented 9 years ago

This is caused by a bug in the sandbox IPN simulator as far as I can tell - it doesn't send the charset parameter. Without this, we can't even get started with decoding the IPN data. I will contact PayPal about this.

alhamar commented 9 years ago

should I keep going with the implementation or not?

spookylukey commented 9 years ago

The IPN code works in production, it's only the PayPal's simulator that is buggy.

I would carry on. I'm going to try to address these issues.

spookylukey commented 9 years ago

OK, I re-read your message. It sounds like you are using a local request to test, not the simulator, as per: https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNTesting/#local

The help on that page is not very helpful! You would be much better off using something like 'curl' or httpie

A complete sample commandline using curl, and the example request from the docs, looks like:

curl http://localhost:8000/paypal/ipn/ --data 'mc_gross=19.95&protection_eligibility=Eligible&address_status=confirmed&payer_id=LPLWNMTBWMFAY&tax=0.00&address_street=1+Main+St&payment_date=20%3A12%3A59+Jan+13%2C+2009+PST&payment_status=Completed&charset=windows-1252&address_zip=95131&first_name=Test&mc_fee=0.88&address_country_code=US&address_name=Test+User&notify_version=2.6&custom=&payer_status=verified&address_country=United+States&address_city=San+Jose&quantity=1&verify_sign=AtkOfCXbDm2hu0ZELryHFjY-Vb7PAUvS6nMXgysbElEn9v-1XcmSoGtf&payer_email=gpmac_1231902590_per%40paypal.com&txn_id=61E67681CH3238416&payment_type=instant&last_name=User&address_state=CA&receiver_email=gpmac_1231902686_biz%40paypal.com&payment_fee=0.88&receiver_id=S8XGHLYDW9T3S&txn_type=express_checkout&item_name=&mc_currency=USD&item_number=&residence_country=US&test_ipn=1&handling_amount=0.00&transaction_subject=&payment_gross=19.95&shipping=0.00'

This does work, but you get 'invalid postback' if you change anything (due to signature mismatch), so this method is not very helpful for any testing.

You are better off using the simulator. There are bugs in the simulator (!), but I will shortly be releasing a version that is compatible with the simulator.