---
title: Setting up delivery notifications
url: amazon-pay-checkout/setting-up-delivery-notifications.html
---

Provide shipment tracking information to Amazon Pay using <a href="../amazon-pay-api-v2/delivery-tracker.md#create-delivery-tracker" target="_blank" rel="noopener noreferrer">Create Delivery Tracker</a> so that Amazon Pay can notify buyers on Alexa when shipments are out for delivery and when they are delivered. This API is channel-agnostic. That means that anywhere you use Amazon Pay, you can use the Delivery Tracker API.

<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" /}

***

### Buyer experience

Here is what your buyer will experience:

Customer: *Alexa, read my notifications.*

**Out for delivery notification**
Alexa: *You have one new notification, from Amazon Pay. A shipment from [yourstorename] is scheduled to arrive by [date].*
<iframe width="560" height="315" spellcheck="false" src="https://www.youtube.com/embed/CDmeVudaz1A" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>

**Delivery notification**
Alexa: *You have one new notification, from Amazon Pay. Your shipment from [yourstorename] has been delivered.*
<iframe width="560" height="315" spellcheck="false" src="https://www.youtube.com/embed/SlVluRNN8aw" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>


### Ecommerce plugins

You can either integrate the Delivery Tracker APIs yourself, or use one of the pre-built solutions for your region below.

<ul role="tablist" class="nav nav-tabs">
    <li class="nav-item"><a class="active nav-link noExtIcon" href="#us_csps" data-toggle="tab">US</a></li>
    <li class="nav-item"><a class="nav-link noExtIcon" href="#eu_csps" data-toggle="tab">EU/UK</a></li>
    <li class="nav-item"><a class="nav-link noExtIcon" href="#jp_csps" data-toggle="tab">JP</a></li>
</ul>
<div class="tab-content">
    <div role="tabpanel" class="tab-pane active" id="us_csps">
<div>&nbsp;</div>
<table width="100%" border="1">
    <tbody>
        <tr id=''>
            <td id='' style='vertical-align: top; font-weight: bold; width: 30%;'>Ecommerce solution
                <br /></td>
            <td id='' style='vertical-align: top; font-weight: bold; width: 40%; text-align: center;'>Resources
                <br /></td>
            <td id='' style='vertical-align: top; font-weight: bold; width: 30%; text-align: center;'>Min. plugin version
                <br /></td>
        </tr>
        <tr>
	        <td>Magento 1</td>
	        <td><a href='https://github.com/amzn/amazon-payments-magento-2-plugin#amazon-pay-and-login-with-amazon-for-magento' target='_blank' rel='noopener noreferrer'>Installation steps and documentation</a></td>
	        <td>3.0.14</td>
        </tr>
        <tr>
	        <td>Magento 2</td>
	        <td><a href='https://github.com/amzn/amazon-pay-magento-2-alexa-plugin#extension-to-enable-amazon-pay-alexa-features-on-magento-2' target='_blank' rel='noopener noreferrer'>Installation steps and documentation</a></td>
	        <td>1.0.0</td>
	    </tr>
     
    </tbody>
</table>
    </div>
    <div role="tabpanel" class="tab-pane" id="eu_csps">
