Adjust the PayPal responsive payment flow on the crowd funding website. I am stuck

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!

+4
source share
1 answer
  • IPN will automatically issue POST data to your โ€œlistenerโ€ (which you will need to develop) to automate the procedures after payment. For example, you can update the database, delete third-party web services, generate mail receipts, etc. As part of the IPN, so that these events occur automatically at any time when you receive money in your PayPal account. You can also configure it to handle refunds, disputes, and other events. This is not required, but often very useful.

  • This is one of the reasons IPN can be useful. IPN will be launched, whether the user will return it to your site or not. If you follow the post-payment processing procedures on your thank you page or something like that, I would recommend that you move it to an IPN solution.

  • PayKey is valid for 3 hours when used as a token. However, when you call Pay using ActionType for CREATE, it sets up a delayed payment, and PayKey is valid for up to 90 days.

  • Error information will always be returned in the same format in the response. You can simply register or display errors accordingly based on this standard answer.

  • It looks like you're pretty much on top of everything for the most part.

+8
source

Source: https://habr.com/ru/post/1394637/


All Articles