amazon-pay-sdk-samples
amazon-pay-sdk-samples copied to clipboard
The Wallet widget should use the Address Book's order reference Id
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");
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");
this thing destroyed me