2016-12-29 2 views
0

私は、支払いシートを開くためにAppleのコード例をデバッグしようとしています。昨日はそれが働いて、支払い用紙が開かれましたが、今日はセッションを通過できないと思います。私がデバッグすると、getApplePaySession(event.validationURL)で停止せず、代わりにsession.onshippingmethodselectedに右にジャンプします(ライトボックスがまだ開かれていないため意味がありません)。アップルペイメントペイメントシートが開かない

コンソールにエラーはありません。 "Validate merchant"はコンソールに書き込まれません。 これはAppleが私が使用している提供とJSコードです:

const session = new ApplePaySession(1, paymentRequest); 

/** 
* Merchant Validation 
* We call our merchant session endpoint, passing the URL to use 
*/ 
session.onvalidatemerchant = (event) => { 
    console.log("Validate merchant"); 
    const validationURL = event.validationURL; 
    getApplePaySession(event.validationURL).then(function(response) { 
     console.log(response); 
     session.completeMerchantValidation(response); 
    }); 
}; 

/** 
* Shipping Method Selection 
* If the user changes their chosen shipping method we need to recalculate 
* the total price. We can use the shipping method identifier to determine 
* which method was selected. 
*/ 
session.onshippingmethodselected = (event) => { 
    const shippingCost = event.shippingMethod.identifier === 'free' ? '0.00' : '5.00'; 
    const totalCost = event.shippingMethod.identifier === 'free' ? '8.99' : '13.99'; 

    const lineItems = [ 
     { 
      label: 'Shipping', 
      amount: shippingCost, 
     }, 
    ]; 

    const total = { 
     label: 'Apple Pay Example', 
     amount: totalCost, 
    }; 

    session.completeShippingMethodSelection(ApplePaySession.STATUS_SUCCESS, total, lineItems); 
}; 

答えて

0

私は問題を解決しました。 MacとiPhoneは同じiCloudユーザーで構成されていませんでした。