ZeroPointPayments

API reference

Test helpers

Common headers

Every endpoint on this page takes these headers.

NameDescription
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.

StatusDescriptionBody
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
429

Too many requests (rate_limited). Wait for the Retry-After header, then retry.

ErrorResponse

List test clocks

GET/v1/test_helpers/test_clocks

Test mode only. The platform's test clocks, newest first.

Arguments: limit (1 to 100, default 10).

Errors: test_mode_only.

Parameters

NameDescription
limitquery, integer

Responses

Example

Shell
curl -X GET "https://api.zeropointapp.com/v1/test_helpers/test_clocks" \
  -H "Authorization: Bearer zp_test_..."

Create a test clock

POST/v1/test_helpers/test_clocks

Creates a test clock frozen at frozen_time. Customers bound to it, and their subscriptions, live on the clock's time instead of the real time. Test mode only; a clock never touches a live merchant. Use it to run renewals, declines, retries and reminders in seconds: create the clock, create a customer with test_clock, subscribe it, then advance the clock.

Arguments: frozen_time (Unix seconds), name (optional). Example: {frozen_time: 1798761600, name: renewal test}.

Returns the test_helpers.test_clock (id clock_..., status ready, frozen_time). On a clock, an invoice's created, its periods and the subscription's dates are clock time; an event's own created and payments are real time. A platform keeps at most 100 clocks; a clock is deleted 30 days after it was created.

Errors: test_mode_only, parameter_invalid (400); resource_limit_exceeded (409: delete a clock first).

Next step: POST /v1/customers with test_clock, then POST /v1/subscriptions.

Parameters

Request body

FieldDescription
frozen_timeintegerRequired

Unix seconds: the clock's starting time.

namestring or null

Optional label.

Responses

StatusDescriptionBody
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

Shell
curl -X POST "https://api.zeropointapp.com/v1/test_helpers/test_clocks" \
  -H "Authorization: Bearer zp_test_..." \
  -H "Content-Type: application/json" \
  -d '{
    "frozen_time": <frozen_time>
  }'

Retrieve a test clock

GET/v1/test_helpers/test_clocks/{test_clock_id}

Reads one test clock. Test mode only. Use it to poll an advance until status is ready.

Arguments: test_clock_id (clock_...).

