Reputation: 2887
Before creating a database record after a user submitted his registration, I want him to go through a PayPal payment process. Only when he's back on my (WordPress) website from PayPal's payment page will the database record be created.
To do that, I need to store his registration details (name, email, age, telephone, etc) somewhere. And because he can register a group of people at once, it can be not one but several persons details.
How to store that safely during PayPal payment?
Upvotes: 0
Views: 403
Reputation: 26056
You could keep the data in a temporary database table until you're ready to move it into your final table, or you could use session variables.
I personally prefer to create DB records prior to sending the person over to PayPal payment. That way you can include the record ID of your data in the payment under the invoice or custom parameters that PayPal provides in their API. This allows you to easily cross-reference the PayPal transaction data with your own internal invoice or record ID.
When you first add it you could throw it in there as pending and then once the payment is complete simply update that record from pending to complete or whatever you want to call it.
If you're using PayPal Express Checkout or Payments Pro this can all be done within the checkout flow. If you're using Payments Standard I would recommend using IPN to update the database after the payment is completed.
Upvotes: 1