The CancelSubscriptionAndRefund action cancels a subscription
and, if a refundAmount is specified, refunds the specified
amount from the last subscription payment charged to the subscriber.
![]() | Note |
|---|---|
This action is an Amazon Flexible Payment Service (Amazon FPS) action. In order to execute this action, you must have an AWS Developer account. For information about how to get an account, see "Before you Begin" in the Amazon Simple Pay Getting Started Guide. |
For canceling a subscription with no refund, use the SubscriptionId parameter by itself (and optionally, the CancelReason parameter). If a subscription is already canceled or
completed, you will receive the InvalidSubscriptionState error
with an appropriate error message.
For canceling a subscription with a refund, use the SubscriptionId, CallerReference, and
RefundedAmount parameters (and optionally, the CancelReason parameter). If the subscription is already canceled or
completed, the cancellation request is ignored and the refund is executed.
| Parameter | Description | Required |
|---|---|---|
|
|
A value you provide that uniquely identifies the request. This identifier is maintained for seven days by Amazon FPS. Type: String Contraints: 128 bytes maximum Default: None |
Only if you specify a value for Refund Amount. |
CancelReason |
String that explains the reason for the cancellation. Type: String Default: None |
No |
RefundAmount |
If you want a part of the last subscription payment to be refunded to the subscriber, you can specify the amount in this parameter. If a value for RefundAmount is not specified, the Action is treated as a cancellation for SubscriptionId. Type: Amount Default: None |
Only if you want to make a refund. |
SubscriptionId |
SubscriptionId of the subscription to be canceled. Type: String Default: None | Yes |
You must also use parameters that are common to all requests that are described in Common Request Parameters. Parameter names are case sensitive.
| Element | Description |
|---|---|
|
|
If you set a refund amount in the request, the transaction ID of the refund transaction is returned here. This element is returned only if the refund transaction could be initiated. Type: String |
Responses also include elements common to all responses. For more information, see Common Response Elements.
If the cancellation of the subscription passes but the refund fails, the system returns an error code showing why the refund transaction failed. The error message contains more details about why the refund transaction failed.
The following is a list of possible errors for this action:
![]() | Note |
|---|---|
In order to provide a secure request, you must generate a signature whenever you make a call using this action. For more information, see Keeping Payments Secure |
https://fps.sandbox.amazonaws.com? Action=CancelSubscriptionAndRefund &AWSAccessKeyId=AKIAIIFXJCFIHITREP4Q &CallerReference=CallerReference07 &CancelReason=MyWish &RefundAmount.CurrencyCode=USD &RefundAmount.Value=1 &SignatureMethod=HmacSHA256 &SignatureVersion=2 &Signature=1uFUSSFvau1zadnSzKRS5ZchuLMn9p5M3ifaHGHie7M%3D &SubscriptionId=17d62772-c53e-4bdb-9667-65d7b7841cfc &Timestamp=2009-10-06T08%3A05%3A13.296Z &Version=2008-09-17
<CancelSubscriptionAndRefundResponse xmlns="http://fps.amazonaws.com/doc/2008-09-17/">
<CancelSubscriptionAndRefundResult>
<RefundTransactionId>14GKE3B85HCMF1BTSH5C4PD2IHZL95RJ2LM</RefundTransactionId>
</CancelSubscriptionAndRefundResult>
<ResponseMetadata>
<RequestId>bfbc0b1e-3430-4a74-a75e-5292f59107ca:0</RequestId>
</ResponseMetadata>
</CancelSubscriptionAndRefundResponse>This section shows a sample IPN notification to a REST request.
-------------------------- signatureVersion: 2 signatureMethod: RSA-SHA1 status: SubscriptionCancelled signature: sNaPeP1aNg5pjehHYJ97BAPWoZVPxFpXGOmDmprYkPq8KN1cuZotBW2j+goUqA5tue/2FDlNk5+Z KMBtshSLiqtG1R6AH9qaNjZQwg4dm4t0OqP2eOjoH73wQwIaCCEr690o2lxjN+vx7KO+w4wmnyqF xL9/j5wBjC2zpoy3NrN8uM0R547rYjjOaTODYb0cesYfvXXPGvFBniDloPGpxx7G2ryIVZpFaeJ9 2XF2k6ho8M8rkdTp3MHPLiyZHjFl6+cKen2XynOqHD5RkG/aIgG9waus3E3esn9Zweo8m4vdiL67 MyS4zQzyRg973bi45+Knv6AuuhhcTta41zSR8g== subscriptionId: 17d62772-c53e-4bdb-9667-65d7b7841cfc certificateUrl: https://fps.sandbox.amazonaws.com/certs/090909/PKICert.pem statusReason: CancelledByRecipient --------------------------