Cancel a subscription
POST/subscriptions/{subscriptionId}/cancelCancel an active subscription as the merchant via a signed request. Exodus submits the on-chain cancelWithSig transaction and pays the gas. The subscription transitions to cancelling immediately, then to cancelled once the on-chain event is indexed.
Headers
| Header | Description | Required |
|---|---|---|
| Authorization | Bearer token with your secret API key | yes |
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| subscriptionId | string | yes |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| deadline | integer | yes |
Example Request
Request
const response = await fetch('https://checkout-api.exodus-int.com/subscriptions/<subscriptionId>/cancel', {
method: 'POST',
headers: {
Authorization: 'Bearer sk_live_xxxxxxxxxxxxxxxx',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"deadline": 1798761600
}),
});Responses
| Status | Description |
|---|---|
| 200 | The cancel result. `status` is `cancelling` until the on-chain event is indexed; cancelling a subscription that is already cancelling or cancelled is a no-op 200 with `tx_hash: null`. |
| 400 | Validation error |
| 401 | Missing or invalid authentication |
| 403 | API key lacks the required scope |
| 404 | Resource not found |
Response body
| Field | Type | Required | Description |
|---|---|---|---|
| subscription_id | string | yes | |
| status | enum: cancelling | cancelled | yes | |
| tx_hash | string | null | yes |
Example Response
{
"subscription_id": "0x9f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a",
"status": "cancelling",
"tx_hash": "0x7e81c228fc4fcf0372a86ce6f8bbc457210a8b51fc30dee5557280e5153c9f06"
}Error Response
Error (e.g. 400)
{
"error": {
"type": "validation_error",
"message": "amount must be a positive number",
"param": "amount"
}
}