Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to verify successful payment of paypal

I am trying to get the transaction info of paypal transaction that is passed to our website when customer is redirected to our website.

I turned auto-return and pdt in my sandbox paypal account setting. I posted a sample transaction to paypal and it replied to my return url with tx appended.

As found in some docs I did a curl req to https://www.paypal.com/cgi-bin/webscr and tried to get information by passing the req values as follows:

a.) tx = same one received from paypal
b.) at = pdt code given by paypal while turning pdt on
c.) cmd= "_notify-synch"

but in result i get String(0) "".

What I am missing?

like image 730
KoolKabin Avatar asked Sep 01 '11 17:09

KoolKabin


People also ask

How do I know if a PayPal payment has been accepted?

PayPal sends you an email notification whenever funds are transferred to your account. If you are expecting payment, check your email to find a message from the online service. The email will indicate how much money you have received and from whom.

How long does PayPal take to verify a payment?

This usually takes approximately 3-5 business days. Once you see these deposits in your account, enter the two amounts into the verification section of your PayPal account. This will complete the verification process.


1 Answers

I'd highly suggest looking into using PayPal Instant Payment Notifications (IPN). PayPal IPN allows you to (asynchronously) process order information while not having to depend on the buyer to return to your website to complete the order.

You can use IPN by setting up a script which receives this (POST) data from PayPal. In addition, you must include the following code in your button and/or API call(s):

For Website Payments Standard (where "xxxxxxxx" is the full URL to your IPN script):
input type="hidden" name="notify_url" value="xxxxxxxx"

For Express Checkout: Include NOTIFYURL=xxxxxxxx in your SetExpressCheckout and DoExpressCheckoutPayment API call

For Website Payments Pro Include NOTIFYURL=xxxxxxxx in your DoDirectPayment API call

You can find sample code, documentation and further information on PayPal IPN at https://www.paypal.com/ipn

Additionally, here's an article with additional steps on verifying the authenticity of IPN messages at https://www.x.com/developers/community/blogs/ppmtsrobertg/securing-your-instant-payment-notification-ipn-script

like image 107
Robert Avatar answered Sep 19 '22 17:09

Robert