サンプル通知

次はAmazonから利用可能な通知としてのリストです。

次のサンプルコードは、それぞれの通知とそれに関連するカスタムデータフィールドを例示しております。

OrderReference IPN通知サンプル

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

Authorization IPN通知サンプル

AuthorizationReferenceIdはリクエストで送信されたパラメータであり、Amazonが発行した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"  
}

Capture IPN通知サンプル

サンプルコードに例示されているCaptureReferenceIdは前述のサンプルで選択されたAuthorizationReferenceIdと同じです。

また、売上請求に成功した場合は、Cで始まる注文IDとしてCaptureのIDは含まれます。例えば、P01-89574386-4998340-C064528の通りです。

次はCapture通知のサンプルです。

 
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-8574386-4998340-C064528  
    </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"  
}

ChargebackIPN通知サンプル


POST / HTTP/1.1
x-amz-sns-message-type: Notification
x-amz-sns-message-id: 0000000-0000-00000-0000-00000EXAMPLE
x-amz-sns-topic-arn: arn:aws:sns:EXAMPLE:11111EXAMPLE:TestTopic
x-amz-sns-subscription-arn: arn:aws:sns:EXAMPLE:11111EXAMPLE:TestTopic: EXAMPLE
Content-Length: 999
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" : "xxxxxx-xxxx-xxxx-xxxx-xxxxxEXAMPLE",
"TopicArn" : "arn:aws:sns:EXAMPLE:11111EXAMPLE:TestTopic",
"Message" :
"{"ReleaseEnvironment":"Live",
"MarketplaceID":"165570",
"Version":"2013-01-01",
"NotificationType":"ChargebackDetailedNotification",
"SellerId":"YOUR_SELLER_ID_HERE",
"NotificationReferenceId":"75d52458-a3a9-4ecc-8663-f1a66b3831d2",
"Timestamp":"2017-09-07T16:49:16.489Z",
"NotificationData":"<?xml version="1.0" encoding="UTF-8"?>
<ChargebackNotification xmlns="https://mws.amazonservices.com/ipn/OffAmazonPayments/2013-01-01\">\n    
<ChargebackDetails>
<AmazonChargebackId>C31EKEWMLB6AK9Example</AmazonChargebackId> <AmazonOrderReferenceId>P01-0665952-9296413</AmazonOrderReferenceId>
<AmazonCaptureReferenceId>AuthReference8671591Example</AmazonCaptureReferenceId>
<CreationTimestamp>2017-05-31T20:42:34.894Z</CreationTimestamp>
<ChargebackAmount>
<Amount>2.0</Amount>
<CurrencyCode>USD</CurrencyCode>
</ChargebackAmount>
<ChargebackState>RECEIVED</ChargebackState>
<ChargebackReason>Generic Service Chargeback</ChargebackReason>
</ChargebackDetails>
</ChargebackNotification>"}",
Timestamp" : "2013-01-01T01:01:001Z",
"SignatureVersion" : "1",
"Signature" : "rkne..9=kOUhF",
"SigningCertURL" : "https://sns.EXAMPLE.amazonaws.com/SimpleNotificationService-aaaaaabbbbbbccccccEXAMPLE.pem",
"UnsubscribeURL" : "https://sns.EXAMPLE.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:EXAMPLE:11111EXAMPLE:TestTopic:GUID"
}
    

Refund IPN通知サンプル

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