Skip to content

Amazon Pay

Amazon Pay

Provider key: Amazon:AmazonPay

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

Options — AmazonPayOptions

Required

FieldTypeDescription
merchantIdstringAmazon Pay merchant ID.
publicKeyIdstringPublic key ID for signature verification. Use SANDBOX- prefix for sandbox.
currencyCodestringISO 4217 currency code (e.g. 'EUR', 'USD').

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.
estimatedOrderAmountnumberEstimated order amount in minor units. Gives buyer a price preview.
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.

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 — 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',
        currencyCode: 'EUR',
        checkoutLanguage: 'de_DE',
        productType: 'PayAndShip',
        placement: 'Cart',
        estimatedOrderAmount: 19300,  // €193.00
        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.

CollanaPay SDK Documentation