Hide PayPal order buttons after confirmed payment for UX purposes

selapt
Contributor
Contributor

Hello! I am migrating service to v2 API. We are using Orders API
My case is as follows:
On the front-end, we have dummy PayPal confirm webpage showing details about payment PayPal buttons added as suggested in the documentation (in div and using paypal.Buttons - render).


After successful payment is made, we capture order_id and send it to the background to check with paypal-checkout-sdk. If a check is a success we then we redirect the buyer to a success page. We like to use this way instead of the provided by PayPal redirect on success and etc.

Anyway, this all works fine, except for the little glitch in the UX.
Because checking on background takes a little time, we hide PayPal buttons div and display a message, instead. But this message appears on "onApprove" event which normally also takes some time to appear.
So UX is as follows - click PayPal button -> screen gets dimmed and PayPal login appears -> user enter data. Everything is cool until this point.
After success payment is made, PayPal login closes, the screen gets undimmed and PayPal buttons are active for some time until onApprove event appears on which we hide them.

So what I ask is if there is a middle stage - event between createOrder and onApprove, when I could hide PayPal buttons. Or some setting which hides buttons when they get clicked in the beginning.
Thanks.

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.