问题
I created a hosted button using a business account and integrated that code with my php application.
I use 'Website Payments Standard' and generated the 'Buy Now Button' using the tool provided in 'Merchant Services' page.
I am using http://sandbox.paypal.com/ to test this.
Configurations in Merchant Profile:
- Instant Payment Notification (IPN) is 'Enabled' and 'Notification URL' given.
- Auto Return is On.
- Return URL specified (the same given above in notification URL)
- Payment Data Transfer is On
- Website Payment is Off
- PayPal Account Optional: is Off
While creating the button also in the third option I gave the same notify_url.
Transaction happens successfully and gets redirected to my notify_url. The issue is, $_POST from paypal response in my notified page is empty.
I printed the $_POST in the first line of my notifier page itself. Do I need to add any other configuration? Am I making any mistake?
回答1:
The data is going to the IPN url. Log the $_POST data to a file from the script at the IPN URL and see what you are getting. I think if you turn off the IPN, you may then get the data on the notify_url (been a while though, not 100% sure on that part).
回答2:
the notify url is just for receiving the data from paypal about the transaction, it's not a webpage that you can display, because it doesn't happen inside the normal page flow, paypal simple opens a curl command (or similar) to your server and dumps all the data over $_POST
the return url is only used when the user clicks to return to your website.
so don't use the return url for recording the status of the payment, or sending emails, it'll fail badly, always use the notify url for doing that, the return url is just to show the user something pretty after he's paid, or not pretty if it failed
来源:https://stackoverflow.com/questions/4795985/post-from-paypal-response-after-payment-is-empty