Skip to main content
Safeclose uses Stripe to handle subscription billing for your organization. From the Safeclose UI — or directly through the API — you can start a Stripe Checkout session to select a plan, and open the Stripe Customer Portal to manage payment methods, view invoices, or cancel your subscription. When Stripe processes a payment or subscription change, Safeclose receives a webhook and updates your organization’s billing status automatically.
You must have the billing permission in your organization to start checkout sessions or open the Customer Portal. Organization owners always have this permission. See Organizations and billing for how to grant billing access to other members.

Available plans

PlanTier value
StarterSTARTER
ProPRO
EnterpriseENTERPRISE
Your organization starts on the Free tier until a checkout is completed.

Start a checkout session

POST /api/billing/checkout-session creates a Stripe Checkout session for the specified plan and returns a redirect URL. Send the user to that URL to complete payment.
curl -X POST https://your-app.com/api/billing/checkout-session \
  -H "Cookie: <your-session-cookie>" \
  -H "Content-Type: application/json" \
  -d '{
    "orgId": "org_01example",
    "planTier": "PRO"
  }'
Request body:
FieldTypeRequiredDescription
orgIdstringYesYour organization’s ID.
planTierstringYesOne of "STARTER", "PRO", or "ENTERPRISE".
Redirect the user to the returned url. After a successful payment, Stripe sends a webhook to Safeclose, which links your organization to the Stripe customer and activates the selected plan. The user is then redirected back to your billing page.
If the user cancels the checkout, they are redirected back to your billing page with no changes to your subscription.

Open the Customer Portal

POST /api/billing/portal opens the Stripe Customer Portal where your organization can update payment methods, download invoices, or cancel the subscription.
curl -X POST https://your-app.com/api/billing/portal \
  -H "Cookie: <your-session-cookie>" \
  -H "Content-Type: application/json" \
  -d '{
    "orgId": "org_01example"
  }'
Request body:
FieldTypeRequiredDescription
orgIdstringYesYour organization’s ID.
Redirect the user to the returned url. Stripe handles the session and returns the user to your billing page when they are done.

How billing status updates work

After a successful checkout or subscription change, Stripe sends a webhook event to Safeclose. Safeclose processes the following events automatically:
Stripe eventWhat changes in Safeclose
checkout.session.completedYour organization is linked to a Stripe customer and the selected plan tier is applied.
customer.subscription.updatedSubscription status and current period end date are refreshed.
customer.subscription.deletedYour subscription is marked as canceled and your plan reverts to Free.
invoice.paidSubscription status is confirmed as active.
invoice.payment_failedYour billing account is flagged as past due.
You do not need to take any action for these updates — Safeclose handles them in the background.
To see your current subscription status and billing history, go to Organizations → your org → Billing in Safeclose, or open the Customer Portal using the steps above.

API summary

MethodPathAuthPermissionDescription
POST/api/billing/checkout-sessionSession requiredbillingCreates a Stripe Checkout session for a plan upgrade.
POST/api/billing/portalSession requiredbillingReturns a Stripe Customer Portal URL.

Organizations and billing

Learn how to manage org members, assign billing permissions, and view your plan.

Stripe webhook events

Understand how Safeclose verifies and processes Stripe webhook events.