I have a paypal button on my site in a form. The form has an additional input called ID, where the user must enter a specific value.
After the sale is complete, Paypal returns the user to domain.com/credits?done
How can i receive the original ID value entered by the user in /credits?done ? need it to modify his database record automatically.
Thanks.
You can create a simple cart system that will have a unique invoice to distinguish each transaction. Pass this invoice as parameter when sending payment data to paypal. Any other data can be just stored in your database, no need to sent it to paypal, since you can determine each transaction with the invoice as the unique identifier.
You also need to create a
ipnhandler page to receive data from paypal when user making the payment there, so you can update the payment status in your database. With this way, the user do not have to click return to your site link after making the payment, but you can still update the related data.To make integration easier, you can consider using Micah Carrick’s Paypal IPN Class. Basically it’s the same code with the one provided by paypal, but it’s wrapped into a class, so you can just use it in your page.