Cancel the subscription
const url = 'https://api.pitch2sale.com/api/v1/billing/subscription/cancel';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"at_period_end":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.pitch2sale.com/api/v1/billing/subscription/cancel \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "at_period_end": true }'Cancels at Cashfree immediately, so no further charge is taken. Access continues until the end of the paid period. A subscription that was never charged (payment setup only) ends at once and leaves the plan, status and trial exactly as they were. A subscription Cashfree had already ended (canceled, expired, completed) counts as canceled. No refunds. Idempotent: a repeat returns the canceled subscription (also for a never-charged setup that already ended). A subscription Cashfree no longer knows (404) counts as ended. 10 billing changes per hour per organization. 409 gateway_cancel_refused (nothing changed) when Cashfree refuses to cancel a subscription it still reports as live — the message names its status; 502 gateway_error (nothing changed) only when Cashfree is unavailable. Owners and admins only.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Responses
Section titled “Responses”OK
Validation failed
object
object
Examplegenerated
{ "error": "example", "code": "example", "message": "example", "details": [ { "field": "example", "message": "example", "code": "example" } ]}Authentication required or token invalid
object
object
Examplegenerated
{ "error": "example", "code": "example", "message": "example", "details": [ { "field": "example", "message": "example", "code": "example" } ]}Role permission or token scope missing; OAuth app tokens are not accepted on this route
object
object
Examplegenerated
{ "error": "example", "code": "example", "message": "example", "details": [ { "field": "example", "message": "example", "code": "example" } ]}Rate limit exceeded
object
object
Examplegenerated
{ "error": "example", "code": "example", "message": "example", "details": [ { "field": "example", "message": "example", "code": "example" } ]}