post__subscriptions_cancel

POST /subscriptions/cancel

Cancel Subscription

Cancel the active subscription for the authenticated user's organization. This will immediately cancel the subscription in Stripe and create a cancellation record.

Parameters

This endpoint does not accept query parameters or request body. Authentication is required.

TypeScript Client Library

public cancelSubscription = async (): Promise<CancelSubscriptionResponse> => {
  return this.makeRequest<CancelSubscriptionResponse>('subscriptions/cancel', 'POST', null);
};

Code Samples

curl -X POST https://backend.flashback.tech/subscriptions/cancel \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'

Example responses

200 Response

{
  "success": true,
  "message": "Subscription cancelled successfully"
}

400 Response (No Organization)

{
  "success": false,
  "error_code": "NO_ORGANIZATION",
  "message": "User must belong to an organization"
}

400 Response (Already Cancelled)

{
  "success": false,
  "error_code": "SUBSCRIPTION_ALREADY_CANCELLED",
  "message": "The subscription is already cancelled"
}

400 Response (Not Cancellable)

{
  "success": false,
  "error_code": "SUBSCRIPTION_NOT_CANCELLABLE",
  "message": "The subscription cannot be cancelled. Current status: past_due"
}

400 Response (No Stripe ID)

{
  "success": false,
  "error_code": "NO_STRIPE_SUBSCRIPTION_ID",
  "message": "The subscription does not have a valid Stripe ID"
}

400 Response (Stripe Not Found)

{
  "success": false,
  "error_code": "STRIPE_SUBSCRIPTION_NOT_FOUND",
  "message": "Could not find the subscription in Stripe"
}

404 Response (User Not Found)

{
  "success": false,
  "error_code": "USER_NOT_FOUND",
  "message": "User not found"
}

404 Response (No Active Subscription)

{
  "success": false,
  "error_code": "NO_ACTIVE_SUBSCRIPTION",
  "message": "No active subscription found to cancel"
}

500 Response (Stripe Cancellation Failed)

{
  "success": false,
  "error_code": "STRIPE_CANCELLATION_FAILED",
  "message": "Error cancelling the subscription in Stripe"
}

500 Response (Internal Error)

{
  "success": false,
  "error_code": "INTERNAL_ERROR",
  "message": "Error processing subscription cancellation"
}

Responses

Status
Meaning
Description
Schema

200

Subscription cancelled successfully

Inline

400

Invalid request or subscription state

Inline

404

User or subscription not found

Inline

500

Server or Stripe error

Inline

Response Schema

Status Code 200

Name
Type
Required
Restrictions
Description

» success

boolean

false

none

Indicates if the request was successful

» message

string

false

none

Success message

Status Code 400

Name
Type
Required
Restrictions
Description

» success

boolean

false

none

Will be false for error responses

» error_code

string

false

none

Machine-readable error code

» message

string

false

none

Human-readable error message

Status Code 404

Name
Type
Required
Restrictions
Description

» success

boolean

false

none

Will be false for error responses

» error_code

string

false

none

Machine-readable error code

» message

string

false

none

Human-readable error message

Status Code 500

Name
Type
Required
Restrictions
Description

» success

boolean

false

none

Will be false for error responses

» error_code

string

false

none

Machine-readable error code

» message

string

false

none

Human-readable error message

Last updated

Was this helpful?