Merci de votre visite. Cette page est disponible en anglais uniquement.

Step 5: Set purchase details

Before you can request payment, you need to set the details of the order using the orderReferenceId provided in the AddressBook (or Wallet widget step in case you do not use an AddressBook)


Make a call to the SetOrderAttributes API. In the request, set the following attributes in the OrderReferenceAttributes.


  • Amazon Order Reference ID
  • Order Total (the order amount and currency code)

Ensure that the Amazon Order Reference ID is a unique value. For more information, see Handling errors from Amazon Pay API calls.

Optional but strongly recommended:

  • Store Name
  • Seller Order ID
  • Seller Note

Setting the Store Name and Seller information affects the details that appear in: buyer emails and account status, information that is returned to you in IPN messages, and Settlement and Transaction reports.
Note: If you cannot provide Store Name, Seller Order ID, Seller Note, Platform ID, or Customer Information before the order is placed, you can set this data after the purchase is completed by using the SetOrderAttributes API call. For more information, see Adding order attributes after purchase.

Note: You must implement error handling with your API calls, and you must test the results of the API response. For more information, see Handling errors.

Making a call to the SetOrderAttributes API

$config = array (
  'merchant_id'   => 'YOUR_MERCHANT_ID', // Merchant/SellerID
  'access_key'    => 'YOUR_ACCESS_KEY', // MWS Access Key
  'secret_key'    => 'YOUR_SECRET_KEY', // MWS Secret Key
  'region'        => 'de',  
  'currency_code' => 'EUR'

$requestParameters = array();
$requestParameters['amazon_order_reference_id'] = $orderReferenceId;
$requestParameters['amount']            = $orderTotal;
$requestParameters['currency_code']     = 'EU'
$requestParameters['seller_note']       = 'Thank you for your order.';
$requestParameters['store_name']        = 'Name of your shop';
$requestParameters['seller_order_id']         = '10001-SAMPLE';

$client = new \AmazonPay\Client($config)    
$client -> SetOrderAttributes($requestParameters);
Making a call to the SetOrderAttributes API

from pay_with_amazon.client import PayWithAmazonClient

client = PayWithAmazonClient(

response = client.set_order_attributes (
  seller_note='My seller note.',
  store_name='My store name.',
  custom_information='My custom information.')
Making a call to the SetOrderAttributes API

require 'pay_with_amazon'

merchant_id = 'YOUR_MERCHANT_ID'
access_key = 'YOUR_ACCESS_KEY'
secret_key = 'YOUR_SECRET_KEY'

client =
  sandbox: true,
  currency_code: :usd,
  region: :na

amazon_order_reference_id = 'AMAZON_ORDER_REFERENCE_ID'
amount = 106

client.set_order_attributes (
  seller_note: 'Lorem ipsum dolor',
  seller_order_id: '5678-23',
  store_name: '',
  mws_auth_token: 'amzn.mws.4ea38b7b-f563-7709-4bae-87aeaEXAMPLE'
Making a call to the SetOrderReferenceDetails API

Order reference constraints

Amazon Pay might not always allow all payment methods for a given transaction. Depending on various factors, some payment methods might not be available. To determine the available payment methods, the amount of the transaction must be passed to the SetOrderAttributes operation.

To ensure that only allowed payment methods are shown to a buyer, Amazon Pay requires that you set the OrderTotal using the SetOrderAttributes operation before showing the Wallet widget, as described in the Displaying read-only AddressBook and Wallet Widgets section. Performing this operation enables Amazon Pay to determine which payment methods are allowed for this Order Reference.

If you set the OrderTotal after the buyer has chosen the payment method from the Wallet widget, you must inspect the result of the SetOrderAttributes operation for the presence of the PaymentMethodNotAllowed constraint. If this constraint is returned, it means that the payment method chosen by the buyer is not allowed for this Order Reference, and you will not be able to confirm the Order Reference until this constraint is resolved. To resolve this constraint, re-render the Wallet widget and request the buyer to choose a different payment method.

See also

Order Reference States and Reason Codes in the Amazon Pay API reference guide

Alternate scenarios