With various payment methods that involve a redirect to a payment partner site (like iDEAL/Giropay/Alipay/etc.) the payment confirmation comes with a webhook, in parallel to the user being redirected back to WordPress.com.
While the redirect URL back to WordPress.com is set here to /checkout/thank-you/${ selectedSiteSlug }/${ receiptId }
WordPress.com will replace receiptId
with pending
when it cannot confirm the payment success at the time of the redirect. In this case, Calypso just displays a generic thank-you note.
We need to implement a specific pending
checkout thank-you page that will poll the backend for the order status, and will redirect to the proper payment confirmation/receipt page, or display an error message when appropriate.
I did a quick PoC to explore today: #23484 . In summary, my plan is to:
checkout/thank-you/:site/pending/:orderId
. In this page, using the query component to poll for the payment status. If it's successful, then jump to the thank-you page. If it's not, then jump to the failure page. I'm not sure if there is a suitable payment failure page though. There seems to be two possible failures: the payment has failed somehow, the payment has been cancelled which could be pending for too long. Ideally, we should show different messages for each.Does that make sense to you? Also cc @Automattic/neutron here for confidence check 馃檱
I don't have much experience with the redux parts, but from API point of view this sounds like a good plan!
redux work (yay for using the data-layer!) sounds like a good plan too!
All of the ingredients for resolving this are now ready.
code-D11190. It will be deployed only after all the calypso pieces are deployed.
In the dependency order:
@yoavf @Automattic/payments I've just rolled out everything. If there is anything broken, please let me know. Thanks for guiding me on the way 馃檱
Most helpful comment
I did a quick PoC to explore today: #23484 . In summary, my plan is to:
checkout/thank-you/:site/pending/:orderId
. In this page, using the query component to poll for the payment status. If it's successful, then jump to the thank-you page. If it's not, then jump to the failure page. I'm not sure if there is a suitable payment failure page though. There seems to be two possible failures: the payment has failed somehow, the payment has been cancelled which could be pending for too long. Ideally, we should show different messages for each.Does that make sense to you? Also cc @Automattic/neutron here for confidence check 馃檱