Amazon Flexible Payments Service
API Reference (API Version 2010-08-28)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Did this page help you?  Yes | No |  Tell us about it...

Cancel

Description

The Cancel action cancels a reserved or pending transaction. Once the transaction is canceled, you can't then settle it. You also can't use Cancel on a completed transaction. After a transaction is completed, you can do a refund if you want to reverse the order.

If the sender's credit card was in a reserved state, it is not part of this action to make sure the reserved status is removed. card.

This action appears in the Basic, Advanced, and Marketplace Quick Starts, as well as in the Amazon Simple Pay Advanced Guide.

Request Parameters

ParameterDescription

Required

Description

Describes the reason for cancellation.

Type: String

Default: None

No

OverrideIPNURL

Specifies the URL to receive the Instant Payment Notification (IPN) for the request. The IPN URL set with this parameter takes precedence over the IPN URL set in your account.

Type: String

Default: None

No

TransactionId

Specifies the transaction that needs to be canceled. This ID should have been returned by Amazon in a prior Pay or Reserve call.

Type: String

Default: None

Constraint: Max size = 35 characters

Yes

For REST requests, you must also include parameters that are common to all requests. These parameters are included by default in SOAP requests. For more information, see Common Request Parameters.

Response Elements

ElementDescription

TransactionId

The ID of the completed transaction. It is the same as the TransactionID provided in the request.

Type: String

Size: 35 Bytes

TransactionStatus

The status of the cancellation request.

Type: TransactionStatus

Size: 20 Bytes

Responses also include elements common to all responses. For more information, see Common Response Elements.

Examples

Sample REST Request

https://fps.sandbox.amazonaws.com?
Action=Cancel
&AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE
&Description=MyWish
&Signature=yOedrTuiMoMrKt8SwugDDnfd0nydyoX9uPq1H1SUCl4%3D
&SignatureMethod=HmacSHA256
&SignatureVersion=2
&Timestamp=2009-10-06T09%3A14%3A58.796Z
&TransactionId=14GKI1SKSR1V6DO1RCCB32RBR6KLODMGQUD
&Version=2008-09-17

Sample SOAP Request

<SOAP-ENV:Body 
    wsu:id="body" xmlns:wsu=
    "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <ns2:Cancel xmlns:ns2="http://fps.amazonaws.com/doc/2008-09-17/">
        <ns2:TokenId>
            B1HA64FUMCEB43QAJBTP3TVMJZGFLAX2DJJ3ZPAFHH1VNPGR74I83ZZI4HJ5NGEK
        </ns2:TokenId>
        <ns2:ReasonText>Buyer closed the transaction.</ns2:ReasonText>
    </ns2:Cancel>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Sample Response to REST Request

<CancelResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
  <CancelResult>
    <TransactionId>14GKI1SKSR1V6DO1RCCB32RBR6KLODMGQUD</TransactionId>
    <TransactionStatus>Cancelled</TransactionStatus>
  </CancelResult>
  <ResponseMetadata>
    <RequestId>6fe4b755-a328-419d-8967-e1d3b43779fc:0</RequestId>
  </ResponseMetadata>
</CancelResponse>

Sample Response to SOAP Request

<CancelResponse
  xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
  <CancelResult>
    <TransactionId>
      13N91G4R7478CJLIGROQH2VQJSM
    </TransactionId>
    <TransactionStatus>
      Success
    </TransactionStatus>
  </CancelResult>
</CancelResponse>

Sample IPN Success Notification to Rest Request

--------------------------
transactionId: 14GKI1SKSR1V6DO1RCCB32RBR6KLODMGQUD
statusMessage: The transaction was explicitly cancelled by the caller.
transactionDate: 1254820475
signatureVersion: 2
signatureMethod: RSA-SHA1
buyerEmail: new_premium@amazon.com
notificationType: TransactionStatus
callerReference: CallerReference08
transactionAmount: USD 1.00
transactionStatus: CANCELLED
operation: RESERVE
recipientEmail: test-caller@amazon.com
buyerName: Test Business
signature: jWDbBxtEhw2rQEyMeEXcpWCgoZvm8rjLEnmg38oYoPPR7NbMGgmMA9/5CDjt9Q/FMktKMbARXnZF
YTzHj3YOKiAM3vxI0zT1oTiSdBx1KBRFzK7mauxxlQv5BYxjFX+R5cl+keCaT2nQyrp3agdrIIp5
MZ5Oy9dBuYMwMFWXoZZor90EidD23hBdZSOOzQRUdzKaKJsF14RQVrKcf5pDCs1HaB6LBKbATaNT
RSxxrviIXy9JcWRQhJwzcc1H6cFOJDpNFSJ03b0Z94eL/XNu9BU7bT4KRWb+OHF0Pn53yf4zyBT9
jTD+94WeujCxwE2rF0j5+brmXp/+Sn/RccDG7w==
recipientName: Test Business
paymentMethod: CC
certificateUrl: https://fps.sandbox.amazonaws.com/certs/090909/PKICert.pem
paymentReason: Reserve
statusCode: Cancelled
--------------------------