Re-rendering Wallet widgets
In most cases, you don't need to refresh the Wallet widget as it automatically refreshes when a buyer chooses an address from the AddressBook widget. Frequent re-rendering of the Wallet widget affects website performance and causes a poor buyer experience.
But sometimes the re-rendering of the Wallet widget is actually required when certain constraints are returned in the checkout flow. Here are some examples:
- PaymentMethodNotAllowed — Amazon Pay might not allow all payment methods for a given transaction. After calling either the SetOrderReferenceDetails or GetOrderReferenceDetails operation, you might see a PaymentMethodNotAllowed constraint in the response. Attempting to confirm an Order Reference that has constraints also returns the error code ConstraintsExist.
- InvalidPaymentMethod — If there are problems with a buyer's payment method, it might be declined. If so, after making a GetAuthorizationDetails API call, you see a response with a Declined state with a InvalidPaymentMethod reason code.
As a best practice, you should re-render the Wallet widget and request that the buyer choose a different payment method.
For more information about constraints, see OrderReferenceConstraints in the Amazon Pay API reference guide.
To re-render the Wallet widget, bind the order reference Id, which was created from the AddressBook widget, to the Wallet widget.
<script> // re-render the wallet widget after saving new currencyCode. walletWidget.setPresentmentCurrency("GBP").bind("walletWidgetDiv"); </script>
Copyright © 2009-2019 Amazon.com, Inc. or its affiliates. Amazon and Amazon.com are registered trademarks of Amazon.com, Inc. or its affiliates. All other trademarks are the property of their respective owners.