---
title: Add the Amazon Pay Button
url: amazon-pay-recurring-checkout/add-the-amazon-pay-button.html
---

**[Step 2 of 11]** The Amazon Pay checkout experience starts when the buyer clicks on the Amazon Pay button. Add the button wherever the buyer starts checkout, such as on the mini cart, shopping cart page, or checkout page. 

In this step, you will configure the Amazon Pay Checkout Session object and then render the Amazon Pay button. At the end of this step, you will be able to redirect the buyer to an Amazon Pay hosted page where they can select their preferred shipping address and payment instrument.

You must add the domains where the Amazon Pay button will be rendered to Seller Central. See <a href='../amazon-pay-recurring-checkout/get-set-up-for-integration.html#2-add-domains-to-seller-central' target='_blank' rel='noopener noreferrer'>Add domains to Seller Central</a> for more information.

<script>
  function keySpecifics(){
    const keyQuery = "?environmentSpecificKeys=";
    const currentSetting = window.location.search?.split("?environmentSpecificKeys=")[1] ?? 'false';
    const newSetting = currentSetting === 'false' ? 'true' : 'false';
    window.location = window.location.origin + window.location.pathname + keyQuery + newSetting // +  window.location.hash (not included as it feels weird to jump down)
  }
</script>
<div style="display:none" class="environmentSpecificKeys">
  <div markdown="span" class="alert alert-info" role="alert"><i class="fa fa-info-circle"></i> <b>Note:</b> If your publicKeyId <b>_does not_</b> have an environment prefix (does not begin with 'SANDBOX' or 'LIVE') follow <a href='#' onclick='keySpecifics()' rel='noopener noreferrer'>these instructions</a> instead.</div>
</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
  <div markdown="span" class="alert alert-info" role="alert"><i class="fa fa-info-circle"></i> <b>Note:</b> If your publicKeyId has an environment prefix (for example: SANDBOX-AFVX7ULWSGBZ5535PCUQOY7B) follow <a href='#' onclick='keySpecifics()' rel='noopener noreferrer'>these instructions</a> instead.</div>
</div>


* TOC
{:toc}
{::options toc_levels="3" /}

***

### 1. Add the Amazon Pay script

Add the Amazon Pay script to your HTML file. Be sure you select the correct region.

<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#ustab" data-toggle="tab">US</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#eutab" data-toggle="tab">EU / UK</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#jptab" data-toggle="tab">JP</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="ustab">   
<div markdown="block">
```html
<script src="https://static-na.payments-amazon.com/checkout.js"></script>
```
</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="eutab">
<div markdown="block">
```html
<script src="https://static-eu.payments-amazon.com/checkout.js"></script>
```
</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="jptab">
<div markdown="block">
```html
<script src="https://static-fe.payments-amazon.com/checkout.js"></script>
```
</div>
  </div>
</div>

***

### 2. Generate the Create Checkout Session payload