<div>&nbsp;</div>
<table width="100%" border="1">
    <tbody>
        <tr id=''>
            <td id='' style='vertical-align: top; font-weight: bold; width: 30%;'>Ecommerce solution
                <br /></td>
            <td id='' style='vertical-align: top; font-weight: bold; width: 40%; text-align: center;'>Resources
                <br /></td>
            <td id='' style='vertical-align: top; font-weight: bold; width: 30%; text-align: center;'>Min. plugin version
                <br /></td>
        </tr>
        <tr>
	        <td>Magento 1</td>
	        <td><a href='http://amazon.creativestyle.de/en/latest/overview.html' target='_blank' rel='noopener noreferrer'>Installation steps and documentation</a></td>
	        <td>3.0.14</td>
	    </tr>
	    <tr>
	        <td>Magento 2</td>
	        <td><a href='https://github.com/amzn/amazon-pay-magento-2-alexa-plugin#extension-to-enable-amazon-pay-alexa-features-on-magento-2' target='_blank' rel='noopener noreferrer'>Installation steps and documentation</a></td>
	        <td>1.0.0</td>
	    </tr>
        <tr>
	        <td>PrestaShop</td>
	        <td><a href='https://addons.prestashop.com/en/payment-card-wallet/21293-amzpayments.html' target='_blank' rel='noopener noreferrer'>Installation steps and documentation</a></td>
	        <td>2.3.2 (PrestaShop 1.6)<br />
	        3.3.0 (PrestaShop 1.7)</td>
        </tr>
	    <tr>
	        <td>JTL Shop 4</td>
	        <td><a href='https://www.solution360.de/Login-und-Bezahlen-mit-Amazon-JTL-Shop-Plugin' target='_blank' rel='noopener noreferrer'>Installation steps and documentation</a></td>
	        <td>1.0.0</td>
        </tr>
    </tbody>
</table>
    </div>
    <div role="tabpanel" class="tab-pane" id="jp_csps">
<div>&nbsp;</div>
We hope to offer you a solution soon.   
    </div>
</div>

### Integration steps

#### 1. Create a Delivery Tracker

Call Create Delivery Tracker with the Amazon <code>chargePermissionID</code>, shipping company <code>carrierCode</code>, and <code>trackingNumber</code> to enable delivery notifications.

#### Request


<div style="display:none" class="environmentSpecificKeys">
<ul role="tablist" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link" href="#button_widget_php" data-toggle="tab" aria-controls="button_widget_php" role="tab">PHP</a></li>
  <li class="nav-item"><a class="nav-link"  href="#button_widget_java" data-toggle="tab" aria-controls="button_widget_java" role="tab">Java</a></li>
  <li class="nav-item"><a class="nav-link"  href="#button_widget_net" data-toggle="tab" aria-controls="button_widget_net" role="tab">.NET</a></li>
  <li class="nav-item"><a class="nav-link"  href="#button_widget_nodejs" data-toggle="tab" aria-controls="button_widget_nodejs" role="tab">NodeJS</a></li>
  <li class="nav-item"><a class="nav-link"  href="#button_widget_other" data-toggle="tab" aria-controls="button_widget_other" role="tab">Other</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="button_widget_php">
    <pre><code
>&lt;?php
include 'vendor/autoload.php';

$amazonpay_config = array(
    'public_key_id' => 'YOUR_PUBLIC_KEY_ID',
    'private_key'   => 'keys/private.pem',
    'region'        => 'YOUR_REGION_CODE',
    'algorithm' => 'AMZN-PAY-RSASSA-PSS-V2'
);
$payload = array(
    'amazonOrderReferenceId' => 'P00-0000000-0000000',
    'deliveryDetails' => array(array(
        'trackingNumber' => '1Z999AA10123456784',
        'carrierCode' => 'UPS'
    ))
);
try {
  $client = new Amazon\Pay\API\Client($amazonpay_config);
  $result = $client->deliveryTrackers($payload);
  if ($result['status'] === 200) {
      // success
      echo $result['response'] . "\n";
  } else {
    // check the error
    echo 'status=' . $result['status'] . '; response=' . $result['response'] . "\n";
  }
} catch (\Exception $e) {
  // handle the exception
  echo $e . "\n";
}
?>
</code></pre>
  </div>
  <div role="tabpanel" class="tab-pane" id="button_widget_java">
<pre><code>
AmazonPayResponse response = null;

JSONObject payload = new JSONObject();
JSONObject deliveryDetails = new JSONObject();
JSONArray deliveryDetailsArray = new JSONArray();
deliveryDetails.put("trackingNumber", "1Z999AA10123456784");
deliveryDetails.put("carrierCode", "UPS");
deliveryDetailsArray.add(deliveryDetails);
payload.put("amazonOrderReferenceId", "P00-0000000-0000000");
payload.put("deliveryDetails", deliveryDetailsArray);

