2016-12-29 8 views
0

Ich versuche, Apple Code-Beispiel zu debuggen, um das Zahlungsblatt zu öffnen. Gestern hat es funktioniert und das Zahlungsformular wurde geöffnet, aber heute denke ich, dass ich die Sitzung nicht bestehen kann. Wenn ich debugge, wird es nicht in der getApplePaySession (event.validationURL) stoppen und stattdessen direkt zu der Session.onshippingmethodselectedelected (was nicht sinnvoll ist, weil die Light-Box noch nicht geöffnet wurde, oder ?!).Apple Pay Zahlung Blatt wird nicht geöffnet

Ich habe keinen Fehler in der Konsole. "Händler validieren" wird nicht in die Konsole geschrieben. Dies ist der JS-Code von Apple zur Verfügung gestellt und die ich verwende:

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); 
}; 

Antwort

0

ich das Problem gelöst. Der Mac und das iPhone wurden nicht mit demselben iCloud-Benutzer konfiguriert.

Verwandte Themen