applepayapplepayjs

Apple pay on the web pay after order is completed


We are trying to integrate Apple Pay on the web with a custom web ordering flow. This requires the order placement to be completed before the payment transaction is made.

But it seems that, as soon as the payment sheet is displayed (on Safari by Apple Pay JS API), there are only two (2) options:

  1. Either cancel payment
  2. Or complete payment transaction

This means that if the website needs to do any processing before the payment is authorized, this must be done during the period that the payment sheet is open and the user is waiting for the processing to be done.

Is there any other way to complete the Apple Pay authorization, close the payment sheet, and then continue with the order afterwards?

Or does the Apple pay payment need to be the last step of the ordering flow?

It is pretty common that an order is declined due to various other reasons, so how could someone deal with this when Apple pay payment sheet cannot be dismissed without the transaction being completed one way or another.

Thanks in advance.


Solution

  • Well in general, Apple pay payment should be the last step of the ordering flow.

    But yes, you can complete the Apple Pay authorization before, close the payment sheet, and then continue with the order afterwards.

    Once your order completes/decline, accordingly you can call your PSP (payment service provider) for capture or void your using the "transaction_tag".

    "transaction_tag" is the property of the response (JSON data) that you received on authorize from your PSP.