Cancel a subscription and write off all unpaid invoices using the REST API
This topic explains how to cancel a subscription and write off all unpaid invoices using the REST API by utilizing the Create an order operation.
You can only cancel a subscription and write off all unpaid invoices through the Create an order operation, and you cannot perform the task through the Create an order asynchronously operation.
In the request body of the Create an order
operation, specify the following nested fields under
processingOptions
to define write-off related information.
|
Field Name |
Data Type |
Required/Optional |
Description |
|---|---|---|---|
|
writeOff |
Boolean |
Required |
Indicates whether to write off all outstanding balance on the invoice.
To write off all unpaid invoices, set this value to
When this field is set to
|
|
writeOffBehavior |
Object |
Optional |
The financial information of the credit memo items that are generated to write off the invoice balance. Note:
See
|
|
runBilling |
Boolean |
Required |
Indicates if the current request needs to generate an invoice. The invoice will be generated against all subscriptions included in this order.
To avoid generating the final invoice, set it to
|
|
documentDate |
string <date> |
Required |
The Invoice Date displayed on the invoice in UI. |
|
targetDate |
string <date> |
Required |
Date through which to calculate charges if an invoice is generated. See What is a Target Date? . The Target Date displayed on the invoice in UI. |
|
collectPayment |
Boolean |
Required |
Indicates if the current request needs to collect payments.
To write off all unpaid invoices, set this value to
|
You can view the status of each write-off transaction in the
writeOff
fields in the response body.
Below is a request example.
|
Request |
|
|
Request Body |
|
To use the above request body directly, replace the values, including the pre-defined variables, with your own data.
Below is the response returned:
|
Response Body |
|
The
writeOff
fields display write-off results.