Subscription cancelation with a refund using the REST API
Learn how to cancel a subscription with a refund using the REST API by specifying refund and write-off options in the request body.
Note that you can only cancel a subscription with a refund through the Create an order operation, you cannot perform the task through the Create an order asynchronously operation.
In the request body of the Create an order operation, you need to specify the following nested fields under processingOptions to define refund and write-off related information.
|
Field Name |
Data Type |
Required/Optional |
Description |
|---|---|---|---|
|
refund |
Boolean |
Optional; Default is |
Indicates whether to refund after the subscription cancellation. |
|
refundAmount |
Number |
Optional; Default is |
Indicates the amount to be refunded. |
|
refundReasonCode |
String |
Optional: Default is |
A code identifying the reason for the refund transaction. The value must be an existing payment refund reason code listed in Payments Settings > Configure Reason Codes . If you do not specify the field or leave the field with an empty value, Zuora uses the default payment refund reason code. |
|
writeOff |
Boolean |
Optional; Default is |
Indicates whether to write off the outstanding balance on the invoice after refunding. When this field is set to |
|
writeOffBehavior |
Object |
Optional; Default is |
The financial information of the credit memo items that are generated to write off the invoice balance. Note:
See |
You can view the status of each refund and write-off transaction in the refund and writeOff fields in the response body.
Below is a request example.
|
Request |
|
|
Request Body |
|
Note that to use the above request body directly, you need to replace the values, including the pre-defined variables, with your own data.
Below is the response returned:
|
Response Body |
|
The refunds and writeOff fields display refund and write-off results.