API reference
Billing portal
Create a customer portal session
POST/
Creates a short-lived link to the hosted customer portal, where your customer sees their subscriptions and next charge, cancels at period end (and undoes it), updates their card and pays an open invoice. Use it behind a Manage billing button in your signed-in app, one session per click.
Arguments: customer (cus_...), return_url (optional: https, http for localhost in test mode; in live mode the host must be on your live redirect list).
Returns a billing_portal.session: id (bps_...), object, created, customer, livemode, return_url, url, expires_at. Redirect your signed-in user to url at once: it works once and expires 5 minutes after creation. Never email it, store it or show it. Each call makes a new session. ZeroPoint sends no email to your customers: send your own from the billing events.
Errors: parameter_invalid, url_invalid (400); resource_missing (404, also for a deleted customer).
Next step: redirect the browser to url.
Parameters
| Name | Description |
|---|---|
ZeroPoint-Accountheader, string or null | Optional. The merchant (mch_...) this request acts on, when the body has no merchant_id: the analogue of Stripe's Stripe-Account header. |
Stripe-Accountheader, string or null | Optional. A synonym of ZeroPoint-Account; holds a merchant id (mch_...). |
Request body
| Field | Description |
|---|---|
customerstringRequired | The customer (cus_...) the portal is for. |
return_urlstring or null | Where the portal's back link goes: https (http for localhost in test mode); in live mode the host must be on your live redirect list. |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | object |
| 400 | Invalid request. A parameter, header or body field failed validation (code parameter_invalid, with param naming it), or another invalid_request code this operation's description lists. Fix the request; do not retry it unchanged. | ErrorResponse |
| 401 | The API key is missing, malformed, unknown or revoked (api_key_missing, api_key_malformed, api_key_invalid). Fix the Authorization header. | ErrorResponse |
| 403 | The key is valid but may not do this: platform_suspended, insufficient_scope, live_mode_unavailable, or a permission code this operation's description lists (for example processor_currency_unsupported). | ErrorResponse |
| 404 | No such resource for this platform (resource_missing), or another not_found code this operation's description lists. | ErrorResponse |
| 413 | The request body is over 1048576 bytes, its Content-Length is not a number, or it is sent chunked (code payload_too_large). Every write method is checked, before routing. Send a smaller body with a Content-Length. | ErrorResponse |
| 429 | Too many requests (rate_limited). Wait for the Retry-After header, then retry. | ErrorResponse |
Example
curl -X POST "https://api.zeropointapp.com/v1/billing_portal/sessions" \
-H "Authorization: Bearer zp_test_..." \
-H "Content-Type: application/json" \
-d '{
"customer": <customer>
}'