try {
    response = client.deliveryTracker(payload);
} catch (AmazonPayClientException e) {
    e.printStackTrace();
}
</code></pre>
  </div>
  <div role="tabpanel" class="tab-pane" id="button_widget_net">
 <pre><code
>// prepare the request
var request = new DeliveryTrackerRequest
(
    objectId: "P00-0000000-0000000", // ChargePermissionID or OrderReferenceID
    objectIsChargePermission: true,  // true if above is ChargePermissionID, false otherwise 
    trackingNumber: "1Z999AA10123456784", 
    carrierCode: "UPS"
);
// generate the button signature
var result = client.SendDeliveryTrackingInformation(request);
// check if API call was successful
if (!result.Success)
{
    // do something, e.g. throw an error
}

return result;
  
  </code></pre>
  </div>
  <div role="tabpanel" class="tab-pane" id="button_widget_nodejs">
 <pre><code
>const fs = require('fs');
const Client = require('../src/client');

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

const payload = {
    amazonOrderReferenceId: 'P00-0000000-0000000',
    deliveryDetails: [{
        trackingNumber: '1Z999AA10123456789',
        carrierCode: 'UPS'
    }]
};

const testPayClient = new Client.AmazonPayClient(config);
const response = testPayClient.deliveryTrackers(payload);
</code></pre>
  </div>
   <div role="tabpanel" class="tab-pane" id="button_widget_other">

<pre><code>
POST /:version/deliveryTrackers HTTP/1.1
Host: pay-api.amazon.com
Accept: application/json
Authorization: AMZN-PAY-RSASSA-PSS-V2 PublicKeyId=f4fc06fc-c5a7-11e7-abc4-cec278b6b50a, SignedHeaders=content-type;x-amz-pay-date;x-amz-pay-region, Signature=4164128ec5d1b9da1700167ab2ccda8125f472c8bb9de447cebf5d741ee317c8       
X-Amz-Pay-Date: 20190305T024410Z
Content-type: application/json

{
    "amazonOrderReferenceId" : "P00-0000000-0000000",
    "deliveryDetails" : [{
    "trackingNumber" : "1Z999AA10123456784",
    "carrierCode" : "UPS"
  }]
}
</code></pre>
  </div>
</div>

</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
<ul role="tablist" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link" href="#button_widget_php_nesk" data-toggle="tab" aria-controls="button_widget_php" role="tab">PHP</a></li>
  <li class="nav-item"><a class="nav-link"  href="#button_widget_java_nesk" data-toggle="tab" aria-controls="button_widget_java" role="tab">Java</a></li>
  <li class="nav-item"><a class="nav-link"  href="#button_widget_net_nesk" data-toggle="tab" aria-controls="button_widget_net" role="tab">.NET</a></li>
  <li class="nav-item"><a class="nav-link"  href="#button_widget_nodejs_nesk" data-toggle="tab" aria-controls="button_widget_nodejs" role="tab">NodeJS</a></li>
  <li class="nav-item"><a class="nav-link"  href="#button_widget_other_nesk" data-toggle="tab" aria-controls="button_widget_other" role="tab">Other</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="button_widget_php_nesk">
    <pre><code
>&lt;?php
include 'vendor/autoload.php';

