I am developing a crowd funding site (similar to Kickstarter ) using the CodeIgniter framework.
I have successfully completed PayPal responsive payments using this library .
But I'm just not sure how to correctly and correctly verify successful / unsuccessful payments, and important data is important for saving in the database.
Note: this is a payment copied with a delay, I am the main receiver, and the secondary receiver is the creator of the crowd funding project. Money is transferred to the second receiver after a predetermined period of time.
The stream that I have now is as follows:
- Click to buy reward.
- I use the "Pay" API operation to request a payment (a unique TrackingID is included) and save the request to the database.
- If the request is successful, I save some response data in the session (TrackingID, PayKey, amount, ...) and redirected to PayPal ..
- At this step, the user can: accept payment, cancel or close the browser, so I do not know what is happening here ... (recommendations?)
- If the user accepts the payment, he is redirected back to my site and I use the data that I saved in the session to request the operation of the PaymentDetails API to receive payment information.
- I save the result in the database and check if the response amount is equal to the "quantity" of the request (for security).
- If everything went fine, I update the database and connect the payment tracking ID with the user and the reward that he bought.
- Later (maybe a few months later) the "ExecutePayment" API is requested by the administrator, and the money is transferred from us to the creator of the project, and we charge a small fee (this is how crowd funding works ..)
Now Iโm sure that Iโm missing everything, but I have no idea that:
- What about the IPN API? I need this? Where does this happen to play inside the stream and check?
- What do I do if the user closes the browser window when he is in PayPay (outside my site).
- I heard that PayKey is valid for 3 hours, how can I "ExecutePayment" after several months?
- How do I handle a huge number of error types in the PayPal API?
- Any tips or examples of other things I need to take care of? Security? Mistakes? Others?
Thank you so much, I really need your answer!
source share