Skip to content

Amazon Pay ​

Amazon:AmazonPay ​

Renders: an Amazon Pay button using Amazon Pay Checkout v2.

Options ​

Type: AmazonPayOptions

Required ​

FieldTypeDescription
merchantIdstringAmazon Pay merchant ID.
publicKeyIdstringPublic key ID for signature verification. Use SANDBOX- prefix for sandbox.
ledgerCurrency'EUR' | 'GBP' | 'USD' | 'JPY'Ledger currency of your Amazon Pay account — not the transaction currency. Must match the ledger currency of the Amazon Pay provider account in collana pay. See Currencies.

Optional ​

FieldTypeDescription
localestringCheckout UI locale. Accepts collana pay format (de-DE) or Amazon Pay format (de_DE).
productType'PayAndShip' | 'PayOnly''PayAndShip' requires shipping; 'PayOnly' does not.
placement'Home' | 'Product' | 'Cart' | 'Checkout' | 'Other'Where the button appears in the checkout flow.
region'EU' | 'NA' | 'FE'Amazon Pay SDK region. Determines which checkout.js endpoint is loaded. Default: 'EU'.
isShippingCustomerDataRequiredbooleanSee Checkout Flow Flags. Default: false.
isBillingCustomerDataRequiredbooleanSee Checkout Flow Flags. Default: false.

Currencies ​

Amazon Pay distinguishes two currencies:

CurrencySourceExample
Ledger currencyoptions.ledgerCurrency — fixed per Amazon Pay account (EU EUR, UK GBP, US USD, JP JPY)EUR
Presentment currency (what the buyer pays in)The currency of the collana pay transaction your backend creates in onClickCHF

The button is rendered before any transaction exists, so it only needs the ledger currency. The presentment currency and the estimated order amount are taken from the transaction and delivered with the checkoutData — there is nothing to configure for them in the SDK. This lets an EUR account charge in any currency supported by Amazon Pay multi-currency.

currencyCode was renamed

options.currencyCode has been replaced by options.ledgerCurrency, and options.estimatedOrderAmount has been removed. A config that still sets currencyCode is rejected via onError, because the old option typically held the transaction currency, which is not a valid ledger currency.

Checkout Flow Flags ​

Amazon Pay supports two combinations of isShippingCustomerDataRequired and isBillingCustomerDataRequired:

isShippingCustomerDataRequiredisBillingCustomerDataRequiredBehaviour
falsefalseExpress flow (default) — Amazon Pay collects all customer data natively.
truetrueAmazon Pay skips its native address collection. Shipping and billing data must be provided by the integrator's backend.

Mixed combinations not supported

Setting one flag to true and the other to false is not supported for this provider and may lead to undefined behaviour.

Style ​

Type: AmazonPayStyle

FieldTypeDescription
color'Gold' | 'LightGray' | 'DarkGray'Button background color
size'small' | 'medium' | 'large'Predefined button size

Example ​

html
<div id="amazonpay-container"></div>
js
const buttons = CollanaPay.ExpressButtons({
  providers: [
    {
      providerProtocolType: 'Amazon',
      paymentMethodType: 'AmazonPay',
      container: '#amazonpay-container',
      style: {
        color: 'Gold',
        size: 'medium',
      },
      options: {
        merchantId: 'YOUR_AMAZON_MERCHANT_ID',
        publicKeyId: 'SANDBOX-ABCXYZ',
        ledgerCurrency: 'EUR',  // Amazon account ledger; the transaction may be in CHF etc.
        locale: 'de_DE',
        productType: 'PayAndShip',
        placement: 'Cart',
        region: 'EU',
      },
    },
  ],

  onClick: async (identity, options) => {
    const res = await fetch('/api/orders', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ provider: identity }),
    });
    const transaction = await res.json();
    return transaction.checkoutData;
  },

  onCancel: (identity) => {
    console.log('Amazon Pay cancelled', identity);
  },

  onError: (identity, error) => {
    console.error('Amazon Pay error', error);
  },
});

buttons.render();

Note: Amazon Pay uses a full-page redirect to Amazon's checkout. If the buyer cancels there, onCancel does not fire in the browser — your backend is informed via the collana pay server-to-server cancel callback instead.

collana pay SDK Documentation