$amazonpay_config = array(
  'public_key_id' => 'MY_PUBLIC_KEY_ID',
  'private_key'   => 'keys/private.pem',
  'region'        => 'US',
  'sandbox'       => false,
  'algorithm' => 'AMZN-PAY-RSASSA-PSS-V2'
);
$payload = array(
  'amazonOrderReferenceId' => 'P00-0000000-0000000',
  'deliveryDetails' => array(array(
      'trackingNumber' => '1Z999AA10123456784',
      'carrierCode' => 'UPS'
  ))
);
try {
  $client = new Amazon\Pay\API\Client($amazonpay_config);
  $result = $client->deliveryTrackers($payload);
  if ($result['status'] === 200) {
      // success
      echo $result['response'] . "\n";
  } else {
    // check the error
    echo 'status=' . $result['status'] . '; response=' . $result['response'] . "\n";
  }
} catch (\Exception $e) {
  // handle the exception
  echo $e . "\n";
}
?>
</code></pre>
  </div>
  <div role="tabpanel" class="tab-pane" id="button_widget_java_nesk">
<pre><code>
AmazonPayResponse response = null;

JSONObject payload = new JSONObject();
JSONObject deliveryDetails = new JSONObject();
JSONArray deliveryDetailsArray = new JSONArray();
deliveryDetails.put("trackingNumber", "1Z999AA10123456784");
deliveryDetails.put("carrierCode", "UPS");
deliveryDetailsArray.add(deliveryDetails);
payload.put("amazonOrderReferenceId", "P00-0000000-0000000");
payload.put("deliveryDetails", deliveryDetailsArray);

try {
    response = client.deliveryTracker(payload);
} catch (AmazonPayClientException e) {
    e.printStackTrace();
}
</code></pre>
  </div>
  <div role="tabpanel" class="tab-pane" id="button_widget_net_nesk">
 <pre><code
>// prepare the request
var request = new DeliveryTrackerRequest
(
    objectId: "P00-0000000-0000000", // ChargePermissionID or OrderReferenceID
    objectIsChargePermission: true,  // true if above is ChargePermissionID, false otherwise 
    trackingNumber: "1Z999AA10123456784", 
    carrierCode: "UPS"
);
// generate the button signature
var result = client.SendDeliveryTrackingInformation(request);
// check if API call was successful
if (!result.Success)
{
    // do something, e.g. throw an error
}

return result;
  
  </code></pre>
  </div>
  <div role="tabpanel" class="tab-pane" id="button_widget_nodejs_nesk">
 <pre><code
>const fs = require('fs');
const Client = require('../src/client');

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

const payload = {
    amazonOrderReferenceId: 'P00-0000000-0000000',
    deliveryDetails: [{
        trackingNumber: '1Z999AA10123456789',
        carrierCode: 'UPS'
    }]
};

const testPayClient = new Client.AmazonPayClient(config);
const response = testPayClient.deliveryTrackers(payload);
</code></pre>
  </div>
   <div role="tabpanel" class="tab-pane" id="button_widget_other_nesk">

<pre><code>
POST /live/v2/deliveryTrackers HTTP/1.1
Host: pay-api.amazon.com
Accept: application/json
Authorization: AMZN-PAY-RSASSA-PSS-V2 PublicKeyId=f4fc06fc-c5a7-11e7-abc4-cec278b6b50a, SignedHeaders=content-type;x-amz-pay-date;x-amz-pay-region, Signature=4164128ec5d1b9da1700167ab2ccda8125f472c8bb9de447cebf5d741ee317c8       
X-Amz-Pay-Date: 20190305T024410Z
Content-type: application/json

{
    "amazonOrderReferenceId" : "P00-0000000-0000000",
    "deliveryDetails" : [{
    "trackingNumber" : "1Z999AA10123456784",
    "carrierCode" : "UPS"
  }]
}
</code></pre>
  </div>
</div>

</div>

#### Request parameters

