Hello everyone,
I am working on implementing Apple Pay in the web (react js) using Payment Request API, I have followed every step in the documentation. My problem is after I validatec the merchant successfully I requested the show() method and it would show me the payment sheet for few seconds then gives me a "TypeError: Type error", I have been trying to debug and solve the problem for few days now with no success :(.
Here is a sample from my code:
const request = new PaymentRequest(methods, details, options );
request.onmerchantvalidation = event => {
const merchantSessionPromise =
fetch(url).then(res => res.json()).catch(err => {
console.error("Error fetching merchant session", err);
});
event.complete(merchantSessionPromise);
};
// Here where the problem occurs :(
const response = await request.show();
const status = "success";
await response.complete(status);
} catch (e) {
console.error("Error completing the session", e);
}
Thank you in advance for all of the help