Skip to Content

Cancel a subscription

POST/subscriptions/{subscriptionId}/cancel

Cancel 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

HeaderDescriptionRequired
AuthorizationBearer token with your secret API keyyes

Path Parameters

NameTypeRequiredDescription
subscriptionIdstringyes

Request Body

FieldTypeRequiredDescription
deadlineintegeryes

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

StatusDescription
200The 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`.
400Validation error
401Missing or invalid authentication
403API key lacks the required scope
404Resource not found

Response body

FieldTypeRequiredDescription
subscription_idstringyes
statusenum: cancelling | cancelledyes
tx_hashstring | nullyes

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"
  }
}

Start building

XO

Request Demo

Schedule a call with our team

Select a product
Arrow right

Start building
Grateful

Contact Us

We're here to help