Returns the clock: status (ready, advancing, or internal_failure: it can never advance again, create a new one) and frozen_time. A ready clock short of its target says why in status_details.last_advance.stopped: attempt_in_flight (a charge's answer is still coming: advance again later; after an injected processor_unavailable, resolve the invoice's hold), invoice_held (resolve the invoice's hold), billing_paused, error.

Errors: test_mode_only (400); resource_missing (404).

Next step: GET /v1/subscriptions?customer=... to see what the advance did.

Parameters

NameDescription
test_clock_idpath, stringRequired

Responses

StatusDescriptionBody
404

No such resource for this platform (resource_missing), or another not_found code this operation's description lists.

ErrorResponse

Example

Shell
curl -X GET "https://api.zeropointapp.com/v1/test_helpers/test_clocks/{test_clock_id}" \
  -H "Authorization: Bearer zp_test_..."

Delete a test clock

DELETE/v1/test_helpers/test_clocks/{test_clock_id}

Cancels every subscription on a test clock (the normal cancel, in the clock's time), deletes its customers where a customer can be deleted, and deletes the clock. Test mode only. Use it to clean up after a rehearsal, or when a platform reaches its 100 clocks.

Arguments: test_clock_id (clock_...).

Returns the deleted clock; the clock answers 404 from then on. History (invoices, payments, events) is kept. A customer that could not be deleted stays on the deleted clock and cannot start new subscriptions (test_clock_deleted, 400): create a new customer for the next rehearsal.

Errors: test_mode_only (400); resource_missing (404); test_clock_advancing (409, Retry-After: wait until the advance ends).

Next step: none.

Parameters

NameDescription
test_clock_idpath, stringRequired

Responses

StatusDescriptionBody
404

No such resource for this platform (resource_missing), or another not_found code this operation's description lists.

ErrorResponse
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

Shell
curl -X DELETE "https://api.zeropointapp.com/v1/test_helpers/test_clocks/{test_clock_id}" \
  -H "Authorization: Bearer zp_test_..."

Advance a test clock

POST/v1/test_helpers/test_clocks/{test_clock_id}/advance

Starts moving a test clock forward to frozen_time and answers at once with status advancing. A background worker walks every renewal, retry, reminder and period end in between with the same billing code as real time: real sandbox charges, real events. Test mode only. Use it to reach a renewal: advance to just past current_period_end, then poll the clock until status is ready.

Arguments: test_clock_id, frozen_time (Unix seconds: later than the current frozen_time, and at most two intervals of the shortest subscription on the clock ahead or 13 months, whichever is more; two years with none).

Returns the clock with status advancing.

Errors: test_mode_only, parameter_invalid (400); resource_missing (404); test_clock_advancing, test_clock_advance_limit (3 clocks of the platform are advancing; Retry-After), test_clock_internal_failure (create a new clock), test_clock_subscription_time_base (409: a subscription on the clock was created in another time base and would never renew; the message names it); billing_paused (503).

Next step: GET /v1/test_helpers/test_clocks/{id} until status is ready.

Parameters

NameDescription
test_clock_idpath, stringRequired

Request body

FieldDescription
frozen_timeintegerRequired

Unix seconds to advance to: later than the current frozen_time, and at most two intervals of the shortest subscription on the clock ahead (two years with none).

Responses

StatusDescriptionBody
404

No such resource for this platform (resource_missing), or another not_found code this operation's description lists.

ErrorResponse
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
503

No processor is available for this merchant or deployment (processor_not_connected, sandbox_processor_unconfigured, connect_unavailable).

ErrorResponse

Example

Shell
curl -X POST "https://api.zeropointapp.com/v1/test_helpers/test_clocks/{test_clock_id}/advance" \
  -H "Authorization: Bearer zp_test_..." \
  -H "Content-Type: application/json" \
  -d '{
    "frozen_time": <frozen_time>
  }'

Fail the next billing charges of a card

POST/v1/test_helpers/payment_methods/{payment_method_id}/fail_next_charges

Makes the next count billing charges of a saved card (a subscription's first payment, a renewal, a retry) end without reaching the processor. Test mode only; a live card is refused and never affected. Use it with a test clock to rehearse failed renewals: inject, advance past the renewal, watch the events.

Arguments: payment_method_id (pm_...), outcome (card_declined, duplicate_transaction, processor_unavailable, or a hard decline: lost_card, stolen_card, revocation_of_authorization, stop_payment_order, transaction_not_allowed), count (1 to 10, default 1).

Returns {object: test_helpers.charge_failure, payment_method, outcome, remaining}; a second call replaces the first. card_declined is a decline: the invoice goes past_due and is retried on schedule. A hard decline runs the real hard-decline path: the invoice goes past_due, requires_new_payment_method is true, and the card is blocked in the decline's scope (lost_card and stolen_card: the card at this merchant; revocation_of_authorization and stop_payment_order: this subscription; transaction_not_allowed: this invoice) until lift_card_block lifts it; another card is not blocked. duplicate_transaction is never counted as a decline and never retried automatically: the invoice is held. processor_unavailable leaves the outcome unknown: the payment stays pending and the invoice is held. End either hold with resolve_invoice_hold. Events and webhooks are the real ones. There is no success outcome: successes come from the card.

Errors: test_mode_only, parameter_invalid (400); resource_missing (404).

Next step: advance a test clock past the renewal.

Parameters

NameDescription
payment_method_idpath, stringRequired

Request body

FieldDescription
outcomestringRequired

card_declined, duplicate_transaction or processor_unavailable; or a hard decline: lost_card, stolen_card, revocation_of_authorization, stop_payment_order or transaction_not_allowed.

countinteger

How many billing charges fail, 1 to 10.

Default: 1

Responses

StatusDescriptionBody
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

Example

Shell
curl -X POST "https://api.zeropointapp.com/v1/test_helpers/payment_methods/{payment_method_id}/fail_next_charges" \
  -H "Authorization: Bearer zp_test_..." \
  -H "Content-Type: application/json" \
  -d '{
    "outcome": <outcome>
  }'

Lift the hard-decline blocks of a test card

POST/v1/test_helpers/payment_methods/{payment_method_id}/lift_card_block

Lifts every hard-decline block of this card number at its merchant, whoever saved it (every scope: card, subscription, invoice), so the card can be charged again. Test mode only; a live card's block is lifted only by the ZeroPoint operator. Use it after rehearsing a hard decline (fail_next_charges lost_card and the others), so the sandbox's approving test card is not refused in later tests.

Arguments: payment_method_id (pm_...).

Returns {object: test_helpers.card_block_lift, payment_method, lifted (scope, decline_code, subscription, invoice of each block lifted), lifted_count}; 0 when the card had no block. Each lift is recorded in the subscription's history. It does not pay anything: a past_due invoice stays past_due until its next retry, pay_invoice or the portal's Pay now.

Errors: test_mode_only (400); resource_missing (404).

Next step: pay the open invoice, or advance the clock to its next retry.

Parameters

NameDescription
payment_method_idpath, stringRequired

Responses

StatusDescriptionBody
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

Example

Shell
curl -X POST "https://api.zeropointapp.com/v1/test_helpers/payment_methods/{payment_method_id}/lift_card_block" \
  -H "Authorization: Bearer zp_test_..."

Resolve an injected or unverified hold

POST/v1/test_helpers/invoices/{invoice_id}/resolve_hold

Ends a test-mode hold: one fail_next_charges processor_unavailable made (at once: nothing was sent, so there is no 15 minute wait), or a test clock invoice's hold whose payment ended processor_unverified or duplicate_transaction while the processor shows no sale. Test mode only. Use it after an injected unknown outcome, to continue the rehearsal as if the processor had proven no sale.

Arguments: invoice_id (in_...).

Returns the invoice: the attempt is not collected, nothing is counted as a decline, and a renewal is retried on schedule. Never a sale. There is no outcome to choose: the attempt always ends not collected. To rehearse a decline, use fail_next_charges card_declined instead.

Errors: test_mode_only, invoice_hold_not_injected (400); resource_missing (404); invoice_payment_in_progress (409: Retry-After), invoice_hold_has_sale (409: the processor has the sale; advance the clock and it is recorded, or behind a duplicate screen only ZeroPoint rules: delete the clock), invoice_hold_hard_decline (409: the processor shows a hard decline; advance the clock and the hold phase records the decline and blocks the card), invoice_hold_unverified (409: the read-back failed; Retry-After).

Next step: advance the test clock again.

Parameters

NameDescription
invoice_idpath, stringRequired

Responses

StatusDescriptionBody
404

No such resource for this platform (resource_missing), or another not_found code this operation's description lists.

ErrorResponse
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

Shell
curl -X POST "https://api.zeropointapp.com/v1/test_helpers/invoices/{invoice_id}/resolve_hold" \
  -H "Authorization: Bearer zp_test_..."

Pay a checkout session with a test card

POST/v1/test_helpers/checkout/sessions/{session_id}/confirm

Pays an open checkout session (payment or subscription mode) with a test card, with no browser. Test mode only; nothing reaches the processor. Use it to script a checkout.

Arguments: session_id (cs_...), card (default tok_visa; or tok_chargeDeclined, tok_chargeDeclinedInsufficientFunds, tok_chargeDeclinedLostCard, tok_chargeDeclinedStolenCard), email (needed when the session names no customer email).

Returns the session, complete. Page rules apply (duplicate guard, attempt ceiling, holds); a decline leaves it open. Its processor_transaction_id starts zp_test_txn_. The key is the Idempotency-Key header (required).

Errors: idempotency_key_required (400). test_mode_only, parameter_invalid, parameter_missing (400); a decline code (402); resource_missing (404); checkout_session_not_open, checkout_attempts_exhausted, checkout_outcome_unknown, checkout_subscription_refused, checkout_amount_changed (409); a promotion code refusal.

Next step: GET /v1/checkout/sessions/{id}; the webhooks are the real ones.

Parameters

NameDescription
session_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

FieldDescription
cardstring

A test card token, default tok_visa.

Default: "tok_visa"

emailstring or null

The buyer's email, when the session names none.

Responses

StatusDescriptionBody
402

The payment itself failed (type payment_error); branch on code.

ErrorResponse
404

No such resource for this platform (resource_missing), or another not_found code this operation's description lists.

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

Example

Shell
curl -X POST "https://api.zeropointapp.com/v1/test_helpers/checkout/sessions/{session_id}/confirm" \
  -H "Authorization: Bearer zp_test_..." \
  -H "Idempotency-Key: <Idempotency-Key>" \
  -H "Content-Type: application/json" \
  -d '{}'