To render the Amazon Pay button, you will need to provide a payload that Amazon Pay will use to create a <a href="../amazon-pay-api-v2/checkout-session.md" target="_blank" rel="noopener noreferrer">Checkout Session</a> object. You will use the Checkout Session object to manage the buyer’s active session on your website. The payload has the same structure as the request body for the [Create Checkout Session](../amazon-pay-api-v2/checkout-session.html#create-checkout-session){:target="\_blank"} API. Providing the payload as part of the button removes the need to call this API. In the payload, you must provide all details required for the buyer to complete checkout.

**Instructions for generating button payload:**
* Set `checkoutReviewReturnUrl` parameter to the URL that the buyer is redirected to after they select their preferred shipping address and payment method. The Checkout Session ID will be appended as a query parameter.
* Set `recurringMetadata.frequency` to increase buyer confidence. If you do not provide a value in this step, you are required to set a value before the buyer can complete checkout. Note that Amazon Pay only uses the values provided to calculate the <a href="../amazon-pay-api-v2/charge-permission.md" target="_blank" rel="noopener noreferrer">Charge Permission</a> expiration date and in buyer communication. You are still responsible for calling <a href="../amazon-pay-api-v2/charge.md#create-charge" target="_blank" rel="noopener noreferrer">Create Charge</a> to charge the buyer for each billing cycle. 
* Specify the buyer information you need to complete checkout using the `scopes` parameter. If you do not set this value, all buyer information except billing address will be requested. 

**Optional integrations steps:**
* Use the `deliverySpecifications` parameter to specify shipping restrictions and prevent buyers from selecting unsupported addresses from their Amazon address book. See <a href="../amazon-pay-checkout/address-restriction-samples.md" target="_blank" rel="noopener noreferrer">address restriction samples</a> for samples how to handle common use-cases.
* If you registered for Amazon Pay in the EU or UK, you can use the `presentmentCurrency` parameter to charge your buyer using a different <a href="../amazon-pay-checkout/multi-currency-integration.md#supported-currencies" target="_blank" rel="noopener noreferrer">supported currency</a>. See <a href="../amazon-pay-checkout/multi-currency-integration.md" target="_blank" rel="noopener noreferrer">multi-currency integration</a> for more info.

#### Payload example

```
{
    "webCheckoutDetails": {
        "checkoutReviewReturnUrl": "https://a.com/merchant-review-page"
    },
    "storeId": "amzn1.application-oa2-client.8b5e45312b5248b69eeaStoreId",
    "scopes": ["name", "email", "phoneNumber", "billingAddress"],
    "chargePermissionType": "Recurring",   
    "recurringMetadata": {
        "frequency": { 
            "unit": "Month", 
            "value": "1" 
        },
        "amount": { 
            "amount": "30",
            "currencyCode": "USD"
        }
    }, 
    "deliverySpecifications": {
        "specialRestrictions": ["RestrictPOBoxes"],
        "addressRestrictions": {
            "type": "Allowed",
            "restrictions": {
                "US": {
                    "statesOrRegions": ["WA"],
                    "zipCodes": ["95050", "93405"]
                },
                "GB": {
                    "zipCodes": ["72046", "72047"]
                },
                "IN": {
                    "statesOrRegions": ["AP"]
                },
                "JP": {}
            }
        }
    }
}  
```

<table width="100%" border="1">
    <tbody>
        <tr id='SPI9CAupGTX'>
            <td id='s:SPI9CAupGTX;SPI9CAPMpxx' style='vertical-align: top; font-weight: bold; width: 30%' class='bold'>Name
                <br /></td>
            <td id='s:SPI9CAupGTX;SPI9CAm9zzw' style='vertical-align: top; font-weight: bold; width: 20%' class='bold'>Location
                <br /></td>
            <td id='s:SPI9CAupGTX;SPI9CAMemY9' style='vertical-align: top; font-weight:bold;  width: 50%' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='SPI9CAI5yKv'>
            <td id='s:SPI9CAI5yKv;SPI9CAPMpxx' style='vertical-align: top;'>webCheckoutDetails<br><b>(required)</b><br /><br />Type: <a href="../amazon-pay-api-v2/checkout-session.md#type-webcheckoutdetails" target="_blank" rel="noopener noreferrer">webCheckoutDetails</a>
                <br /></td>
            <td id='s:SPI9CAI5yKv;SPI9CAm9zzw' style='text-align: left;vertical-align: top;'>Body
                <br /></td>
            <td id='s:SPI9CAI5yKv;SPI9CAMemY9' style='vertical-align: top;'>URLs associated to the Checkout Session used to complete checkout. The URLs must use HTTPS protocol
                <br /></td>
        </tr>
        <tr id='SPI9CAQrHNB'>
            <td id='s:SPI9CAQrHNB;SPI9CAPMpxx' style='vertical-align: top;'>storeId<br><b>(required)</b><br><br>Type: string
                <br /></td>
            <td id='s:SPI9CAQrHNB;SPI9CAm9zzw' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:SPI9CAQrHNB;SPI9CAMemY9' style='vertical-align: top;'>Amazon Pay store ID. Retrieve this value from Amazon Pay Integration Central: <a href="https://sellercentral.amazon.com/gp/pyop/seller/integrationcentral/" target="_blank" rel="noopener noreferrer">US</a>, <a href="https://sellercentral-europe.amazon.com/gp/pyop/seller/integrationcentral/" target="_blank" rel="noopener noreferrer">EU</a>, <a href="https://sellercentral-japan.amazon.com/gp/pyop/seller/integrationcentral/" target="_blank" rel="noopener noreferrer">JP</a>
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>scopes<br /><br />Type: list &lt;scope&gt;
                <br /></td>
            <td id='' style='text-align: left;vertical-align: top;'>Body
                <br /></td>
            <td id='' style='vertical-align: top;'>The buyer details that you're requesting access to. Specify whether you need shipping address using button <code>productType</code> parameter in Step 4.<br><br>Supported values:
                    <ul>
                      <li>'name' - Buyer name</li>
                      <li>'email' - Buyer email</li>
                      <li>'phoneNumber' - Buyer phone number. You must also request <code>billingAddress</code> scope or use <code>payAndShip</code> productType to retrieve the billing address or shipping address phone number.</li>
                      <li>'billingAddress' - Default billing address</li>
                    </ul>
            Default value: all buyer information except billing address is requested if the <code>scopes</code> parameter is not set
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>chargePermissionType<br /><br />Type: string
                <br /></td>
            <td id='' style='text-align: left;vertical-align: top;'>Body
                <br /></td>
            <td id='' style='vertical-align: top;'>The type of Charge Permission requested<br><br>Supported values:
                    <ul>
                      <li>'OneTime' - The Charge Permission can only be used for a single order</li>
                      <li>'Recurring' - The Charge Permission can be used for recurring orders</li>
                    </ul>
            Default value: 'OneTime"
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>recurringMetadata<br /><br />Type: <a href="../amazon-pay-api-v2/checkout-session.md#type-recurringmetadata" target="_blank" rel="noopener noreferrer">recurringMetadata</a>
                <br /></td>
            <td id='' style='text-align: left;vertical-align: top;'>Body
                <br /></td>
            <td id='' style='vertical-align: top;'>Metadata about how the recurring Charge Permission will be used. Amazon Pay only uses this information to calculate the Charge Permission expiration date and in buyer communication<br /><br />
            Note that it is still your responsibility to call <a href="../amazon-pay-api-v2/charge.md#create-charge" target="_blank" rel="noopener noreferrer">Create Charge</a> to charge the buyer for each billing cycle
                <br /></td>
        </tr>
         <tr id=''>
            <td id='' style='vertical-align: top;'>deliverySpecifications<br /><br />Type: <a href="../amazon-pay-api-v2/checkout-session.md#type-deliveryspecifications" target="_blank" rel="noopener noreferrer">deliverySpecifications</a>
                <br /></td>
            <td id='' style='text-align: left;vertical-align: top;'>Body
                <br /></td>
            <td id='' style='vertical-align: top;'>Specify shipping restrictions to prevent buyers from selecting unsupported addresses from their Amazon address book 
                <br /></td>
        </tr>
    </tbody>
</table>

***

### 3. Sign the payload

You must secure the payload using a signature. The payload does not include a timestamp so you can re-use the signature as long as the payload does not change. If you need to change the payload and your button signature is dynamic, you should <a href="../amazon-pay-checkout/amazon-pay-script.md#decoupling-button-render-and-checkout-initiation" target="_blank" rel="noopener noreferrer">decouple button render from checkout initialization</a> to avoid re-rendering the button.

**Option 1 (recommended):** Generate a signature using the helper function provided in the Amazon Pay SDKs. The signature generated by the helper function is only valid for the button and not for API requests.

<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#phptab" data-toggle="tab">PHP</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#dotnettab" data-toggle="tab">.NET</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#javatab" data-toggle="tab">Java</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#nodejstab" data-toggle="tab">Node.js</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="phptab">   
<div markdown="block">
```
<?php
    include 'vendor/autoload.php';

    $amazonpay_config = array(
        'public_key_id' => 'MY_PUBLIC_KEY_ID',
        'private_key'   => 'keys/private.pem',
        'region'        => 'US',
        'sandbox'       => true,
        'algorithm' => 'AMZN-PAY-RSASSA-PSS-V2'
    );

    $client = new Amazon\Pay\API\Client($amazonpay_config);
    $payload = '{"storeId":"amzn1.application-oa2-client.xxxxx","webCheckoutDetails":{"checkoutReviewReturnUrl":"https://example.com/review.html"},"chargePermissionType":"Recurring","recurringMetadata":{"frequency":{ unit":"Month","value":"1"},"amount":{"amount":"30","currencyCode":"USD"}}}';
    $signature = $client->generateButtonSignature($payload);
    echo $signature . "\n";
?>
```
<a href="https://github.com/amzn/amazon-pay-api-sdk-php/blob/master/Amazon/Pay/API/Client.php#L400"  target="_blank" rel="noopener noreferrer">Source code</a>
</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="dotnettab">
<div markdown="block">
```
var payConfiguration = new ApiConfiguration
(
    region: Region.Europe,
    environment: Environment.Sandbox,
    publicKeyId: "MY_PUBLIC_KEY_ID",
    privateKey: "PATH_OR_CONTENT_OF_MY_PRIVATE_KEY",
    algorithm: AmazonSignatureAlgorithm.V2
);

var request = new  CreateCheckoutSessionRequest
(
    checkoutReviewReturnUrl: "https://example.com/review.html",
    storeId: "amzn1.application-oa2-client.xxxxx"
);

request.ChargePermissionType = ChargePermissionType.Recurring;
request.RecurringMetadata.Frequency.Unit = FrequencyUnit.Month;
request.RecurringMetadata.Frequency.Value = 1;
request.RecurringMetadata.Amount.Unit = 99.99M;
request.RecurringMetadata.Amount.CurrencyCode = Currency.EUR;

// generate the button signature
var signature = client.GenerateButtonSignature(request);

// the payload as JSON string that you must assign to the button in the next step
var payload = request.ToJson(); 
```
<a href="https://github.com/amzn/amazon-pay-api-sdk-dotnet/#generate-button-signature" target="_blank" rel="noopener noreferrer">Source code</a>
</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="javatab">
<div markdown="block">
```
PayConfiguration payConfiguration = null;
try {
    payConfiguration = new PayConfiguration()
                .setPublicKeyId("YOUR_PUBLIC_KEY_ID")
                .setRegion(Region.YOUR_REGION_CODE)
                .setPrivateKey("YOUR_PRIVATE_KEY_STRING")
                .setEnvironment(Environment.SANDBOX)
                .setAlgorithm("AMZN-PAY-RSASSA-PSS-V2");
}catch (AmazonPayClientException e) {
    e.printStackTrace();
}

AmazonPayClient client = new AmazonPayClient(payConfiguration);

String payload = "{\"storeId\":\"amzn1.application-oa2-client.xxxxxx\",\"webCheckoutDetails\":{\"checkoutReviewReturnUrl\":\"https://example.com/review.html\"},\"chargePermissionType\":\"Recurring\",\"recurringMetadata\":{\"frequency\":{\"unit\":\"Month\",\"value\":\"1\"},\"amount\":{\"amount\":\"30\",\"currencyCode\":\"USD\"}}}";
String signature = client.generateButtonSignature(payload);

```
<a href="https://github.com/amzn/amazon-pay-api-sdk-java/blob/bbbf89c480f07f8a7217a0a50e88131832612f59/src/com/amazon/pay/api/AmazonPayClient.java#L105"  target="_blank" rel="noopener noreferrer">Source code</a>
</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="nodejstab">
<div markdown="block">
```html
const fs = require('fs');
const Client = require('@amazonpay/amazon-pay-api-sdk-nodejs');

const config = {
    publicKeyId: 'ABC123DEF456XYZ',
    privateKey: fs.readFileSync('tst/private.pem'),
    region: 'us',
    sandbox: true,
    algorithm: 'AMZN-PAY-RSASSA-PSS-V2'
};

const testPayClient = new Client.AmazonPayClient(config);
const payload = {
    "webCheckoutDetails": {
        "checkoutReviewReturnUrl": "https://example.com/review.html"
    },
    "storeId": "amzn1.application-oa2-client.xxxxx",
    "chargePermissionType": "Recurring",   
    "recurringMetadata": {
        "frequency": { 
            "unit": "Month", 
            "value": "1" 
        },
        "amount": { 
            "amount": "30",
            "currencyCode": "USD"
        }
    }
};
const signature = testPayClient.generateButtonSignature(payload);
```
<a href="https://github.com/amzn/amazon-pay-api-sdk-nodejs/blob/23c3f03f06a4deab437a42885e1d1f548287e7f3/src/client.js#L60"  target="_blank" rel="noopener noreferrer">Source code</a>
</div>
  </div>
</div>

**Option 2:** Build the signature manually by following steps 2 and 3 of the <a href="../amazon-pay-api-v2/signing-requests.md" target="_blank" rel="noopener noreferrer">signing requests</a> guide.


***

### 4. Render the button

Use the values from the previous two steps to render the Amazon Pay button to a HTML container element. The button will be responsive and it will inherit the size of the container element, see <a href="../amazon-pay-checkout/amazon-pay-script.md#responsive-button-logic" target="_blank" rel="noopener noreferrer">responsive button logic</a> for details.

The code below will initiate Amazon Pay checkout immediately on button click. If you need control of the click event, you can decouple button render and checkout initiation. See <a href="../amazon-pay-checkout/amazon-pay-script.md" target="_blank" rel="noopener noreferrer">Amazon Pay script</a> for more info.

#### Code sample

<div style="display:none" class="environmentSpecificKeys">
<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#usButtonTab" data-toggle="tab">US</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#euButtonTab" data-toggle="tab">EU</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#ukButtonTab" data-toggle="tab">UK</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#jpButtonTab" data-toggle="tab">JP</a></li>
</ul>
<div class="tab-content">


  <div role="tabpanel" class="tab-pane active" id="usButtonTab">   
<div markdown="block">
```html
<body>
    <div id="AmazonPayButton"></div>
    <script src="https://static-na.payments-amazon.com/checkout.js"></script>
    <script type="text/javascript" charset="utf-8">
        amazon.Pay.renderButton('#AmazonPayButton', {
            // set checkout environment
            merchantId: 'merchant_id',
            publicKeyId: 'SANDBOX-xxxxxxxxxx',
            ledgerCurrency: 'USD',            
            // customize the buyer experience
            checkoutLanguage: 'en_US',
            productType: 'PayAndShip',
            placement: 'Cart',
            buttonColor: 'Gold',
            // configure Create Checkout Session request
            createCheckoutSessionConfig: {                     
                payloadJSON: 'payload', // string generated in step 2
                signature: 'xxxx', // signature generated in step 3
                algorithm : 'AMZN-PAY-RSASSA-PSS-V2'
            }   
        });
    </script>
</body>
```
</div>
  </div>

  <div role="tabpanel" class="tab-pane" id="euButtonTab">
<div markdown="block">
```html
<body>
    <div id="AmazonPayButton"></div>
    <script src="https://static-eu.payments-amazon.com/checkout.js"></script>
    <script type="text/javascript" charset="utf-8">
        amazon.Pay.renderButton('#AmazonPayButton', {
            // set checkout environment
            merchantId: 'merchant_id',
            publicKeyId: 'SANDBOX-xxxxxxxxxx',
            ledgerCurrency: 'EUR',              
            // customize the buyer experience
            checkoutLanguage: 'en_GB',
            productType: 'PayAndShip',
            placement: 'Cart',
            buttonColor: 'Gold',
            // configure Create Checkout Session request
            createCheckoutSessionConfig: {                     
                payloadJSON: 'payload', // string generated in step 2
                signature: 'xxxx', // signature generated in step 3
                algorithm : 'AMZN-PAY-RSASSA-PSS-V2'
            }   
        });
    </script>
</body>
```
</div>
  </div>

<div role="tabpanel" class="tab-pane" id="ukButtonTab">
<div markdown="block">
```html
<body>
    <div id="AmazonPayButton"></div>
    <script src="https://static-eu.payments-amazon.com/checkout.js"></script>
    <script type="text/javascript" charset="utf-8">
        amazon.Pay.renderButton('#AmazonPayButton', {
            // set checkout environment
            merchantId: 'merchant_id',
            publicKeyId: 'SANDBOX-xxxxxxxxxx',
            ledgerCurrency: 'GBP',            
            // customize the buyer experience
            checkoutLanguage: 'en_GB',
            productType: 'PayAndShip',
            placement: 'Cart',
            buttonColor: 'Gold',
            // configure Create Checkout Session request
            createCheckoutSessionConfig: {                     
                payloadJSON: 'payload', // string generated in step 2
                signature: 'xxxx', // signature generated in step 3
                algorithm : 'AMZN-PAY-RSASSA-PSS-V2'
            }   
        });
    </script>
</body>
```
</div>
  </div>  

  <div role="tabpanel" class="tab-pane" id="jpButtonTab">
<div markdown="block">
```html
<body>
    <div id="AmazonPayButton"></div>
    <script src="https://static-fe.payments-amazon.com/checkout.js"></script>
    <script type="text/javascript" charset="utf-8">
        amazon.Pay.renderButton('#AmazonPayButton', {
            // set checkout environment
            merchantId: 'merchant_id',
            publicKeyId: 'SANDBOX-xxxxxxxxxx',
            ledgerCurrency: 'JPY',            
            // customize the buyer experience
            checkoutLanguage: 'ja_JP',
            productType: 'PayAndShip',
            placement: 'Cart',
            buttonColor: 'Gold',
            // configure Create Checkout Session request
            createCheckoutSessionConfig: {                     
                payloadJSON: 'payload', // string generated in step 2
                signature: 'xxxx', // signature generated in step 3
                algorithm : 'AMZN-PAY-RSASSA-PSS-V2'
            }   
        });
    </script>
</body>
```
</div>
  </div>
</div>
</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#usButtonTabNESK" data-toggle="tab">US</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#euButtonTabNESK" data-toggle="tab">EU</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#ukButtonTabNESK" data-toggle="tab">UK</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#jpButtonTabNESK" data-toggle="tab">JP</a></li>
</ul>
<div class="tab-content">


  <div role="tabpanel" class="tab-pane active" id="usButtonTabNESK">   
<div markdown="block">
```html
<body>
    <div id="AmazonPayButton"></div>
    <script src="https://static-na.payments-amazon.com/checkout.js"></script>
    <script type="text/javascript" charset="utf-8">
        amazon.Pay.renderButton('#AmazonPayButton', {
            // set checkout environment
            merchantId: 'merchant_id',
            ledgerCurrency: 'USD',
            sandbox: true,               
            // customize the buyer experience
            checkoutLanguage: 'en_US',
            productType: 'PayAndShip',
            placement: 'Cart',
            buttonColor: 'Gold',
            // configure Create Checkout Session request
            createCheckoutSessionConfig: {                     
                payloadJSON: 'payload', // string generated in step 2
                signature: 'xxxx', // signature generated in step 3
                algorithm : 'AMZN-PAY-RSASSA-PSS-V2',
                publicKeyId: 'xxxxxxxxxx' 
            }   
        });
    </script>
</body>
```
</div>
  </div>

  <div role="tabpanel" class="tab-pane" id="euButtonTabNESK">
<div markdown="block">
```html
<body>
    <div id="AmazonPayButton"></div>
    <script src="https://static-eu.payments-amazon.com/checkout.js"></script>
    <script type="text/javascript" charset="utf-8">
        amazon.Pay.renderButton('#AmazonPayButton', {
            // set checkout environment
            merchantId: 'merchant_id',
            ledgerCurrency: 'EUR',
            sandbox: true,               
            // customize the buyer experience
            checkoutLanguage: 'en_GB',
            productType: 'PayAndShip',
            placement: 'Cart',
            buttonColor: 'Gold',
            // configure Create Checkout Session request
            createCheckoutSessionConfig: {                     
                payloadJSON: 'payload', // string generated in step 2
                signature: 'xxxx', // signature generated in step 3
                algorithm : 'AMZN-PAY-RSASSA-PSS-V2',
                publicKeyId: 'xxxxxxxxxx' 
            }   
        });
    </script>
</body>
```
</div>
  </div>

<div role="tabpanel" class="tab-pane" id="ukButtonTabNESK">
<div markdown="block">
```html
<body>
    <div id="AmazonPayButton"></div>
    <script src="https://static-eu.payments-amazon.com/checkout.js"></script>
    <script type="text/javascript" charset="utf-8">
        amazon.Pay.renderButton('#AmazonPayButton', {
            // set checkout environment
            merchantId: 'merchant_id',
            ledgerCurrency: 'GBP',
            sandbox: true,               
            // customize the buyer experience
            checkoutLanguage: 'en_GB',
            productType: 'PayAndShip',
            placement: 'Cart',
            buttonColor: 'Gold',
            // configure Create Checkout Session request
            createCheckoutSessionConfig: {                     
                payloadJSON: 'payload', // string generated in step 2
                signature: 'xxxx', // signature generated in step 3
                algorithm : 'AMZN-PAY-RSASSA-PSS-V2',
                publicKeyId: 'xxxxxxxxxx' 
            }   
        });
    </script>
</body>
```
</div>
  </div>  

  <div role="tabpanel" class="tab-pane" id="jpButtonTabNESK">
<div markdown="block">
```html
<body>
    <div id="AmazonPayButton"></div>
    <script src="https://static-fe.payments-amazon.com/checkout.js"></script>
    <script type="text/javascript" charset="utf-8">
        amazon.Pay.renderButton('#AmazonPayButton', {
            // set checkout environment
            merchantId: 'merchant_id',
            ledgerCurrency: 'JPY',
            sandbox: true,               
            // customize the buyer experience
            checkoutLanguage: 'ja_JP',
            productType: 'PayAndShip',
            placement: 'Cart',
            buttonColor: 'Gold',
            // configure Create Checkout Session request
            createCheckoutSessionConfig: {                     
                payloadJSON: 'payload', // string generated in step 2
                signature: 'xxxx', // signature generated in step 3
                algorithm : 'AMZN-PAY-RSASSA-PSS-V2',
                publicKeyId: 'xxxxxxxxxx' 
            }   
        });
    </script>
</body>
```
</div>
  </div>
</div>
</div>

#### Function parameters

<table width="100%" border="1">
    <tbody>
        <tr id='SPI9CAvz30I'>
            <td id='s:SPI9CAvz30I;SPI9CAwqfh9' style='vertical-align: top; font-weight: bold ; width: 35%' class='bold'>Parameter
                <br /></td>
            <td id='s:SPI9CAvz30I;SPI9CAy6rIp' style='vertical-align: top; font-weight: bold; width: 65%' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='SPI9CAIyYS4'>
            <td id='s:SPI9CAIyYS4;SPI9CAwqfh9' style='vertical-align: top;'>merchantId<br>(<b>required</b>)<br><br>Type: string
                <br /></td>
            <td id='s:SPI9CAIyYS4;SPI9CAy6rIp' style='text-align: left;vertical-align: top;'>Amazon Pay merchant account identifier
                <br /></td>
        </tr>
         <tr id='' style="display:none;" class="environmentSpecificKeys">
            <td id='' style='vertical-align: top;'>publicKeyId<br>(<b>required</b>)<br><br>Type: string
                <br /></td>
            <td id='' style='text-align: left;vertical-align: top;'>Credential provided by Amazon Pay. See <a href="../amazon-pay-recurring-checkout/get-set-up-for-integration.md#4-get-your-publickeyid" target="_blank" rel="noopener noreferrer">Get you publicKeyId</a> for more info<br><br>
            You must also set the <code>sandbox</code> parameter if your <code>publicKeyId</code> does not have an environment prefix
                <br /></td>
        </tr>
        <tr id='SPI9CAw52Yq'>
            <td id='s:SPI9CAw52Yq;SPI9CAwqfh9' style='vertical-align: top;'>createCheckoutSessionConfig<br>(<b>required</b>)<br><br>Type: <a href="../amazon-pay-checkout/amazon-pay-script.md#type-buttonConfig">buttonConfig</a>
                <br /></td>
            <td id='s:SPI9CAw52Yq;SPI9CAy6rIp' style='text-align: left;vertical-align: top;'>Create Checkout Session configuration. This is a required field if you use PayAndShip or PayOnly <code>productType</code></td>
        </tr>
         <tr id='SPI9CAf8yEh'>
                    <td id='s:SPI9CAf8yEh;SPI9CAwqfh9' style='text-align: left;vertical-align: top;'>placement<br>(<b>required</b>)<br><br>Type: string
                        <br /></td>
                    <td id='s:SPI9CAf8yEh;SPI9CAy6rIp' style='text-align: left;vertical-align: top;'>Placement of the Amazon Pay button on your website<br><br>Supported values:
                    <ul>
                      <li>'Home' - Initial or main page</li>
                      <li>'Product' - Product details page</li>
                      <li>'Cart' - Cart review page before buyer starts checkout</li>
                      <li>'Checkout' - Any page after buyer starts checkout</li>
                      <li>'Other' - Any page that doesn't fit the previous descriptions</li>
                    </ul>
                  </td>
                </tr>
        <tr id='IXV9CAD2lCG'>
            <td id='s:IXV9CAD2lCG;IXV9CAYD3dl' style='text-align: left;vertical-align: top;'>ledgerCurrency<br>(<b>required</b>)<br><br>Type: string
                <br /></td>
            <td id='s:IXV9CAD2lCG;IXV9CAsibgY' style='text-align: left;vertical-align: top;'>Ledger currency provided during registration for the given merchant identifier<br><br>Supported values: 
            <ul>
                <li>US merchants - 'USD'</li>
                <li>EU merchants - 'EUR'</li>
                <li>UK merchants - 'GBP'</li>
                <li>JP merchants - 'JPY'</li>
              </ul>
            </td>
        </tr>
        <tr id='SPI9CAcT2N8'>
            <td id='s:SPI9CAcT2N8;SPI9CAwqfh9' style='vertical-align: top;'>productType<br><br>Type: string
                <br /></td>
            <td id='s:SPI9CAcT2N8;SPI9CAy6rIp' style='text-align: left;vertical-align: top;'>Product type selected for checkout<br><br>Supported values:<br>
                    <ul>
                      <li>'PayAndShip' - Offer checkout using buyer's Amazon wallet and  address book. Select this product type if you need the buyer's shipping details</li>
                      <li>'PayOnly' - Offer checkout using only the buyer's Amazon wallet. Select this product type if you do not need the buyer's shipping details</li>
                      <li>'SignIn' - Offer Amazon Sign-in. Select this product type if you need buyer details before the buyer starts Amazon Pay checkout. See <a href="../amazon-pay-checkout/amazon-sign-in.md" target="_blank" rel="noopener noreferrer">Amazon Sign-in</a> for more information.</li>
                    </ul>
              Default value: 'PayAndShip'
                <br /></td>
        </tr>
        <tr id=''>
            <td id='' style='vertical-align: top;'>buttonColor<br><br>Type: string
                <br /></td>
            <td id='' style='text-align: left;vertical-align: top;'>Color of the Amazon Pay button<br><br>Supported values: 'Gold', 'LightGray', 'DarkGray'<br>
              Default value: 'Gold'
                <br /></td>
        </tr>
        <tr id='SPI9CAUKjWp'>
            <td id='s:SPI9CAUKjWp;SPI9CAwqfh9' style='vertical-align: top;'>checkoutLanguage<br><br>Type: string
                <br /></td>
            <td id='s:SPI9CAUKjWp;SPI9CAy6rIp' style='text-align: left;vertical-align: top;'>Language used to render the button and text on Amazon Pay hosted pages. Please note that supported language(s) is dependent on the region that your Amazon Pay account was registered for<br><br>Supported values: 
              <ul>
                <li>US merchants - 'en_US'</li>
                <li>EU/UK merchants - 'en_GB', 'de_DE', 'fr_FR', 'it_IT', 'es_ES'</li>
                <li>JP merchants - 'ja_JP'</li>
              </ul>
            </td>
        </tr>
        <tr id='SPI9CAvGRow'>
            <td id='s:SPI9CAvGRow;SPI9CAwqfh9' style='vertical-align: top;'>sandbox<br><br>Type: boolean
                <br /></td>
            <td id='' style='text-align: left;vertical-align: top;'>Sets button to Sandbox environment
            <br><br>You do not have to set this parameter if your <code>publicKeyId</code> has an environment prefix (for example: SANDBOX-AFVX7ULWSGBZ5535PCUQOY7B)
            <br><br>Default value: false
                <br /></td>
        </tr>
    </tbody>
</table>