<table width="100%" border="1">
    <tbody>
        <tr id=''>
            <td id='s:ERL9CAO0JHD;ERL9CA2r6qD' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Name
                <br /></td>
            <td id='s:ERL9CAO0JHD;ERL9CAZAZrc' style='vertical-align: top; font-weight: bold; width: 20%;' class='bold'>Location
                <br /></td>
            <td id='s:ERL9CAO0JHD;ERL9CAoRgfP' style='vertical-align: top; font-weight: bold; width: 50%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id=''>
            <td id='s:ERL9CAMViVA;ERL9CA2r6qD' style='vertical-align: top;'>amazonOrderReferenceId<br> <i>- or -</i> <br>chargePermissionId<br><b>(required)</b><br><br>Type: string
                <br /></td>
            <td id='s:ERL9CAMViVA;ERL9CAZAZrc' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:ERL9CAMViVA;ERL9CAoRgfP' style='vertical-align: top;'>The Amazon Order Reference ID or Charge Permission ID associated with the order for which the shipments need to be tracked
                <br /></td>
        </tr>
        <tr id=''>
            <td id='s:ERL9CAvm2Or;ERL9CAFccoh' style='vertical-align: top;'>carrierCode<br><b>(required)</b><br><br>Type: string
                <br /></td>
            <td id='s:ERL9CAvm2Or;ERL9CAjQdu4' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:ERL9CAvm2Or;ERL9CAxmCJ7' style='vertical-align: top;'>The shipping company code used for delivering goods to the customer. <a href="https://d2bvfbw64wr20e.cloudfront.net/Alexa/Delivery+Notifications/amazon-pay-delivery-tracker-supported-carriers-v2.csv" target="_blank" rel="noopener noreferrer">Download carrierCode list</a>
                <br /></td>
        </tr>
        <tr id=''>
            <td id='s:ERL9CAVOprL;ERL9CA2r6qD' style='vertical-align: top;'>trackingNumber<br><b>(required)</b><br><br>Type: string
                <br /></td>
            <td id='s:ERL9CAVOprL;ERL9CAZAZrc' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:ERL9CAVOprL;ERL9CAoRgfP' style='vertical-align: top;'>The tracking number for the shipment provided by the shipping company
                <br /></td>
        </tr>       
    </tbody>
</table>

#### Response

```
{
    "amazonOrderReferenceId": "P00-0000000-0000000",
    "deliveryDetails": [{
        "trackingNumber": "1Z999AA10123456784",
        "carrierCode": "UPS"
    }]
}
```

#### 2. Test your integration

You will need an Alexa-enabled device for end-to-end testing.

**Sandbox testing**

You can ensure a fully functional integration by executing an end-to-end test in Sandbox but no Delivery Notification will be sent. To test in Sandbox: 

1. Create a test order and save the <code>chargePermissionID</code> or <code>orderReferenceID</code> 
2. Call <a href="../amazon-pay-api-v2/delivery-tracker.md#create-delivery-tracker" target="_blank" rel="noopener noreferrer">Create Delivery Tracker</a> using the <code>ChargePermissionID</code> or <code>OrderReferenceID</code>, a random tracking code, and a carrier code of one of the <a href="https://d2bvfbw64wr20e.cloudfront.net/Alexa/Delivery+Notifications/amazon-pay-delivery-tracker-supported-carriers-v2.csv" target="_blank" rel="noopener noreferrer">supported carriers</a>.
3. Verify that the API calls returns a <a href="https://restfulapi.net/http-status-200-ok" target="_blank" rel="noopener noreferrer">HTTP 200 (OK) status</a>.



**Live testing (optional)**

A successful sandbox test is sufficient for ensuring the integration will work as expected but Live testing is the only way to trigger the full experience including a notification on your Alexa-enabled device. Prerequisites:

* Your Alexa-enabled device must be connected to the Amazon account you’re using for the Live order
* You must enable delivery and out for delivery notification under Settings → Notifications → Amazon Shopping in the Alexa app. Note that for customer outside of the US, the account must have at least one order fulfilled by Amazon to be enrolled for notifications, otherwise you will not see the settings.

Call <a href="../amazon-pay-api-v2/delivery-tracker.md#create-delivery-tracker" target="_blank" rel="noopener noreferrer">Create Delivery Tracker</a> once the order has been shipped and a real tracking code has been generated. You should receive a notification on your Alexa-enabled device when the order is shipped and when the order is delivered. Note that tracking codes can only be used once.







