Skip to main content

Portal — Billing

Billing endpoints return subscription and usage information, and allow you to initiate a Stripe checkout session to subscribe to or upgrade a plan.

All portal endpoints require a JWT Bearer token. See Authentication for how to obtain one.

GET /api/billing/info

Retrieve billing and subscription details for your organization, including current plan, usage, and quota.

Request

GET https://api.pdfcanon.com/api/billing/info
Authorization: Bearer <access_token>

Response (200 OK)

FieldTypeDescription
planTierstringCurrent plan: free, starter, growth, or pro
monthlyDocLimitintegerMaximum normalizations allowed per billing cycle
currentMonthUsageintegerNormalizations used in the current billing cycle
remainingQuotaintegerRemaining normalizations for the current cycle
usagePercentnumberPercentage of quota consumed
stripeCustomerIdstring (nullable)Stripe customer ID, if a paid subscription exists
stripeSubscriptionIdstring (nullable)Stripe subscription ID, if a paid subscription exists
billingIntervalstringmonth or year
subscriptionStatusstringStripe subscription status (e.g. active, past_due)
currentPeriodEnddatetime (nullable)End of the current billing period
cancelAtPeriodEndbooleanWhether the subscription will cancel at period end
overageRatePerDocnumberPer-document overage rate (decimal)

Example

curl https://api.pdfcanon.com/api/billing/info \
-H "Authorization: Bearer eyJ..."

POST /api/billing/checkout-session

Create a Stripe Checkout session to subscribe to or upgrade a plan. Returns a redirect URL to the Stripe-hosted payment page.

Request

POST https://api.pdfcanon.com/api/billing/checkout-session
Authorization: Bearer <access_token>
Content-Type: application/json
FieldTypeRequiredDescription
tierstringTarget plan: starter, growth, or pro
intervalstringBilling interval: month or year
successUrlstring (uri)URL to redirect to after successful checkout
cancelUrlstring (uri)URL to redirect to if checkout is cancelled

Response (200 OK)

FieldTypeDescription
urlstringStripe Checkout session URL — redirect the user here

Example

curl -X POST https://api.pdfcanon.com/api/billing/checkout-session \
-H "Authorization: Bearer eyJ..." \
-H "Content-Type: application/json" \
-d '{
"tier": "starter",
"interval": "month",
"successUrl": "https://app.yourcompany.com/billing?success=true",
"cancelUrl": "https://app.yourcompany.com/billing"
}'