API reference
Subscriptions
Common headers
Every endpoint on this page takes these headers.
| 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_...). |
Common responses
Every endpoint on this page can answer with these.
| Status | Description | Body |
|---|---|---|
| 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 |
| 429 | Too many requests (rate_limited). Wait for the Retry-After header, then retry. | ErrorResponse |
List subscriptions
GET/
Lists subscriptions newest first. Use it to find a customer's subscriptions before creating another.
Arguments: customer, status (one status, or all; default every status but canceled), price, merchant_id, limit (1 to 100, default 20), cursor, expand[] (data.latest_invoice, data.latest_invoice.payment_intent, data.customer, data.default_payment_method, data.items.data.price.product). With the ZeroPoint-Account (or Stripe-Account) header: only that merchant's subscriptions.
Returns a list object of subscriptions with has_more and next_cursor.
Errors: parameter_invalid (400) also when merchant_id and the ZeroPoint-Account header name different merchants; parameter_invalid (400), resource_missing (404: the merchant is not this key's).
Next step: GET /v1/subscriptions/{id}.
Parameters
| Name | Description |
|---|---|
customerquery, string or null | |
statusquery, string or null | |
pricequery, string or null | |
merchant_idquery, string or null | |
limitquery, integer | Items per page, default 20. |
cursorquery, string or null | next_cursor from the previous page. |
starting_afterquery, string or null | Stripe's name for cursor: the id of the last object of the previous page. Same value, same meaning. Send cursor or starting_after, not both. |
ending_beforequery, string or null | Not supported: answers 400 parameter_unavailable. Lists page newest first; page forward with starting_after. |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | any |
Example
curl -X GET "https://api.zeropointapp.com/v1/subscriptions" \
-H "Authorization: Bearer zp_test_..."Create a subscription
POST/
Starts a monthly or annual subscription on a customer's saved card and charges the first period now. Amounts are the price's integer cents. Use it when your app already holds the customer's saved card (pm_...); to take a new card and start the plan in one step, use a checkout session with mode subscription instead.
Arguments: merchant_id (optional: without it the ZeroPoint-Account header, else the platform's only merchant in this mode), customer (cus_...), items [{price}] (exactly one recurring price billed every 1 month or 1 year), default_payment_method (pm_..., required), promotion_code (promo_..., optional), metadata (up to 50 string pairs), payment_behavior (allow_incomplete, the default, or error_if_incomplete). Example: {customer: cus_123, items: [{price: price_456}], default_payment_method: pm_789, metadata: {user_id: u_42}}. Needs subscriptions:write and payment_methods:charge. The key is the Idempotency-Key header (required).
Returns the subscription (id sub_...): status active when the first payment captured; incomplete when it was declined and payment_behavior is allow_incomplete (no access: ask for another card, then pay latest_invoice at least 60 seconds after the decline). A retry with the same key returns the same subscription and never charges twice, also after a 502 or a lost answer. Never retry with a new key: a new key is a new subscription. A payment whose outcome is unknown is never treated as declined: it answers 502 processor_unavailable or 409 invoice_reconciling, and the same key resumes it. Emits customer.subscription.created, then invoice.paid, invoice.payment_succeeded and customer.subscription.updated once the first payment captures. A retry also replays after billing was switched off for the merchant; only a new key is refused then. Billing runs in test mode in this release: renewals, retries and reminders happen when you advance a test clock, nothing renews on real time yet, and a live merchant is refused with billing_unavailable. A create that relied on the only-merchant default and is retried after a second merchant was added answers 400 Which merchant?: retry it with merchant_id or the header naming that merchant and it replays.
Errors: idempotency_key_required, idempotency_key_reused (422); parameter_invalid, payment_method_required, price_not_recurring, price_interval_unsupported, proration_behavior_unsupported, billing_unavailable, test_clock_deleted (400); card_declined, duplicate_transaction, partial_approval, processor_rejected (402 with error_if_incomplete, naming subscription, invoice and payment; a card decline also names decline_code), payment_method_blocked (402: this card was hard declined at this merchant; nothing was sent; use another card); resource_missing (404); subscription_create_unresolved (409: a subscription for this customer is still waiting for its first payment's outcome; retrieve it, do not create another), subscription_exists (409: the merchant's subscription_guard found this customer's live one; named; nothing created), checkout_outcome_unknown (409: a checkout of this customer awaits its outcome; held_session_id), payment_method_unusable (409: nothing was sent), invoice_payment_in_progress, invoice_reconciling, payment_in_progress, merchant_unchargeable, subscription_create_refused (409, Retry-After); invoice_pay_limit (429: the card's attempt limits; Retry-After); processor_unavailable (502: the payment is pending; retry with the same key).
Next step: GET /v1/subscriptions/{id}, or POST /v1/invoices/{id}/pay for latest_invoice.
Parameters
| Name | Description |
|---|---|
Idempotency-Keyheader, string or null | Required on this endpoint. Any unique string up to 255 characters (a UUID is fine). Reuse it only to retry the same request. |
Request body
| Field | Description | ||||
|---|---|---|---|---|---|
merchant_idstring or null | Optional. The merchant (mch_...). Without it: the ZeroPoint-Account header (Stripe-Account is accepted too), else the platform's only merchant in this mode. | ||||
customerstringRequired | The customer (cus_...) of that merchant. | ||||
itemsarray of SubscriptionItemRequired | Exactly one item: [{price}]. Fields inside items
| ||||
default_payment_methodstring or null | The customer's saved card (pm_...) to charge. Required. | ||||
promotion_codestring or null | A promotion code (promo_...) to apply to the first invoice. | ||||
metadataobject of string | Up to 50 pairs. | ||||
payment_behaviorstring | allow_incomplete (default): a declined first payment answers 200 with the subscription incomplete. error_if_incomplete: it answers 402 and the subscription ends incomplete_expired. Default: | ||||
proration_behaviorstring or null | always_invoice only in v1. | ||||
billing_cycle_anchorinteger or null | Not supported in v1: the anchor is the create instant. |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | object |
| 402 | The payment itself failed (type payment_error); branch on code. | ErrorResponse |
| 409 | Conflict with the current state: idempotency_in_progress (another request with this Idempotency-Key is still running; wait for Retry-After), or a conflict 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 |
| 422 | This Idempotency-Key was already used with a different request body (code idempotency_key_reused). Send the original body to retry, or a new key for a new request. | ErrorResponse |
| 502 | The payments network failed or gave no decision (processor_unavailable). The outcome may be unknown: a 5xx releases the Idempotency-Key, so retry with the same key and body. | ErrorResponse |
| 503 | No processor is available for this merchant or deployment (processor_not_connected, sandbox_processor_unconfigured, connect_unavailable). | ErrorResponse |
Example
curl -X POST "https://api.zeropointapp.com/v1/subscriptions" \
-H "Authorization: Bearer zp_test_..." \
-H "Idempotency-Key: <Idempotency-Key>" \
-H "Content-Type: application/json" \
-d '{
"customer": <customer>,
"items": <items>
}'Retrieve a subscription
GET/
Reads one subscription. Use it to decide access: gate on status (active; past_due too if you give a grace period), never on current_period_end, which moves only when a renewal is paid.
Arguments: subscription_id (sub_...), expand[] (latest_invoice, latest_invoice.payment_intent, customer, default_payment_method, items.data.price.product; any other path is parameter_unavailable). With the ZeroPoint-Account (or Stripe-Account) header, a subscription of another merchant is resource_missing.
Returns the subscription: status, items.data[0].price, current_period_start and current_period_end (Unix seconds, also on items.data[0]), cancel_at_period_end, scheduled_change (a plan change waiting for the period end; its blocked_by is set while the duplicate guard would refuse it at the renewal), pending_update (an upgrade waiting for its payment), payment_hold (set while a charge's outcome is being confirmed: change nothing), latest_invoice and test_clock.
Errors: resource_missing (404).
Next step: GET /v1/invoices?subscription={id} for its invoices.
Parameters
| Name | Description |
|---|---|
subscription_idpath, stringRequired |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | any |
Example
curl -X GET "https://api.zeropointapp.com/v1/subscriptions/{subscription_id}" \
-H "Authorization: Bearer zp_test_..."Update a subscription
POST/
Changes a subscription's plan, its cancel at period end, its saved card or its metadata. Use it for upgrades, downgrades, cancel at period end and undoing it, and a new default card.
Arguments: subscription_id, items [{id: si_..., price: price_...}], change_timing (period_end, or now for an upgrade), proration_behavior (always_invoice, required for a change charged now), proration_date (Unix seconds pinned from a preview, at most 1 hour old), payment_behavior (pending_if_incomplete or left out), metadata (merged per key; "" removes a key), default_payment_method (pm_...), cancel_at_period_end (true or false). Send items on their own. Example upgrade: {items: [{id: si_123, price: price_premium}], proration_behavior: always_invoice}. A charged change needs payment_methods:charge. The key is the Idempotency-Key header (required).
Returns the subscription. An upgrade (same interval, dearer price) or a monthly to annual switch is charged now: the prorated difference in integer cents (unused time on the current plan credited, only from money still held) is invoiced and charged to the saved card, and the plan changes only after that payment is proven captured; until then pending_update shows it, and a decline answers 402 and keeps the current plan. A monthly to annual switch starts the year now. A difference below the minimum charge (50 cents by default) applies the plan now with no charge and is added to the next renewal invoice. A downgrade, a lateral change or an annual to monthly switch is stored as scheduled_change and applied at current_period_end: the renewal is charged at the new price; nothing is charged or credited now. Asking for the price the subscription is already on changes nothing: it answers the subscription unchanged, with or without proration_behavior, charges nothing and keeps a scheduled_change (only cancel_scheduled_change removes one). A retry with the same key never charges twice; another key asking for another price while a change is being paid answers change_pending (the price it is already on still answers the subscription unchanged). cancel_at_period_end true keeps the subscription active until current_period_end and then ends it; while past_due, unpaid or incomplete it cancels now. false undoes it before the period ends. Nothing is refunded. Emits customer.subscription.updated (customer.subscription.deleted for an immediate cancel).
Errors: idempotency_key_required, idempotency_key_reused (422); parameter_invalid, change_timing_unsupported, proration_behavior_required, proration_behavior_unsupported, price_not_recurring, price_interval_unsupported, billing_unavailable (400); card_declined, processor_rejected, payment_failed, payment_method_blocked (402: the plan did not change); resource_missing (404); subscription_inactive (409: the subscription has ended, or its period is over), subscription_past_due, change_pending, change_not_applied (409: the card was charged but the plan did not change; the payment is listed for a refund), change_expired, change_stale (409: the change was refused before anything was sent and is over 1 hour old, or another change replaced it; nothing was charged; start again with a new key), renewal_due (Retry-After 120), invoice_reconciling (Retry-After 300), invoice_payment_in_progress (Retry-After), merchant_unchargeable (409), subscription_changed (409, Retry-After 1: the subscription changed while the request ran; retry the same request); invoice_pay_limit (429, Retry-After); processor_unavailable (502: retry with the same key).
Next step: GET /v1/subscriptions/{id}.
Parameters
| Name | Description |
|---|---|
subscription_idpath, stringRequired | |
Idempotency-Keyheader, string or null | Required on this endpoint. Any unique string up to 255 characters (a UUID is fine). Reuse it only to retry the same request. |
Request body
| Field | Description | ||||||
|---|---|---|---|---|---|---|---|
itemsarray of SubscriptionItemChange or null | A plan change: [{id: si_..., price: price_...}]. A downgrade, a lateral change or an annual to monthly switch applies at the end of the current period. Fields inside items
| ||||||
change_timingstring or null | period_end (the default for a downgrade); now is refused for a downgrade. | ||||||
proration_behaviorstring or null | always_invoice, required for a change charged now (an upgrade or a monthly to annual switch); no other value is accepted. | ||||||
proration_dateinteger or null | Unix seconds to prorate from (pinned from a preview): inside the current period, not in the future and at most 1 hour old. Default: now. | ||||||
payment_behaviorstring or null | pending_if_incomplete (the default): the plan changes only once the payment captures. allow_incomplete is refused. | ||||||
metadataobject of string or null | Merged per key into the subscription's metadata; an empty value removes it. | ||||||
default_payment_methodstring or null | The customer's saved card (pm_...) to charge from now on. | ||||||
cancel_at_period_endboolean or null | true: end the subscription at the end of the current period (immediate while past_due, unpaid or incomplete). false: undo it before that period ends. |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | object |
| 402 | The payment itself failed (type payment_error); branch on code. | ErrorResponse |
| 409 | Conflict with the current state: idempotency_in_progress (another request with this Idempotency-Key is still running; wait for Retry-After), or a conflict 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 |
| 422 | This Idempotency-Key was already used with a different request body (code idempotency_key_reused). Send the original body to retry, or a new key for a new request. | ErrorResponse |
| 502 | The payments network failed or gave no decision (processor_unavailable). The outcome may be unknown: a 5xx releases the Idempotency-Key, so retry with the same key and body. | ErrorResponse |
| 503 | No processor is available for this merchant or deployment (processor_not_connected, sandbox_processor_unconfigured, connect_unavailable). | ErrorResponse |
Example
curl -X POST "https://api.zeropointapp.com/v1/subscriptions/{subscription_id}" \
-H "Authorization: Bearer zp_test_..." \
-H "Idempotency-Key: <Idempotency-Key>" \
-H "Content-Type: application/json" \
-d '{}'Cancel a subscription now
DELETE/
Cancels a subscription now. Use it only when access must end today; to end at the end of the paid period, set cancel_at_period_end instead.
Arguments: subscription_id (sub_...).
Returns the subscription with status canceled and ended_at set (an incomplete subscription ends incomplete_expired). Its open invoice is voided unless a payment on it is still being processed: that payment resolves on its own, and if it captured, the invoice is paid and kept. Nothing is refunded. A canceled subscription answers as it is. Emits customer.subscription.deleted.
Errors: resource_missing (404); subscription_changed (409, Retry-After 1: the subscription changed while the request ran; retry the same request).
Next step: none.
Parameters
| Name | Description |
|---|---|
subscription_idpath, stringRequired |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | object |
| 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 |
Example
curl -X DELETE "https://api.zeropointapp.com/v1/subscriptions/{subscription_id}" \
-H "Authorization: Bearer zp_test_..."Cancel a scheduled plan change
POST/
Removes the plan change scheduled for the end of the current period. Use it when the customer takes back a downgrade before it applies.
Arguments: subscription_id (sub_...).
Returns the subscription, which renews on its current price. With no scheduled change, it answers the subscription unchanged. Emits customer.subscription.updated. While cancel_at_period_end is true it discards the change kept for an undo, for good, and sends no event (nothing public changed); the subscription still ends at period end.
Errors: resource_missing (404); subscription_changed (409, Retry-After 1: the subscription changed while the request ran; retry the same request).
Next step: GET /v1/subscriptions/{id}.
Parameters
| Name | Description |
|---|---|
subscription_idpath, stringRequired |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | object |
| 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 |
Example
curl -X POST "https://api.zeropointapp.com/v1/subscriptions/{subscription_id}/scheduled_change/cancel" \
-H "Authorization: Bearer zp_test_..."