Cancel a subscription
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('http://localhost:4000/v1/subscriptions/{id}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url http://localhost:4000/v1/subscriptions/{id}/cancel \
--header 'Authorization: Bearer <token>'{
"id": "sub_7Hq2mV9kLp3RxT",
"object": "subscription",
"status": "incomplete",
"product": "<string>",
"customer": "<string>",
"checkout_session": "<string>",
"manage_url": "https://elapse.finance/account",
"rate_usd_per_second": "<string>",
"started_at": 123,
"paused_at": 123,
"paused_seconds": 123,
"canceled_at": 123,
"ended_reason": "canceled",
"max_duration_seconds": 123,
"max_escrow_usd": "<string>",
"funded_usd": "<string>",
"settled_usd": "<string>",
"seconds_elapsed": 123,
"stream_address": "<string>",
"chain_id": 123,
"currency": "ausd",
"livemode": true,
"created": 123,
"product_name": "<string>",
"customer_email": "<string>",
"pending_tx": "<string>"
}{
"error": {
"type": "api_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "api_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "api_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}Subscriptions
Cancel a subscription
POST
/
v1
/
subscriptions
/
{id}
/
cancel
Cancel a subscription
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('http://localhost:4000/v1/subscriptions/{id}/cancel', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url http://localhost:4000/v1/subscriptions/{id}/cancel \
--header 'Authorization: Bearer <token>'{
"id": "sub_7Hq2mV9kLp3RxT",
"object": "subscription",
"status": "incomplete",
"product": "<string>",
"customer": "<string>",
"checkout_session": "<string>",
"manage_url": "https://elapse.finance/account",
"rate_usd_per_second": "<string>",
"started_at": 123,
"paused_at": 123,
"paused_seconds": 123,
"canceled_at": 123,
"ended_reason": "canceled",
"max_duration_seconds": 123,
"max_escrow_usd": "<string>",
"funded_usd": "<string>",
"settled_usd": "<string>",
"seconds_elapsed": 123,
"stream_address": "<string>",
"chain_id": 123,
"currency": "ausd",
"livemode": true,
"created": 123,
"product_name": "<string>",
"customer_email": "<string>",
"pending_tx": "<string>"
}{
"error": {
"type": "api_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "api_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "api_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}Authorizations
Your secret key: sk_test_… for test mode, sk_live_… for live. Server-side only.
Path Parameters
Response
Cancel submitted on chain. The object is unchanged until subscription.canceled arrives; pending_tx is the relayer's transaction.
Example:
"sub_7Hq2mV9kLp3RxT"
Available options:
subscription Available options:
incomplete, active, paused, canceled Where the subscriber manages all their meters (FR-API-140b). Your app shows this meter with @elapse/react.
Example:
"https://elapse.finance/account"
Available options:
canceled, cap_reached, null Available options:
ausd