Amazon Pay
The Amazon:AmazonPay provider renders an Amazon Pay button using Amazon Pay Checkout v2.
Options — AmazonPayOptions
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
merchantId | string | Yes | — | Amazon Pay merchant ID |
publicKeyId | string | Yes | — | Public key ID for signature verification. Use SANDBOX- prefix for sandbox |
currencyCode | string | Yes | — | ISO 4217 currency code (e.g. 'EUR', 'USD') |
checkoutLanguage | string | No | — | Checkout UI language (e.g. 'de_DE', 'en_US') |
productType | 'PayAndShip' | 'PayOnly' | No | — | 'PayAndShip' requires shipping; 'PayOnly' does not |
placement | 'Home' | 'Product' | 'Cart' | 'Checkout' | 'Other' | No | — | Where the button appears in the checkout flow |
estimatedOrderAmount | number | No | — | Estimated order amount in minor units. Gives buyer a price preview |
region | 'EU' | 'NA' | 'FE' | No | 'EU' | Amazon Pay SDK region. Determines which checkout.js endpoint is loaded |
Style — AmazonPayStyle
| Field | Type | Description |
|---|---|---|
color | 'Gold' | 'LightGray' | 'DarkGray' | Button background color |
size | 'small' | 'medium' | 'large' | Predefined button size |
Example
html
<div id="amazonpay-container"></div>js
import { ExpressButtons } from 'collana-pay-js';
const buttons = ExpressButtons({
providers: [
{
providerProtocolType: 'Amazon',
paymentMethodType: 'AmazonPay',
container: '#amazonpay-container',
style: {
color: 'Gold',
size: 'medium',
},
options: {
merchantId: 'YOUR_AMAZON_MERCHANT_ID',
publicKeyId: 'SANDBOX-AGUS2ZW5JXOAIYKS3WJQLLSD',
currencyCode: 'EUR',
checkoutLanguage: 'de_DE',
productType: 'PayAndShip',
placement: 'Cart',
estimatedOrderAmount: 19300, // €193.00
region: 'EU',
},
},
],
onClick: async (identity, paymentMethodData) => {
const res = await fetch('/api/orders', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ provider: identity, paymentMethodData }),
});
const order = await res.json();
return { orderId: order.id };
},
onApprove: (data) => {
window.location.href = `/order/success?id=${data.orderId}`;
},
onCancel: (identity) => {
console.log('Amazon Pay cancelled', identity);
},
onError: (error) => {
console.error('Amazon Pay error', error);
},
});
buttons.render();