Concepts

How the sandbox works

What Monetize.Pay's sandbox answers with a test key, the test cards and tokens, how simulated terminals behave, and how to exercise every outcome.

With a zp_test_ key, Monetize.Pay answers for the Processor itself. No test request reaches the Processor and no money moves. Outcomes are chosen by test card number.

CapabilityIn the sandbox
MerchantsCreated instantly on Monetize.Pay's shared test business, processor_connected: true
Simulated terminalsFully local; you pick the outcome
Physical terminalsNot available in test mode: discovery, registration, and a payment on a physical terminal already registered answer 400 physical_terminal_unavailable. Use simulated terminals. To test on a real device, ask Monetize.Pay about a rehearsal account: a live merchant on a Processor test business, where no real money moves
Keyed payments, saved cardsAnswered by Monetize.Pay's sandbox. The test card decides the outcome (below)
Refunds, voidsLocal for simulated terminal payments. For keyed and saved-card payments: void before settlement, refund after (see "Settlement")
Webhooks, events, idempotencyIdentical to live

Simulated terminals

sim_behavior decides who answers:

  • manual (default): nothing happens until you call POST /v1/sandbox/terminals/{terminal_id}/simulate with approve, decline, cancel, or timeout.
  • auto_approve / auto_decline: the terminal answers on its own sim_delay_s seconds after the payment is created (0 to 30 s). Use a delay to test your "waiting for the customer" UI.

A simulated approval reports card visa ending 4242. Every outcome emits the same events a physical terminal would.

Keyed test cards

The sandbox decides by card number, never by amount. collect-config returns the same list as test_cards, each with its outcome. Type any future expiry as MM/YY with the slash, and any 3 or 4 digit security code.

