'Apple Pay JS - How to check if payment is already authorized
I'm implementing Apple Pay on my web app using Apple Pay JS API.
Before creating a new ApplePaySession
, how can I check that Payment is already authorized and there is no need to create a new apple pay session for current transaction?
appreciate any thoughts.
Solution 1:[1]
Create a global variables and set it to false, onPaymentAuthorization event set it to true and use it for your check where it's required. let say -
Let isAppleAuthorized = false;
Apple session.onpaymentauthorized = function (event){
isAppleAuthorized = false;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Daniel Smith |