API reference
Invoices
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 invoices
GET/
Lists invoices newest first. Use it to show a customer's billing history or to find an open invoice to pay.
Arguments: customer, subscription, status (open, paid, void, uncollectible), limit, cursor, expand[] (data.customer, data.subscription, data.payment_intent). With the ZeroPoint-Account (or Stripe-Account) header: only that merchant's invoices.
Returns a list object of invoices (amounts in integer cents) with has_more and next_cursor.
Errors: parameter_invalid (400), resource_missing (404: the merchant is not this key's).
Next step: GET /v1/invoices/{id}.
Parameters
| Name | Description |
|---|---|
customerquery, string or null | |
subscriptionquery, string or null | |
statusquery, 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/invoices" \
-H "Authorization: Bearer zp_test_..."Preview the next invoice or a plan change
POST/
Returns the invoice the subscription's next renewal will charge, or the invoice a plan change would make now, computed by the same code as the charge. Use it to show the next charge, or the exact upgrade charge before the customer confirms; it creates, changes and charges nothing.
Arguments: subscription (sub_...); for a plan change, subscription_details with items [{id: si_..., price: price_...}], proration_behavior (always_invoice, required for a change charged now) and proration_date (Unix seconds, optional). Example: {subscription: sub_123, subscription_details: {items: [{id: si_123, price: price_premium}], proration_behavior: always_invoice}}. A plan-change preview needs catalog:read as well as invoices:read.
Returns an invoice object with no id and no status (Stripe's upcoming invoice). With no plan change: the next renewal, with a scheduled change due at the renewal and the discount window applied; an open invoice answers its amount due. With a plan change: plan_change says what the update would do (kind, timing now or period_end, effective_at, amount_due_now, carried_to_next_invoice, credit_not_kept), and subscription_proration_date is the instant it was prorated at. An upgrade or a monthly to annual switch answers the invoice the update would charge now (billing_reason subscription_update, the credit for unused time and the charge for the remaining time); amount_due is exactly what the update charges when sent within the hour with proration_date set to subscription_proration_date. A difference below the minimum charge is due on the next renewal, not now: amount_due is 0 and next_invoice shows that renewal with the carried line. When the credit for unused time is larger than the charge, the plan changes with nothing due and the leftover credit is not kept or refunded: total and amount_due are 0 and plan_change.credit_not_kept names that amount. A downgrade, a lateral change or an annual to monthly switch answers the next renewal invoice at the new price; plan_change.effective_at is when it takes effect and nothing is due now. The price the subscription is already on answers the next renewal unchanged. The same refusals as the update.
Errors: parameter_invalid, proration_behavior_required, proration_behavior_unsupported, price_inactive, price_not_recurring, price_interval_unsupported, invoice_upcoming_none (the subscription will not renew: canceled, ending at period end, or not active) (400); insufficient_scope (403: a plan-change preview without catalog:read); resource_missing (404); subscription_past_due, subscription_inactive, change_pending, renewal_due, invoice_reconciling, invoice_payment_in_progress (409).
Next step: GET /v1/subscriptions/{id}.
Parameters
Request body
| Field | Description | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
subscriptionstringRequired | The subscription (sub_...) to preview. | ||||||||||||||
subscription_detailsPreviewSubscriptionDetails or null | A plan change to preview before it is made (the update's items, proration_behavior and proration_date). Without it, the next renewal, with a scheduled change already on the subscription included. Fields inside subscription_details
|
Responses
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | object |
| 409 | Conflict with the current state. The code this operation's description lists says which, and whether to wait or change the request. | 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 |
Example
curl -X POST "https://api.zeropointapp.com/v1/invoices/create_preview" \
-H "Authorization: Bearer zp_test_..." \
-H "Content-Type: application/json" \
-d '{
"subscription": <subscription>
}'Retrieve an invoice
GET/
Reads one invoice. Use it to see what an invoice charged, its attempts and why it is still open.
Arguments: invoice_id (in_...), expand[] (customer, subscription, payment_intent; any other path is parameter_unavailable). With the ZeroPoint-Account (or Stripe-Account) header, an invoice of another merchant is resource_missing.
Returns the invoice: status (open, paid, void, uncollectible), total, amount_due and amount_paid in integer cents, billing_reason, lines, attempt_count, next_payment_attempt, last_payment_error, payment_intent (the pay_... payment) and missed_period (null today).
Errors: resource_missing (404).
Next step: POST /v1/invoices/{id}/pay for an open invoice.
Parameters
| Name | Description |
|---|---|
invoice_idpath, stringRequired |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | any |
Example
curl -X GET "https://api.zeropointapp.com/v1/invoices/{invoice_id}" \
-H "Authorization: Bearer zp_test_..."Pay an open invoice now
POST/
Charges an open invoice now on the subscription's saved card, or on another card. Use it when the customer fixes their card after a decline and wants to pay at once instead of waiting for the next scheduled retry.
Arguments: invoice_id, payment_method (optional pm_... of the invoice's customer; the subscription's default card stays as it is), off_session (true, the default: the customer is not present; false: the customer is paying now). Needs subscriptions:write and payment_methods:charge. The key is the Idempotency-Key header (required).
Returns the invoice, and only when it is paid; any other outcome is an error. A retry with the same key never charges twice, also after a 502; a retry while a payment is processing resumes that payment as it was sent. Every final answer (a decline included) is kept under the key: after the customer changes the card, use a new key. At most 3 unpaid sends of one card per invoice in 24 hours, 10 per card in 30 days, 60 seconds apart. A decline here never uses up a scheduled retry. Emits invoice.paid and invoice.payment_succeeded, or invoice.payment_failed.
Errors: idempotency_key_required, idempotency_key_reused (422); parameter_invalid, billing_unavailable, payment_method_required (no default card and none named) (400); card_declined, duplicate_transaction, partial_approval, processor_rejected (402, naming 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); invoice_not_payable (not open, its period has ended, or not paid now), subscription_exists (409: a first invoice, and the guard found the customer's live one; named; nothing sent), invoice_payment_in_progress (Retry-After), invoice_reconciling (Retry-After 300: the outcome is not known; never retry with a new key), payment_method_unusable (nothing was sent), payment_in_progress (Retry-After), merchant_unchargeable (409); invoice_pay_limit (429, Retry-After); processor_unavailable (502: the payment is processing; retry with the same key, never a new one).
Next step: GET /v1/subscriptions/{id}.
Parameters
| Name | Description |
|---|---|
invoice_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 |
|---|---|
payment_methodstring or null | A saved card (pm_...) of the invoice's customer to charge instead of the subscription's default. The default stays as it is. |
off_sessionboolean | true (default): the customer is not present (merchant initiated). false: the customer is paying now (customer initiated). Either way a decline here never uses up a retry of the dunning schedule (the scheduler's alone); it counts toward the invoice's attempt_count and the pay limit. Default: |
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/invoices/{invoice_id}/pay" \
-H "Authorization: Bearer zp_test_..." \
-H "Idempotency-Key: <Idempotency-Key>" \
-H "Content-Type: application/json" \
-d '{}'Void an open invoice
POST/
Voids an open invoice nothing was paid on. Use it to forgive a renewal you will not collect.
Arguments: invoice_id (in_...).
Returns the invoice with status void. A renewal invoice's period is forgiven (the subscription advances and is active); a first invoice ends its subscription incomplete_expired; a plan change invoice cancels that change. A void invoice answers as it is. This voids the invoice, not a card payment: a captured payment is reversed with a void before settlement or a refund after it. Emits invoice.voided.
Errors: resource_missing (404); invoice_not_open (a paid or uncollectible invoice is never voided), invoice_payment_in_progress (Retry-After), invoice_reconciling (Retry-After 300), invoice_changed (409, Retry-After 1: retry the same request).
Next step: GET /v1/subscriptions/{id}.
Parameters
| Name | Description |
|---|---|
invoice_idpath, stringRequired |
Request body
InvoiceVoid or null
Responses
| Status | Description | Body |
|---|---|---|
| 200 | Successful Response | object |
| 409 | Conflict with the current state. The code this operation's description lists says which, and whether to wait or change the request. | 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 |
Example
curl -X POST "https://api.zeropointapp.com/v1/invoices/{invoice_id}/void" \
-H "Authorization: Bearer zp_test_..." \
-H "Content-Type: application/json" \
-d '{}'