Check Whether User Can Make Payment Before All Prices Are Known

Check Whether User Can Make Payment Before All Prices Are Known

If the checkout flow needs to know whether PaymentRequest.canMakePayment() will return true even before all line items and their prices are known, then you can instantiate PaymentRequest with dummy data and pre-query .canMakePayment().

If you call .canMakePayment() multiple times, keep in mind that the first parameter to the PaymentRequest constructor should contain the same method names and data.

Please note that no payments will be taken, this is just a front-end demo. If you would like to try entering card details, you can use dummy data, for example the card number 4111 1111 1111 1111.

Payment Request success. Demo complete. No payment has been taken.

The Payment Request API is unsupported or was cancelled or failed, so here we can proceed with our legacy web form (not implemented for this demo).