These days, it is obvious that online payment is widely considered as a topic of concern for the whole society in general and for the developer community in particular. Paypal is the faster and safer way to make an online payment. There are two solutions supported by paypal to let developers know when orders are completed. They are webhook paypal and api payment paypal. From my personal perspective, I am totally convinced that api payment paypal should be integrated in API services.
On the one hand, webhook paypal is automated events which server paypal calls specified api. For example, when customers check out several items on a website and completely pay orders in paypal, server paypal intends to send a request to the website. Thanks for this notification, the website determines when orders are paid and updated in the database. Webhook is the same with ipn (instant payment notification) in the old system.
People are really genius at understanding documents about webhook in paypal. To don’t waste time, I will describe it in short. You have to make a webhook.
-
Log in to the Developer Dasbhoard.
-
Create an app to generate your API credentials and subscribe to webhook events. If you already have an app, proceed to the next step.
-
In the REST API apps section, click the link for the app to which you want to subscribe events.
-
In the webhooks section, click Add Webhook.
For example
Developers can make a test by Webhooks Simulator Paypal
However, when server paypal sends a request to the website, it may waste under several minutes or lots of hours. This is a disadvantage, developers do not know when a purchase is successful to store in Database.
On the other hand, I totally advocate that api payment paypal is a relevant procedure in the payment paypal process. This opinion is held because this approach can fix the former problem. To clarify, when customers successfully pay in paypal.com and return to the website, the server website will detect payment information. Instead of waiting for paypal send notification, the server website intends to find the order by api payment paypal. If the order is found and verified, the server website is going to complete the order and store it in the database.
It is in theory. Now, I do it in practice. People can check by field: paymentId. Then, people can verify an order by payerID and compare it with the status order in the database.
First, people should have a token to call api payment paypal in PayPal Oauth2 API
Second, people find order by api PayPal Payments API
Fortunately, instead of cultivating these api, I appreciate a library on github PayPal-Python-SDK . Enjoy it!
As a result, all the standpoints lead to a firm opinion that api payment paypal will helps developers accomplish payment function with available libraries.