Skip to main content

Cancel subscription

Endpoint for canceling a Subscription.

info

Please be aware that this endpoint requires a Manage Transactions API Key.

PUT /api/v1/groups/{group_id}/revere_pay/{linked_account_id}/recurring/{subscription_id}/cancel

Request Parameters

NameDescriptionTypeRequired
reasonOptional explanation for the subscription cancellation.string

Response

CodeDescription
200Success
400Bad Request / Validation error
500Internal Error

Example Usage

plans.js
var headers = new Headers();
headers.append('Authorization', 'API_KEY');

var requestOptions = {
method: 'PUT',
headers: headers,
redirect: 'follow',
body: {
// request body data
}
};
const group_id = '';
const linked_account_id = '';
const subscription_id = '';
const url = `https://api.reverepayments.dev/api/v1/groups/${group_id}/revere_pay/${linked_account_id}/recurring/subscription/${subscription_id}/cancel`;
fetch(url, requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log('error', error));

Example Request

{
"reason": "Duplicate Order"
}

Example Success Response

{
"id": "eef1b240-6e4d-42f7-93ea-873d165aa696",
"plan_id": "6f8df983-62a1-4d36-85fd-2e37114fa694",
"duration": 0,
"amounts": {
"amount": 30000,
"tax_amount": 1000,
"shipping_amount": 1000
},
"billing_cycle": "daily",
"billing_factor": 7,
"next_bill_date": "2024-04-18T00:00:00Z",
"description": "Endless subscription",
"currency": "USD",
"processor_id": "<processor_id>",
"retry_count": 3,
"metadata": {
"max_retry_count": 3,
"form_layout_id": null,
"form_layout_external_id": null,
"form_entry_id": null,
"charge_count": 1,
"cancel_reason": "Duplicate Order"
},
"trial_period_days": 0,
"payment_method": "card",
"payment_details": {
"card": {
"brand": "Visa",
"first_six": "411111",
"last_four": "1111"
}
},
"billing_address": {
"address": {
"first_name": "John",
"last_name": "Doe",
"city": "New York",
"line_1": "1st Ave.",
"line_2": "1217",
"subdivision": "NY",
"postal_code": "10065",
"country": "US",
"email": "johndoe@example.com"
}
},
"status": "canceled",
"gateway_customer_id": "<customer_id>"
}