Amazon Pay and Login with Amazon integration guide

Sample notifications

The following is a list of notifications that are available from Amazon:

The sample code below shows each notification with its associated custom data fields highlighted.

OrderReferenceNotification IPN sample

POST / HTTP/1.1
x-amz-sns-message-type: Notification
x-amz-sns-message-id: 432f33bf-9f84-5004-815f-7a6cfEXAMPLE
x-amz-sns-topic-arn: arn:aws:sns:EXAMPLE:59860EXAMPLE:TestTopic
x-amz-sns-subscription-arn:
    arn:aws:sns:EXAMPLE:59860EXAMPLE:TestTopic: EXAMPLE
Content-Length: 961 
Content-Type: text/plain; charset=UTF-8
Host: ec2-EXAMPLE.compute-1.amazonaws.com
Connection: Keep-Alive
User-Agent: Amazon Simple Notification Service Agent
{
  "Type":"Notification",
  "MessageId":"cf5543af-dd65-5f74-8ccf-0a410EXAMPLE",
  "TopicArn":"arn:aws:sns:EXAMPLE:59860EXAMPLE:TestTopic",
  "Message":"{"NotificationReferenceId":"32d195c3-a829-4222-b1e2
      -14ab2EXAMPLE",
    "NotificationType":"OrderReferenceNotification",
    "SellerId":"YOUR_SELLER_ID_HERE",
    "ReleaseEnvironment":"Sandbox",
    "Version":"2013-01-01",
    "NotificationData":
    "<?xml version="1.0" encoding="UTF-8"?>
      <OrderReferenceNotification
        xmlns="https://mws.amazonservices.com/
        ipn/OffAmazonPayments/2013-01-01">
        <OrderReference>
        <AmazonOrderReferenceId>
          S23-1234567-1234567
        </AmazonOrderReferenceId>
        <OrderTotal>
        <Amount>106.00</Amount>
        <CurrencyCode>USD</CurrencyCode>
        </OrderTotal>
        <SellerNote>4%20Pack%20of%20BBQ%20Sauce</SellerNote>
        <SellerOrderAttributes>
          <SellerOrderId>5678-23</SellerOrderId>
          <StoreName>HammysBurgers.com</StoreName>
          <CustomInformation>
             Labor%20Day%20Promotion
          </CustomInformation>
        </SellerOrderAttributes>
        <OrderReferenceStatus>
        <State>CLOSED</State>
        <ReasonCode>SellerClosed</ReasonCode>
        <LastUpdateTimestamp>
          2013-04-01T10:49:59.532Z
        </LastUpdateTimestamp>
        </OrderReferenceStatus>
        <CreationTimestamp>
          2013-03-30T09:58:51.234Z
        </CreationTimestamp>
        <ExpirationTimestamp>
          2013-04-06T09:58:51.234Z
        </ExpirationTimestamp>
        </OrderReference>
        </OrderReferenceNotification>",
        "Timestamp":"2013-04-22T06:00:14Z"}",
        "Timestamp":"2013-04-22T06:00:15.108Z",
        "SignatureVersion":"1",
        "Signature":"deako5R0...CVmPQOI=",
        "SigningCertURL":"https://sns.EXAMPLE.amazonaws.com/
        SimpleNotificationService-f3ecfb7224c7233fe7bb5f59fEXAMPLE.pem",
        "UnsubscribeURL":"https://sns.EXAMPLE.amazonaws.com/
        ?Action=Unsubscribe
        &SubscriptionArn=arn:aws:sns:EXAMPLE:59860EXAMPLE:TestTopic:GUID"
 }

AuthorizationNotification IPN sample

Note that the AuthorizationReferenceId is what you send as a parameter in the request. AmazonAuthorizationId is Amazon's ID.


