Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPN responses are (sometimes) generating 400 Bad Request #7

Open
tarkatronic opened this issue Jan 17, 2014 · 2 comments
Open

IPN responses are (sometimes) generating 400 Bad Request #7

tarkatronic opened this issue Jan 17, 2014 · 2 comments

Comments

@tarkatronic
Copy link

I have several cases where, when generating payments using a Preapproval, the IPN response will get a 400 Bad Request response, as seen in the IPN History of my PayPal account.

I was able to trace this down to https://github.com/FundedByMe/django-paypal-adaptive/blob/master/paypaladaptive/api/ipn/endpoints.py#L84

The reason being, PayPal is acting inconsistent from their documentation (surprise!). An example of a response they are sending looks like the following (censored for identifying details):

payment_request_date=Wed Jan 08 23:30:05 PST 2014&return_url=http://scottsmarketplace.com/paypal/adaptive/pay/return/14/xxxxxxxxxxxxxxxxxxxx/&fees_payer=EACHRECEIVER&ipn_notification_url=http://scottsmarketplace.com/paypal/adaptive/ipn/14/xxxxxxxxxxxxxxxxxxxx/&[email protected]&verify_sign=xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx&transaction[0].id_for_sender_txn=xxxxxxxxxxxxxxxxxxxx&transaction[0][email protected]&cancel_url=http://scottsmarketplace.com/paypal/adaptive/pay/cancel/14/xxxxxxxxxxxxxxxxxxxx/&transaction[0].is_primary_receiver=false&reason_code=CLEARED&pay_key=AP-xxxxxxxxxxxxxxxxxxxx&action_type=PAY&transaction[0].id=xxxxxxxxxxxxxxxxxxxx&transaction[0].status=Completed&transaction[0].paymentType=SERVICE&preapproval_key=PA-xxxxxxxxxxxxxxxxxxxx&transaction[0].status_for_sender_txn=Completed&transaction[0].pending_reason=NONE&transaction[0].amount=USD 9.99&status=COMPLETED&log_default_shipping_address_in_transaction=false&charset=windows-1252&notify_version=UNVERSIONED&reverse_all_parallel_payments_on_error=false

Lots of censoring, obviously, but if you look carefully you will see that there is no transaction_type provided. They only sent back an action_type.

Has anybody else noticed this? My proposed solution so far would be defaulting the transaction_type to "Adaptive Payment PAY" but I haven't yet found any documentation to support that decision.

Is this a change which would be open to a pull request?

@antonagestam
Copy link
Contributor

ping @rmeritz

@tarkatronic
Copy link
Author

I received the following response from PayPal. I'm not sure they really understand the problem. Then again, I'm not sure I really do either.

Hello Joey,

thank you for contacting the PayPal Merchant Technical Support Services.

The problem you're seeing is that the IPN messages you're receiving are for the API caller - within Adaptive Payments, the notify URL is used for the calling API account. These messages will look different to what you'd expect the merchant to receive.

The merchant (receiver) will get an IPN sent to their IPN URL configured under https://www.paypal.com/cgi-bin/webscr?cmd=_profile-ipn-notify

In the case of this IPN, when looking at the "reason_code", it looks like a notification that the payment itself has been "cleared", so it would've been a payment that was under review or just not paid through an "instant" funding method.

Generally, if you want to avoid your IPN feature to remain active, you'll have to make sure your script responds with an HTTP Status code 200 - see: https://developer.paypal.com/webapps/developer/docs/classic/ipn/gs_IPN/

Upon receipt of a notification from PayPal, send an empty HTTP 200 response.

I don't know if that's particularly helpful here, but it sure as hell isn't to me yet. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants