amazon-pay-sdk-samples icon indicating copy to clipboard operation
amazon-pay-sdk-samples copied to clipboard

The Wallet widget should use the Address Book's order reference Id

Open limal opened this issue 5 years ago • 2 comments

Your JavaScript code example at https://amzn.github.io/amazon-pay-sdk-samples/set.html is incorrect. It doesn't pass the order reference id from the Address Book widget to the Wallet widget which could result in PaymentPlanNotSet error later in the payment processing.

The Wallet widget should be initialised with the following property:

new OffAmazonPayments.Widgets.Wallet({
...
// Assign the same Order Reference ID you created in the address widget to the wallet widget as well. 
amazonOrderReferenceId: orderReferenceID,
...
}).bind("walletWidgetDiv");

limal avatar Sep 02 '19 11:09 limal

Solution: onOrderReferenceCreate: function (orderReference) {}

new OffAmazonPayments.Widgets.AddressBook({
        sellerId: 'MERCHANT_ID',
        onOrderReferenceCreate: function (orderReference) {
           orderReferenceId = orderReference.getAmazonOrderReferenceId();
        },
        onAddressSelect: function () {
            // do stuff here like recalculate tax and/or shipping
        },
        design: {
            designMode: 'responsive'
        },
        onError: function (error) {
            // your error handling code
        }
    }).bind("addressBookWidgetDiv");

vidalweb avatar Apr 17 '20 19:04 vidalweb

this thing destroyed me

Etto91 avatar Sep 18 '20 12:09 Etto91