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.
| Capability | In the sandbox |
|---|---|
| Merchants | Created instantly on Monetize.Pay's shared test business, processor_connected: true |
| Simulated terminals | Fully local; you pick the outcome |
| Physical terminals | Not 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 cards | Answered by Monetize.Pay's sandbox. The test card decides the outcome (below) |
| Refunds, voids | Local for simulated terminal payments. For keyed and saved-card payments: void before settlement, refund after (see "Settlement") |
| Webhooks, events, idempotency | Identical to live |
Simulated terminals
sim_behavior decides who answers:
manual(default): nothing happens until you callPOST /v1/sandbox/terminals/{terminal_id}/simulatewithapprove,decline,cancel, ortimeout.auto_approve/auto_decline: the terminal answers on its ownsim_delay_sseconds 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.
| Card | Card id | Result |
|---|---|---|
4761 7390 0101 0010 | visa_approve | Approved: state: succeeded, card_last4: 0010 |
4242 4242 4242 4242 | visa_approve_4242 | Approved: state: succeeded, card_last4: 4242 |
4111 1111 1111 1111 | visa_decline | Declined: state: failed, failure_code: card_declined, reason RISK DECLINED, no decline code |
4000 0000 0000 0002 | decline_do_not_honor | Declined, card_declined (the Processor's code 05, do not honor) |
4000 0000 0000 9995 | decline_insufficient_funds | Declined, card_declined (code 51, insufficient funds) |
4000 0000 0000 9987 | decline_lost_card | Declined, card_declined (code 41, lost card, a hard decline) |
4000 0000 0000 9979 | decline_stolen_card | Declined, card_declined (code 43, stolen card, a hard decline) |
4000 0000 0000 3220 | partial_approval | A 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 3238 | partial_approval_void_fails | A 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 0119 | unknown_then_captured | The 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 0127 | unknown_not_captured | The 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 0135 | duplicate_screen | Every sale is refused by the duplicate screen: failure_code: duplicate_transaction, no processor_transaction_id |
4000 0000 0000 0143 | tokenize_refused | A 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.
| Token | Card | Every charge of it |
|---|---|---|
tok_visa | Visa 0010, expiry 12/2030 | approved |
tok_chargeDeclined | Visa 1111 | declined, decline_code: do_not_honor (code 05; the typed 4111 1111 1111 1111 declines as RISK DECLINED instead) |
tok_chargeDeclinedInsufficientFunds | Visa 9995 | declined, insufficient_funds |
tok_chargeDeclinedLostCard | Visa 9987 | declined, lost_card (a hard decline: billing blocks the card for later invoices; a card on file payment only declines) |
tok_chargeDeclinedStolenCard | Visa 9979 | declined, stolen_card (a hard decline, as above) |
tok_partialApproval | Visa 3220 | a partial approval, failed and voided, as card 4000 0000 0000 3220 |
tok_unknownOutcome | Visa 0127 | the answer is lost and nothing captured, as card 4000 0000 0000 0127 |
tok_duplicate | Visa 0135 | refused by the duplicate screen, as card 4000 0000 0000 0135 |
Two places take them:
- Save a card:
POST /v1/payment_methodswith"nonce": "tok_visa"(MCPsave_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: savetok_visafor 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 savingtok_visaagain gets that card back. - Pay a hosted checkout session:
POST /v1/test_helpers/checkout/sessions/{session_id}/confirmwith{"card": "tok_visa", "email": "buyer@example.com"}and anIdempotency-Key(MCPconfirm_checkout_session). It does what a buyer pressing Pay on the session'surldoes, in payment and subscription mode, under every rule of the page (the duplicate subscription guard, the attempt ceiling, holds).emailis the address the buyer would type on the page: it is needed when the session names no email (nocustomer_email, and nocustomerwith an email), else400 parameter_missing; otherwise the session's email is used and the one sent is ignored. It answers the session withstatus: complete; a decline answers402with the payment's code anddecline_code, and the session stays open for another card. When the merchant's duplicate subscription guard refuses the purchase it answers409 checkout_subscription_refused, the page's own refusal ("We could not start this subscription. Nothing was charged..."): nothing is charged, the session'sduplicate_refusalsays 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.