I am implementing a payment integration with Cybersource using Apple Pay. I was able to request a valid merchant session from the Apple Pay Servers and pass it to the completeMerchantValidation function (apple pay on the web). The payment sheet pops up but keeps getting stuck at "processing". After 30-60 seconds an error pops up: "Apple Pay Not Completed. This website was not able to complete the payment. Please try again.". I found one related topic on the Apple forum but the only solution had something to do with the domain (initiativeContext) but I doubled checked and this was not my problem.
Does someone has any idea why this is not working?
I am trying to figure out why it is stuck at processing for days now but I can't find anything...
I was stuck at this exact step as well. But after some trial and error, I figured that the documentation is not quite exact at the description of completePaymentMethodSelection.
It says that you can pass an empty object if there is no update to send. But in fact, you have to respond with at least a "newTotal" key representing your current (unchanged) total, e.g.:
this.applePaySession.onpaymentmethodselected = event => {
// Define ApplePayPaymentMethodUpdate based on the selected payment method.
// No updates or errors are needed, pass an empty object.
const update = {
"newTotal": {
"label": "Demo",
"type": "final",
"amount": 42.00,
}
};
this.applePaySession.completePaymentMethodSelection(update);
};
Sending this instead of an empty object finally brought me one step further and let me approve the transaction on the iPhone.