Skip to main content

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_id is the workspace being paid for.
  • plan is a tier: starter, growth, pro or agency.
  • 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/:id returns 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​

StatusEntitled?Meaning
trialingYesIn a trial period
activeYesPaid and current
past_dueYesA renewal failed; Stripe is retrying
incompleteNoCheckout was started but not completed
unpaidNoCollection failed and retries are exhausted
canceledNoEnded
pausedNoPaused 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​

  1. Open the billing portal and confirm the payment method.
  2. Check GET /subscriptions/me for past_due, unpaid or incomplete.
  3. For incomplete, contact support to clear the abandoned checkout.
  4. For past_due, update the card and let Stripe retry; access continues during the retry window.
  5. For unpaid or canceled, start a new checkout after the old state is cleared.

Next: Cancellation and Refunds.