Billing and Payment
Payments run through Stripe. PruneSEO starts a hosted Checkout session, records what Stripe reports, and turns the active subscription into plan entitlements.
The money path
choose a plan
↓
POST /subscriptions/checkout → hosted Stripe Checkout
↓
pay (or start a trial, where configured)
↓
/billing/done?session_id=… → POST /subscriptions/refresh
↓
Stripe webhook → subscription row + entitlements
The success page reads the checkout immediately so the customer does not have to wait for a webhook. The webhook remains the durable record: a missed redirect does not lose the subscription.
Starting a subscription
POST /api/v1/subscriptions/checkout
{
"org_id": "<organization-id>",
"plan": "starter",
"success_path": "/billing/done",
"cancel_path": "/billing"
}
org_idis the workspace being paid for.planis a tier:starter,growth,prooragency.- The server resolves the Stripe price. Clients never send a price ID.
- Only the workspace owner may start checkout.
- An already-entitled subscription is refused with a message directing the caller to the billing portal.
- An incomplete subscription blocks a second checkout. That state needs the support team to clear the abandoned session first.
- The response is
{ "url": "https://checkout.stripe.com/..." }.
The billing portal
POST /api/v1/subscriptions/portal
{ "plan": "pro" }
The response is a hosted Stripe portal URL where the customer can:
- change plan,
- update the payment method,
- view invoices and receipts,
- cancel the subscription.
Sending plan asks Stripe to deep-link to that plan's confirmation. If the
portal is not configured to allow that price change, the API falls back to the
general portal rather than failing the button. If the account has never
subscribed, the portal is refused because there is nothing to manage.
Invoices and receipts
PruneSEO does not issue its own invoices. Stripe is the billing system of record:
- Invoices, receipts and tax documents are in the Stripe customer portal.
- Payment and invoice records are written from Stripe webhooks, including renewal charges.
- Receipts are sent by email through the application's outbox when a payment succeeds.
GET /payments/:idreturns one payment recorded in PruneSEO, scoped to the caller. There is no in-app invoice list.
If a receipt is missing, check the Stripe portal first and the email address on the Stripe customer second.
Subscription statuses
| Status | Entitled? | Meaning |
|---|---|---|
trialing | Yes | In a trial period |
active | Yes | Paid and current |
past_due | Yes | A renewal failed; Stripe is retrying |
incomplete | No | Checkout was started but not completed |
unpaid | No | Collection failed and retries are exhausted |
canceled | No | Ended |
paused | No | Paused at Stripe |
past_due deliberately keeps access while Stripe retries the card. A failed
renewal usually recovers, and cutting access on the first retry punishes an
expired card rather than a refusal to pay.
Status flows from Stripe. Do not infer it from the presence of a plan label on a
page; use GET /subscriptions/me or the entitlements endpoint.
When local state looks wrong
- Just paid, page still says no plan. Call
POST /subscriptions/refresh?session_id=<id>with the session from the return URL. - A webhook may have been missed. Call
POST /subscriptions/sync. It re-reads Stripe and applies the result. If Stripe cannot be reached, the API returns the local row unchanged rather than blanking the page. - The plan changed but the workspace still sees old limits. Check entitlements first; a webhook applies the tier and its entitlements in one transaction.
Refunds
Refunds are handled by the platform team, not by the customer:
- The refund route is
POST /admin/payments/:id/refund, restricted to platform administrators with the refund permission. - Partial refunds are supported.
- A refund does not revoke access or cancel the subscription. It records the financial correction and leaves the entitlement decision to the normal billing lifecycle.
Customers who need a refund should contact support. There is no self-serve refund button, and no refund is issued automatically by cancellation.
Security and permissions
Only the owner may start checkout. The portal, refresh, sync, cancel and resume routes currently require only active workspace membership, which is broader than the spending rule. Until that is tightened, workspace owners should treat those actions as theirs alone.
Payment data lives in Stripe. PruneSEO stores customer and subscription identifiers, amounts and statuses needed to grant access and show history; it does not store card numbers.
Failed payment checklist
- Open the billing portal and confirm the payment method.
- Check
GET /subscriptions/meforpast_due,unpaidorincomplete. - For
incomplete, contact support to clear the abandoned checkout. - For
past_due, update the card and let Stripe retry; access continues during the retry window. - For
unpaidorcanceled, start a new checkout after the old state is cleared.
Next: Cancellation and Refunds.