how to indicate error on completeShippingMethodSelection in v3 JS?

Hello,


The docs for completeShippingMethodSelection indicate that in v2, the arguments are (status, total, lineItems), but in v3 we are supposed to pass an

ApplePayShippingMethodUpdate
which only takes total and lineItems.


Currently if something goes wrong in our shippingMethodSelection handler, in our v2 JS code we do

session.completeShippingMethodSelection(session.STATUS_FAILURE, null, null)


However, the docs say that for v3 the only argument is an

ApplePayShippingMethodUpdate, but the docs for this object do not specify a field for or way to indicate STATUS_FAILURE. How are we supposed to indicate a failure on this function in v3?



Thanks

Dan

Replies

In V3 try moving the STATUS_SUCCESS or STATUS_FAILURE to Authorizing the Payment. <https://applepaydemo.apple.com/#authorizingThePayment>


session.onpaymentauthorized = function onpaymentauthorized(event) {
    var payment = event.payment;
    currentPaymentToken = payment.token.paymentData;

    window.setTimeout(function() {
        var update = {status: ApplePaySession.STATUS_SUCCESS};
       
        // Add logic in here ...

        session.completePayment(update);
    }, 2000);
};


Matt Eaton

DTS Engineering, CoreOS

meaton3 at apple.com