CardCard idResult
4761 7390 0101 0010visa_approveApproved: state: succeeded, card_last4: 0010
4242 4242 4242 4242visa_approve_4242Approved: state: succeeded, card_last4: 4242
4111 1111 1111 1111visa_declineDeclined: state: failed, failure_code: card_declined, reason RISK DECLINED, no decline code
4000 0000 0000 0002decline_do_not_honorDeclined, card_declined (the Processor's code 05, do not honor)
4000 0000 0000 9995decline_insufficient_fundsDeclined, card_declined (code 51, insufficient funds)
4000 0000 0000 9987decline_lost_cardDeclined, card_declined (code 41, lost card, a hard decline)
4000 0000 0000 9979decline_stolen_cardDeclined, card_declined (code 43, stolen card, a hard decline)
4000 0000 0000 3220partial_approvalA partial approval: the payment fails with failure_code: partial_approval, Monetize.Pay voids the partial sale, and partial_approval.reversed is true
4000 0000 0000 3238partial_approval_void_failsA partial approval whose void is not confirmed at first: failure_code: partial_approval with partial_approval.reversed: false, and payment.needs_attention says the authorization may still be standing. For about 3 minutes after the sale every void of it answers unknown. Monetize.Pay's void retries run past that, then payment.reversed_late follows and partial_approval.reversed turns true
4000 0000 0000 0119unknown_then_capturedThe sale's answer is lost: the request answers 502 processor_unavailable. A retry with the same Idempotency-Key reads the sale back and the payment succeeds
4000 0000 0000 0127unknown_not_capturedThe sale's answer is lost and the sale never happened: 502 processor_unavailable, the payment stays pending until its pending window ends, then fails with failure_code: processor_unverified
4000 0000 0000 0135duplicate_screenEvery sale is refused by the duplicate screen: failure_code: duplicate_transaction, no processor_transaction_id
4000 0000 0000 0143tokenize_refusedA payment succeeds; saving the card is refused

A decline is still a 201 with the payment in failed, exactly as in live mode. A reused or expired nonce comes back failure_code: nonce_invalid. A test nonce lasts 15 minutes.

Every test sale and refund has a processor_transaction_id that starts zp_test_txn_, from a typed card or a token. Do not key anything on a sale's approval code or batch id.

Every saved test card reads expiry 12/2030, whatever expiry was typed.

Repeated sales are not screened in test mode: run as many approved sales in a row as you need, on the same card and amount. Only 4000 0000 0000 0135 (and tok_duplicate) gets the duplicate screen. The errors guide ("The Processor's duplicate screen") has the Processor's answer.

Settlement

A test sale settles at the next 7:15 PM Central. To settle a test merchant's sales now, call POST /v1/test_helpers/merchants/{merchant_id}/settle with an Idempotency-Key (MCP settle_test_payments). It answers {"settled": [payment ids]}, empty when nothing was waiting. Test mode only: a live key gets 400 test_mode_only.

Void before settlement, refund after. Before a keyed or saved-card sale settles, a refund answers 409 not_settled_use_void and nothing is reversed: void the payment instead, or settle it first. After it settles, a void answers 409 settled_use_refund: refund it instead.

Test card tokens (no browser)

In test mode you can skip the card form. Name a test card token where the form's one-time value goes. Monetize.Pay's sandbox answers it as the matching test card, and no card number is ever sent.

TokenCardEvery charge of it
tok_visaVisa 0010, expiry 12/2030approved
tok_chargeDeclinedVisa 1111declined, decline_code: do_not_honor (code 05; the typed 4111 1111 1111 1111 declines as RISK DECLINED instead)
tok_chargeDeclinedInsufficientFundsVisa 9995declined, insufficient_funds
tok_chargeDeclinedLostCardVisa 9987declined, lost_card (a hard decline: billing blocks the card for later invoices; a card on file payment only declines)
tok_chargeDeclinedStolenCardVisa 9979declined, stolen_card (a hard decline, as above)
tok_partialApprovalVisa 3220a partial approval, failed and voided, as card 4000 0000 0000 3220
tok_unknownOutcomeVisa 0127the answer is lost and nothing captured, as card 4000 0000 0000 0127
tok_duplicateVisa 0135refused by the duplicate screen, as card 4000 0000 0000 0135

Two places take them:

  • Save a card: POST /v1/payment_methods with "nonce": "tok_visa" (MCP save_payment_method). The card is saved with no charge and is then charged like any saved card: card on file payments, subscriptions, invoices, renewals on a test clock. A token is a reusable name, not a one-time value: save tok_visa for as many customers as you need, over REST or MCP. Each REST save makes a new card; over MCP (save_payment_method, which takes no key) each customer's first save makes its card and the same customer saving tok_visa again gets that card back.
  • Pay a hosted checkout session: POST /v1/test_helpers/checkout/sessions/{session_id}/confirm with {"card": "tok_visa", "email": "buyer@example.com"} and an Idempotency-Key (MCP confirm_checkout_session). It does what a buyer pressing Pay on the session's url does, in payment and subscription mode, under every rule of the page (the duplicate subscription guard, the attempt ceiling, holds). email is the address the buyer would type on the page: it is needed when the session names no email (no customer_email, and no customer with an email), else 400 parameter_missing; otherwise the session's email is used and the one sent is ignored. It answers the session with status: complete; a decline answers 402 with the payment's code and decline_code, and the session stays open for another card. When the merchant's duplicate subscription guard refuses the purchase it answers 409 checkout_subscription_refused, the page's own refusal ("We could not start this subscription. Nothing was charged..."): nothing is charged, the session's duplicate_refusal says why, and the session expires after 3 such refusals, or at once when the buyer completed the plan elsewhere (Hosted checkout).

What you get is what a typed card makes: the same payment, saved card, customer, subscription, invoice, events and webhooks, in the same order, so code written against the tokens works unchanged when a person types a card. A token's sales settle like any test sale ("Settlement" above), so settled_use_refund can be tested with tokens too. To make a later renewal of a tok_visa card fail, use fail_next_charges (test-billing-with-test-clocks).

Rules: test mode only (a live key gets 400 test_mode_only, and through MCP live_mode_unavailable; a test key does not see a live merchant's session or customer, 404 resource_missing; a test card token with a live merchant on the save is 400 test_mode_only). Only the eight names: any other tok_ value, and any card number, is 400 parameter_invalid. The MCP tool confirm_checkout_session takes all eight too. In test mode POST /v1/payments, the hosted page and the portal's card update do not take a token (400 parameter_invalid): save the card, then charge its pm_ id. In live mode a token is not special there: it is sent as an ordinary nonce and the Processor refuses it. Stripe's tok_chargeDeclined is refused when it is attached to a customer; here the card saves and every charge of it declines, as the typed card 4111 1111 1111 1111 does.

A test card token skips the card form, so a flow proven with tokens does not prove that your card form embed or the hosted page in a browser work. Before going live, run at least one payment in test mode with a typed card on the real form (4761 7390 0101 0010, the first_keyed_payment step). No test payment proves live processing, because test mode never reaches the Processor; going-live describes the live check.

Hosted card form

In test mode, form_url, save_form_url, the hosted checkout page and the portal's card update all show Monetize.Pay's test card form. It posts the same messages as the live form (zeropoint.ready, zeropoint.nonce, zeropoint.error, zeropoint.resize) and takes the same ones (zeropoint.tokenize, zeropoint.clear), so your embed code runs unchanged.

No card number leaves the browser. The form compares the typed number with the test card list in the browser and sends Monetize.Pay only the card's id, such as visa_approve. A number that is not a test card is not sent: the form says "This is a test form. Use one of the test cards listed." and posts zeropoint.error with code: card_invalid. Expiry and security code are checked for shape only and never sent. The form has no name or ZIP field and no bot check, so an automated browser can use it.

The page at sandbox_form_url (from collect-config) embeds the same form your checkout embeds (form_url in an iframe, a message listener for zeropoint.nonce), so you can get a nonce and try a charge before you have wired up a page of your own, and see the exact messages your page will receive.

Saved cards

Every save in test mode, and every charge of a saved card, is answered by Monetize.Pay's sandbox, whether the card came from a token or was typed into the save form (save_form_url). That holds on the shared test business and on a test merchant's own test business. The simulated terminal plays no part and never produces a saved card. Without a token, type a test card into save_form_url and your app saves the nonce; after that the card can be charged with no browser. 4000 0000 0000 0143 is the one test card that cannot be saved. Deleting a saved card calls no processor. Refunds and voids of a saved-card payment follow "Settlement" above. See save-a-card.

Test payments and saved cards made before Monetize.Pay answered test mode itself do not carry over. A read of such a payment returns it as it was (succeeded). A refund or a void of it answers 201 with a refund whose state is failed and failure_code is processor_rejected, and the payment stays succeeded. A saved test card from before then reads unusable (status_reason: application_changed) and can never be charged; its sealed token is erased after the usual retention window. Make new ones.

Daily limits and retention

The sandbox is shared, so test mode has ceilings that live mode does not. Each platform can create 1,000 test payments and 2,000 test events per UTC day, far above what integration testing needs, and all sandbox platforms together share a larger daily event allowance. Past any of them, a new test payment answers 409 with code sandbox_daily_limit_exceeded; past an event ceiling, POST /v1/webhooks/{id}/test and the webhook scorecard do too, and so does a new test refund or void (a retry of a refund already in progress is never refused). Honor Retry-After: the count resets at 00:00 UTC. Payments already in flight still finish and still emit their events.

Test events and their webhook deliveries are kept for 14 days and then deleted. After that GET /v1/events/{id} answers resource_missing for them and they no longer appear in GET /v1/events. Test payments and refunds are kept. Live events are never deleted.

Isolation

Every object is scoped to the platform that created it. Another platform's key gets resource_missing for your ids, even on Monetize.Pay's shared test business.