user2523382
user2523382

Reputation: 23

how can I get variables to update my database after a successful paypal transaction?

I am creating a cms for shopping cart. I added buy now buttons with the products. But after a customer completes transaction, I need to get the item number and how many item of that kind he bought, and what was his payment amount. Paypal returns customer to a success transaction page, but I wonder how can I gather those data?

Upvotes: 1

Views: 566

Answers (2)

PP_MTS_Chad
PP_MTS_Chad

Reputation: 7319

You could also use IPN as opposed to using the return URL. With the return URL, if the buyer does not return to your site for some reason such as they eitehr close their browser early or exit out of the flow, you will not get that data returned to your site. If you use IPN, the data will be posted to your site regardless if the buyer returns or now. Also with IPN, you can see what was sent in your IPN history and even resend the IPN if needed up to 28 days.

Upvotes: 1

Ammar Hayder Khan
Ammar Hayder Khan

Reputation: 1335

The following steps working fine for me 1-> Save the data like product code, price and detail in separate table before submitting to paypal. Save the id in session. 2-> Give the hidden input "return" like

  <input type="hidden" name="return" value="your site url/paypal_success.php">

3->Collect the data from the table with session id in paypal_success.php.

Upvotes: 0

Related Questions