Payments

The payment endpoints let you manage subscriptions via Stripe: list plans, create checkout sessions, process subscriptions, update or cancel plans, and access the customer portal.

Endpoints

Method
Path
Description

GET

/payment/subscription-plans

List available subscription plans

POST

/payment/subscription-checkout

Create checkout session

POST

/payment/subscription-process

Process subscription after checkout

POST

/payment/subscription-update

Update subscription

POST

/payment/subscription-cancel

Cancel subscription

GET

/payment/customer-info

Get Stripe customer info

POST

/payment/customer-portal

Create customer portal session


List Subscription Plans

Returns available subscription plans for an organization.

Method: GET Path: /payment/subscription-plans

Query Parameters

Parameter
Type
Required
Description

organizationId

string

Yes

Organization ID

Response Body

Returns an array of subscription plan objects with pricing, features, and product details.

Example


Create Checkout Session

Creates a Stripe Checkout session for subscribing to a plan. Returns a URL to redirect the user to complete payment.

Method: POST Path: /payment/subscription-checkout

Request Body

JSON object with organizationId, priceId, productId, and optionally successUrl, cancelUrl.

Response Body

Returns an object with a url field for the checkout session.

Example


Process Subscription

Processes a subscription after the user completes Stripe Checkout. Typically called by a webhook or redirect handler.

Method: POST Path: /payment/subscription-process

Query Parameters

Parameter
Type
Required
Description

secret

string

Yes

Secret or session identifier from checkout

Response Body

Returns confirmation of the processed subscription.

Example


Update Subscription

Updates the subscription plan for an organization (e.g., upgrade or downgrade).

Method: POST Path: /payment/subscription-update

Request Body

Field
Type
Required
Description

organizationId

string

Yes

Organization ID

priceId

string

Yes

New Stripe price ID

productId

string

Yes

New Stripe product ID

Response Body

Returns confirmation of the update.

Example


Cancel Subscription

Cancels the subscription for an organization.

Method: POST Path: /payment/subscription-cancel

Request Body

Field
Type
Required
Description

organizationId

string

Yes

Organization ID

Response Body

Returns an empty object on success.

Example


Get Customer Info

Retrieves Stripe customer information for an organization, including subscription status, payment method, and billing details.

Method: GET Path: /payment/customer-info

Query Parameters

Parameter
Type
Required
Description

organizationId

string

Yes

Organization ID

Response Body

Returns customer details such as customerId, email, address, defaultCardLast4, activeProductId, and subscription status.

Example


Create Customer Portal Session

Creates a Stripe Customer Portal session. Returns a URL where the user can manage their subscription, payment methods, and invoices.

Method: POST Path: /payment/customer-portal

Request Body

Field
Type
Required
Description

organizationId

string

Yes

Organization ID

Response Body

Returns an object with a url field for the portal session.

Example

Last updated