Skip to main content

Sandbox & Testing Guide

Test everything in the sandbox before production. This guide lists what to test, how, and what you should see.

The sandbox​

  • Uses its own base URL, merchant ID, keys, webhook secret and test cards (from your IXOPAY integration manager).
  • Card-network calls go to the networks' sandboxes, so no real money moves.
  • Sandbox and production use different keys. A mandate signed for one will not verify in the other.
  • Sessions last 300 seconds in both.

Quick health probes​

curl $PA/health # status HEALTHY, version
curl $PA/.well-known/ai-payments.json # supportedProtocols, endpoints
curl $PA/.well-known/jwks.json # public keys

Test plan​

A. Merchant checkout (TokenEx iFrame)​

#TestExpected
A1Lock a valid cart200, sessionId, 64-char invoiceHash, expiresIn: 300
A2Recompute the hash locallyEquals invoiceHash (examples/invoice-hash.js)
A3Create the iFrame from the configuration your server returns (new TokenEx.Iframe(...), load())The iFrame appears and the load event fires
A4Submit a sandbox test cardThe tokenize event returns a token, tokenHMAC, firstSix and lastFour
A5Verify tokenHMAC on your server, then POST /v1/checkout/completeSETTLEMENT_COMPLETE, invoiceHashMatch: true, zeroPanScrubbed: true
A6Complete with a wrong invoiceHash401 INVOICE_HASH_MISMATCH, session terminated
A7Enter a too-short card number and call tokenize()A validate event with isValid: false; no token is produced
A8Change the origin (or corrupt the Authentication Key) in the iFrame configurationThe iFrame does not load, and an error event reports an invalid Authentication Key
A8aAlter tokenHMAC before it reaches your serverYour server rejects the token and does not call /v1/checkout/complete
A9Wait over 300 s, then pay401 SESSION_EXPIRED_OR_NOT_FOUND; lock again
A9aLock a cart whose amount is not the sum of its lines400 INVALID_CART_STRUCTURE
A9bComplete without a sessionId400 MISSING_SESSION_ID
A9cComplete the same session (or token) twiceSecond call 409 INVALID_STATE_TRANSITION
A10Double-click PayYour server completes the order once (TokenEx iFrame checkout recipe)
A11Refund part of the payment, then more than the remainder200 with remainingRefundableCents, then 400 REFUND_AMOUNT_EXCEEDS_ORIGINAL_TRANSACTION
A12Refund an unknown transaction; fetch proof for an unknown transaction404 ORIGINAL_TRANSACTION_NOT_FOUND; 404 TRANSACTION_NOT_FOUND

B. Agent payments​

Ask your IXOPAY integration manager for sandbox signing keys and test mandates. If the Developer Console is enabled for you, its test-vector generator can produce signed sandbox payloads (Developer Console Guide). Run each scenario and confirm the exact result.

#ScenarioExpected
B1Valid Mastercard Agent Pay (AP4M) mandate200 SETTLEMENT_HANDOVER, transactionId tx_ap4m_…
B2Valid Visa TAP request with body.paymentContainer.invoiceHash200 SETTLEMENT_HANDOVER, transactionId tx_visa_…
B2aVisa TAP request with paymentContainer.invoiceHash missing or different401 INVOICE_HASH_MISMATCH
B2bReplay an identical AP4M mandate after it settled401 NONCE_REPLAY_DETECTED
B3Cart price changed after signing (PI2PI attempt)401 INVOICE_HASH_MISMATCH
B4Visa TAP request replayed unchangedSecond call 401 NONCE_REPLAY_DETECTED
B5Visa TAP expires in the past401 CRYPTOGRAM_EXPIRED
B6Corrupted Visa signature401 INVALID_SIGNATURE
B7Visa tag not agent-payer-auth401 INVALID_TAG_SCOPE
B8Cart currency differs from mandate401 CURRENCY_MISMATCH
B9Merchant not in allowedMerchantIds401 UNAUTHORIZED_MERCHANT
B10Item not in allowedSkus401 UNAUTHORIZED_SKU
B11Mandate past validUntil401 MANDATE_EXPIRED
B12Exceed a request-level cap, then test a signed AP4M cap independently401 BUDGET_CAP_EXCEEDED. The request-level pilot flow can include a challenge. Stop on a denial without one.
B13Complete step-up, then retry with the same sessionId200 SETTLEMENT_HANDOVER
B14Reuse a settled session on /v1/transact409 INVALID_STATE_TRANSITION
B14aPilot assertion uses a credential different from the challenge credential401 step-up failure.
B15AP4M layer2 minted from a different layer1401 INTEGRITY_VIOLATION

All 401 responses carry errorCategory (POLICY_DENIAL or AUTH_FAILURE); assert on it.

C. Webhooks​

#TestExpected
C1Complete a payment with webhookUrl setpayment.settled arrives
C2Verify the signature on the raw bodyPasses
C3Alter one character after signingYour receiver returns 401
C4Return 500 onceDelivery is retried (up to 3 attempts)
C5Receive the same eventId twiceProcessed once
C6Receive an event 10 minutes oldRejected by your timestamp check
C7Issue a refund with webhookUrlrefund.settled arrives

D. Failure and edge cases​

  • Network timeout: your client gives up after 5 s and does not blindly retry a payment.
  • In a gateway configured for key authentication, a missing or incorrect gateway key returns 401 UNAUTHORIZED_API_KEY. Test the provisioned HTTPS entry point.
  • Register a fixed public HTTPS webhook endpoint. Check that your deployment restricts egress to approved destinations.
  • iFrame origin mismatch: the iFrame refuses to load. Sign the exact origin of the page that shows it.
  • Browser origin not allowed: CORS refusal; call /v1/* from your server.
  • Clock drift: set your agent host to NTP; Visa created more than 300 s ahead gives CLOCK_SKEW_LIMIT_EXCEEDED.

Latency​

Core routing is designed to stay under 10 ms; the card-network round trip typically adds 150–300 ms. Transact responses include routingLatencyMs and an X-Gateway-Routing-Latency-Ms header so you can separate the two.

Evidence for sign-off​

For sign-off, share test-case IDs, UTC times, correlation IDs, transaction IDs, HTTP status, error codes and the expected versus observed outcome. Use a redacted summary for webhook and iFrame checks. Exclude request and response bodies, credentials, tokens, mandates, signatures, cryptograms and card data from logs and attachments.

Automating​

Use the OpenAPI file (openapi.yaml) or the Postman collection (ixopay-payment-agent.postman_collection.json) to generate a contract test suite, and run the table above in CI against the sandbox.