This PayPal checkout demo project was bootstrapped with React. With the help of latest react hook api.
The CI/CD of this project has been taken care by Github Actions.
https://client-5c15a.web.app/client-implement
[email protected] pw: V?P99V>p
In the project directory, you can run:
then:
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
This demo project includes two way to finish PayPal checkout flow, in the client Implementation, the Smart Payment Button takes care of the whole checkout flow. Two hook functions are implemented, one is creating order which will call order api to create a new transaction, once payer approved the transaction, the capture function will capture the fund, then notify payer the transaction is done. The page will redirect to complete page with transaction detail information. The smart button will handle funding failure automatically (ask user to select other approaches).
In the Server Side Implementation, the frontend for user is basically same, but when payer click paypal button which is actually calling our node backend to create transaction, then the backend will use paypal checkout server SDK to create order, then return the orderId to client, once payer approved the order, the frontend will tell backend to call order capture, then there is another call in the backend to get transaction detail, which will be send back to client for user reference. Same like client side implementation, the page will automatically redirect to complete page then show detail information. If there is funding failure, the client will call actions.restart to restart the flow.