post__subscriptions_portal

POST /subscriptions/portal

Create Billing Portal Session

Create a Stripe billing portal session for the authenticated user's organization to manage their subscription, billing information, and payment methods.

Parameters

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

TypeScript Client Library

public createBillingPortal = async (): Promise<CreateBillingPortalResponse> => {
  return this.makeRequest<CreateBillingPortalResponse>('subscriptions/portal', 'POST', null);
};

Code Samples

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

Example responses

200 Response

{
  "success": true,
  "url": "https://billing.stripe.com/p/session_1234567890abcdef"
}

400 Response

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

404 Response (User Not Found)

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

404 Response (Organization Not Found)

{
  "success": false,
  "error_code": "ORG_NOT_FOUND",
  "message": "Organization not found"
}

500 Response

{
  "success": false,
  "error_code": "INTERNAL_ERROR",
  "message": "Failed to create billing portal session"
}

Responses

Status
Meaning
Description
Schema

200

Billing portal session created

Inline

400

User not in organization

Inline

404

User or organization not found

Inline

500

Server error

Inline

Response Schema

Status Code 200

Name
Type
Required
Restrictions
Description

» success

boolean

false

none

Indicates if the request was successful

» url

string

false

none

Stripe billing portal URL for customer access

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?