Post

Replies

Boosts

Views

Activity

Payment not completed error
I am using a sandbox account, and I set United States in the region column (Settings>General>Language & Region>Region to US). I added test cards like (American Express and Visa) and the cards added successfully. But I am trying to pay then I get an error like "Payment Not Completed". Note: I am trying from India. Please let me know what exactly i am doing mistake here Following code i am using. function onApplePayButtonClicked() { if (!ApplePaySession) { return; } // Define ApplePayPaymentRequest const request = { "countryCode": "US", "currencyCode": "USD", "merchantCapabilities": [ "supports3DS" ], "supportedNetworks": [ "visa", "masterCard", "amex", "discover" ], "total": { "label": "Demo (Card is not charged.)", "type": "final", "amount": "1.99" } }; // Create ApplePaySession const session = new ApplePaySession(3, request); session.onvalidatemerchant = event => { // Call your own server to request a new merchant session. var merchantSession = merchantValidation(event.validationURL); session.completeMerchantValidation(merchantSession); }; session.onpaymentmethodselected = event => { // Define ApplePayPaymentMethodUpdate based on the selected payment method. // No updates or errors are needed, pass an empty object. const update = {}; session.completePaymentMethodSelection(update); }; session.onshippingmethodselected = event => { // Define ApplePayShippingMethodUpdate based on the selected shipping method. // No updates or errors are needed, pass an empty object. const update = {}; session.completeShippingMethodSelection(update); }; session.onshippingcontactselected = event => { // Define ApplePayShippingContactUpdate based on the selected shipping contact. const update = {}; session.completeShippingContactSelection(update); }; session.onpaymentauthorized = event => { // Define ApplePayPaymentAuthorizationResult const result = { "status": ApplePaySession.STATUS_SUCCESS }; session.completePayment(result); }; session.oncouponcodechanged = event => { // Define ApplePayCouponCodeUpdate const newTotal = calculateNewTotal(event.couponCode); const newLineItems = calculateNewLineItems(event.couponCode); const newShippingMethods = calculateNewShippingMethods(event.couponCode); const errors = calculateErrors(event.couponCode); session.completeCouponCodeChange({ newTotal: newTotal, newLineItems: newLineItems, newShippingMethods: newShippingMethods, errors: errors, }); }; session.oncancel = event => { // Payment canceled by WebKit }; session.begin(); }
1
0
432
Aug ’24