POST / HTTP/1.1
x-amz-sns-message-type: Notification
x-amz-sns-message-id: 6f7e123e-49c9-5c9d-a389-5bed0EXAMPLE
x-amz-sns-topic-arn: arn:aws:sns:EXAMPLE:59860EXAMPLE:TestTopic
x-amz-sns-subscription-arn:
arn:aws:sns:EXAMPLE:59860EXAMPLE:TestTopic: EXAMPLE
Content-Length: 961 
Content-Type: text/plain; charset=UTF-8
Host: ec2-EXAMPLE.compute-1.amazonaws.com
Connection: Keep-Alive
User-Agent: Amazon Simple Notification Service Agent
{
  "Type":"Notification",
  "MessageId":"cf5543af-dd65-5f74-8ccf-0a410EXAMPLE",
  "TopicArn":"arn:aws:sns:EXAMPLE:59860EXAMPLE:TestTopic",
  "Message":
  "{"NotificationReferenceId":"32d195c3-a829-4222-b1e2-14ab28909513",
      "NotificationType":"PaymentAuthorize",
      "SellerId":"YOUR_SELLER_ID_HERE",
      "ReleaseEnvironment":"Sandbox",
      "Version":"2013-01-01",
      "NotificationData":
      "<?xml version="1.0" encoding="UTF-8"?>
        <AuthorizationNotification
          xmlns="https://mws.amazonservices.com/
                    ipn/OffAmazonPayments/2013-01-01">
        <AuthorizationDetails>
        <AmazonAuthorizationId>
          S23-1234567-1234567-0000001
        </AmazonAuthorizationId>
        <AuthorizationReferenceId>
          9bbe88cd5ab4435b85d717fd8EXAMPLE
        </AuthorizationReferenceId>
        <AuthorizationAmount>
        <Amount>5.0</Amount>
        <CurrencyCode>USD</CurrencyCode>
        </AuthorizationAmount>
        <CapturedAmount>
        <Amount>0.0</Amount>
        <CurrencyCode>USD</CurrencyCode>
        </CapturedAmount>
        <AuthorizationFee>
        <Amount>0.0</Amount>
        <CurrencyCode>USD</CurrencyCode>
        </AuthorizationFee>
        <SellerAuthorizationNote>
          Seller%20Auth%20 Note
        </SellerAuthorizationNote>
        <IdList/>
        <CreationTimestamp>
         2013-04-22T05:59:38.186Z
        </CreationTimestamp>
        <ExpirationTimestamp>
          2013-05-22T05:59:38.186Z
        </ExpirationTimestamp>
        <AuthorizationStatus>
        <State>Open</State>
        <LastUpdateTimestamp>
          2013-04-22T06:00:11.473Z
        </LastUpdateTimestamp>
        </AuthorizationStatus>
        <SoftDecline>false</SoftDecline>
        <OrderItemCategories/>
        <CaptureNow>false</CaptureNow>
        <SoftDescriptor>
             AMZ*Time Inc
        </SoftDescriptor>
        </AuthorizationDetails>
        </AuthorizationNotification>",
      "Timestamp":"2013-04-22T06:00:14Z"}",
  "Timestamp":"2013-04-22T06:00:15.108Z",
  "SignatureVersion":"1",  
  "Signature":"W/cfaDzC...5glwqJk=",
  "SigningCertURL":"https://sns.EXAMPLE.amazonaws.com/
    SimpleNotificationService-f3ecfb7224c7233fe7bb5f59fEXAMPLE.pem",
  "UnsubscribeURL":"https://sns.EXAMPLE.amazonaws.com/
    ?Action=Unsubscribe
    &SubscriptionArn=arn:aws:sns:EXAMPLE:59860EXAMPLE:TestTopic:GUID"
}

CaptureNotification IPN sample

The CaptureReferenceId is the same as the AuthorizationReferenceId that you selected, as shown in the sample above.

Also included is the Capture ID, if the capture was successful, where "C" for Capture is a suffix on the OrderID. For example: P01-1234567-7654321-C064528.

The following sample shows the CaptureNotification:


POST / HTTP/1.1
x-amz-sns-message-type: Notification
x-amz-sns-message-id: 64f5f75c-5799-53e5-b4c3-be8f1EXAMPLE
x-amz-sns-topic-arn: arn:aws:sns:EXAMPLE:59860EXAMPLE:TestTopic
x-amz-sns-subscription-arn:
arn:aws:sns:EXAMPLE:59860EXAMPLE:TestTopic: EXAMPLE
Content-Length: 961 
Content-Type: text/plain; charset=UTF-8
Host: ec2-EXAMPLE.compute-1.amazonaws.com
Connection: Keep-Alive
User-Agent: Amazon Simple Notification Service Agent
{
  "Type":"Notification",
  "MessageId":"cf5543af-dd65-5f74-8ccf-0a410EXAMPLE",
  "TopicArn":"arn:aws:sns:EXAMPLE:59860EXAMPLE:TestTopic",
  "Message":
  "{"NotificationReferenceId":"32d195c3-a829-4222-b1e2-14ab2EXAMPLE",
    "NotificationType":"PaymentCapture",
    "SellerId":"YOUR_SELLER_ID_HERE",
    "ReleaseEnvironment":"Sandbox",
    "Version":"2013-01-01",
    "NotificationData":
    "<?xml version="1.0" encoding="UTF-8"?>
    <CaptureNotification
       xmlns="https://mws.amazonservices.com/
       ipn/OffAmazonPayments/2013-01-01">
    <CaptureDetails>
    <AmazonCaptureId>
      P01-1234567-7654321-C12345
    </AmazonCaptureId>
    <SellerCaptureNote>
       Seller%20Capture%20Note
    </SellerCaptureNote>
    <CaptureReferenceId>
      6f4d9dea0c234279a65e77994EXAMPLE
    </CaptureReferenceId>
    <CaptureAmount>
      <Amount>5.0</Amount>
      <CurrencyCode>USD</CurrencyCode>
    </CaptureAmount>
    <RefundedAmount>
      <Amount>0.0</Amount>
      <CurrencyCode>USD</CurrencyCode>
    </RefundedAmount>
    <CaptureFee>
      <Amount>0.0</Amount>
      <CurrencyCode>USD</CurrencyCode>
    </CaptureFee>
    <IdList/>
    <CreationTimestamp>
      2013-04-22T06:02:22.026Z
    </CreationTimestamp>
    <CaptureStatus>
      <State>Completed</State>
      <LastUpdateTimestamp>
        2013-04-22T06:02:25.227Z
      </LastUpdateTimestamp>
    </CaptureStatus>
    <SoftDescriptor>
      AMZ*softdescriptor
    </SoftDescriptor>
    </CaptureDetails>
    </CaptureNotification>",
    "Timestamp":"2013-04-22T06:00:14Z"}",
  "Timestamp":"2013-04-22T06:00:15.108Z",
  "SignatureVersion":"1",
  "Signature":"dUWd9lrs...iNGKnR4=",
  "SigningCertURL":"https://sns.EXAMPLE.amazonaws.com/
  SimpleNotificationService-f3ecfb7224c7233fe7bb5f59fEXAMPLE.pem",   
  "UnsubscribeURL":"https://sns.EXAMPLE.amazonaws.com/
  ?Action=Unsubscribe
  &SubscriptionArn=arn:aws:sns:EXAMPLE:59860EXAMPLE:TestTopic:GUID"
}

