Skip to content
Documentation menu

Vouchereto API · v1

Environments & test credentials

Build and test everything in the sandbox, then switch keys. This page lists every test credential and test value you need.

Sandbox and live

There is one API host, https://api.vouchereto.com/v1. The key you send selects the mode, and every object is stamped with livemode. Test and live data are completely separate: a test key never sees live vouchers, redemptions, sessions or webhooks, and the other way round.

Sandbox versus live
SandboxLive
API keyvch_test_…vch_live_…
MoneyNone. Vouchers are created with POST /v1/sandbox/vouchersReal vouchers bought by real customers
WebhooksEndpoints you add in test modeEndpoints you add in live mode
SettlementsAlways empty (GET /v1/settlements returns data: [])Weekly payouts
Available whenYour merchant account is in sandbox, uat or liveYour merchant account is live

Account lifecycle

Merchant statuses
StatusWhat worksHow you move on
onboardingPortal only (company verification, KYB)We approve your business details
sandboxTest keys, test webhooks, sandbox vouchersYou build and tell us you are ready for acceptance tests
uatSame as sandbox; we run the go-live tests with youGo-live checklist
liveTest and live keys—
suspendedNothing: every key returns 403 MERCHANT_NOT_ACTIVEContact support

Your credentials

Credentials
CredentialFormatWhere to get itUsed for
API key (test)vch_test_<12>_<32>Portal → test mode → Developers → API keysBearer token. Its last _ segment is the signing secret.
API key (live)vch_live_<12>_<32>Same page in live mode, once your account is liveReal money
Webhook secretwhsec_…Portal → Developers → Webhooks, one per endpointVerifying our webhook signatures
  • Keys and webhook secrets are shown once. We store only a hash of the key (and an encrypted copy of the secret used to check signatures). Lost it? Create a new one and revoke the old one.
  • You can have several active keys per mode: create the new key, deploy it, then revoke the old one (zero-downtime rotation).
  • Up to 5 active webhook endpoints per mode. URLs must be public https:// addresses; private and internal addresses are rejected.
  • Never put a key in a browser, mobile app or repository. All API calls come from your server.
We do not publish a shared demo key: each merchant gets its own test key, so your sandbox data and webhooks are yours only. Request sandbox access.

Test vouchers

Create vouchers in any state with POST /v1/sandbox/vouchers (test keys only) or with the form on the portal's Developers page in test mode. Each call returns a fresh, valid code tied to your merchant. Codes are 16 characters, shown in groups of 4; dashes and spaces are ignored when you send them back.

Sandbox voucher states
stateReserve it and you getUse it to test
active201 reservedThe happy path: reserve → capture / cancel / let it expire
reserved409 VOUCHER_RESERVEDA code already locked by another redemption (locked for 30 min)
redeemed409 VOUCHER_ALREADY_REDEEMEDA code that was already used
expired422 VOUCHER_EXPIREDAn expired code
risk_hold404 VOUCHER_INVALIDA voucher held for fraud review (not usable until released)
void404 VOUCHER_INVALIDA refunded or cancelled voucher

Any code that does not exist returns 404 VOUCHER_INVALID, for example AAAA-BBBB-CCCC-DDDD. Repeated invalid codes trigger 429 TOO_MANY_INVALID_ATTEMPTS for that customer: use a different customer_ref to keep testing.

Fields: amount_minor 100–10,000,000 (default 5000), currency one of your account's currencies (default USD).

Test cards

In the hosted checkout's test card processor, any future expiry date and any CVC work. The card number decides the outcome:

Test cards
Card numberResult
4242 4242 4242 4242Approved
4000 0027 6000 3184Approved after a 3D Secure challenge
4000 0056 0000 0008Approved from a foreign card: the voucher is placed on a risk hold
4000 0000 0000 0002Declined
4000 0000 0000 9995Declined: insufficient funds
Never use a real card in the sandbox, and never use these numbers in live mode.

Local stack

Our full platform runs on your machine for offline development and CI (Postgres + the four apps). In the repository:

  1. Copy scripts/local/vp.test.env.example to scripts/local/vp.test.env, apply the migrations to a local Postgres, then start everything with scripts/local/start-all.sh (API on http://localhost:3003, hosted pages on http://localhost:3000/pay).
  2. Create a demo sandbox merchant, a test key and (optionally) a webhook endpoint. The credentials are printed once:
shell
DATABASE_URL=postgres://… API_SECRET_KEY=… \
  npx tsx scripts/sandbox/seed-demo-merchant.ts --webhook-url https://your-tunnel.example.com/hooks

Demo sandbox merchant ready (shown once, store it now):
  merchant_id     00000000-0000-4000-8000-00000000de30  (status sandbox, USD, checkout 5.00–500.00)
  api_key         vch_test_VAQ7bNGvAs8q_…
  webhook_url     https://your-tunnel.example.com/hooks
  webhook_secret  whsec_…
  1. Point your client at http://localhost:3003/v1. Locally, return_url and cancel_url may use http://localhost.

Postman

Import the collection and the Sandbox or Local environment, paste your test key into api_key and run the Quickstart folder. Requests are signed automatically.