RefundNotification IPN sample


POST / HTTP/1.1
x-amz-sns-message-type: Notification
x-amz-sns-message-id: 5f43584c-1f96-5880-9c98-119f5EXAMPLE
x-amz-sns-topic-arn: arn:aws:sns:EXAMPLE:59860EXAMPLE:TestTopic
x-amz-sns-subscription-arn:
arn:aws:sns:EXAMPLE:59860EXAMPLE:TestTopic: EXAMPLE
Content-Length: 961 
Content-Type: text/plain; charset=UTF-8
Host: ec2-EXAMPLE.compute-1.amazonaws.com
Connection: Keep-Alive
User-Agent: Amazon Simple Notification Service Agent
{
  "Type":"Notification",
  "MessageId":"cf5543af-dd65-5f74-8ccf-0a410EXAMPLE",
  "TopicArn":"arn:aws:sns:EXAMPLE:59860EXAMPLE:TestTopic",
  "Message":
  "{"NotificationReferenceId":\
    "32d195c3-a829-4222-b1e2-14ab2EXAMPLE",
    "NotificationType":"PaymentRefund",
    "SellerId":"YOUR_SELLER_ID_HERE",
    "ReleaseEnvironment":"Sandbox",
    "Version":"2013-01-01",
    "NotificationData":
    "<?xml version="1.0" encoding="UTF-8"?>
    <RefundNotification xmlns="https://mws.amazonservices.com/
      ipn/OffAmazonPayments/2013-01-01">
      <RefundDetails>
        <AmazonRefundId>
          S23-1234567-1234567-0000003
        </AmazonRefundId>
        <RefundReferenceId>
          07fff0c4e05046958db7e47607e7db17
        </RefundReferenceId>
        <RefundType>SellerInitiated</RefundType>
        <RefundAmount>
          <Amount>5.0</Amount>
          <CurrencyCode>USD</CurrencyCode>
        </RefundAmount>
        <FeeRefunded>
          <Amount>0.0</Amount>
          <CurrencyCode>USD</CurrencyCode>
        </FeeRefunded>
        <CreationTimestamp>
         2013-04-22T06:07:34.617Z
        </CreationTimestamp>
        <RefundStatus>
          <State>Completed</State>
          <LastUpdateTimestamp>
            2013-04-22T06:09:20.178Z
          </LastUpdateTimestamp>
        </RefundStatus>
        <SellerRefundNote>
          Seller%20Refund%20Note
        </SellerRefundNote>
        <SoftDescriptor>
          AMZ*softDescriptor
        </SoftDescriptor>
      </RefundDetails>
      </RefundNotification>",
    "Timestamp":"2013-04-22T06:00:14Z"}",
  "Timestamp":"2013-04-22T06:00:15.108Z",
  "SignatureVersion":"1",
  "Signature":"kjac14DH...oQT6FbA=",
  "SigningCertURL":"https://sns.EXAMPLE.amazonaws.com/
  SimpleNotificationService-f3ecfb7224c7233fe7bb5f59fEXAMPLE.pem",
  "UnsubscribeURL":"https://sns.EXAMPLE.amazonaws.com/
    ?Action=Unsubscribe
    &SubscriptionArn=arn:aws:sns:EXAMPLE:59860EXAMPLE:TestTopic:GUID"
}

Copyright © 2009-2017 Amazon.com, Inc. or its affiliates. Amazon and Amazon.com are registered trademarks of Amazon.com, Inc. or its affiliates. All other trademarks are the property of their respective owners.