How scenarios are selected
The sandbox decides which outcome to produce from two fields in your request: the customer's email address and last name. Each published pair maps to exactly one scenario.
| Product | Fields that select the scenario |
|---|---|
| Payin | customer.email + customer.lastName |
| Payout | email + beneficiaryLastName |
There is no header to add, no query parameter, no wrapper object, and no change to your request structure. You send the request your production code already builds, with a different customer.
The pair is the key
Both fields are read together. The right email with the wrong last name does not match — and neither does the reverse. When a request matches no scenario, the sandbox says so rather than guessing: you get 200 with status: FAILED and message: SCENARIO_NOT_MATCHED.
[email protected] + TestApproved → APPROVED
[email protected] + Smith → no match
[email protected] + TestApproved → no matchCopy both values from the reference tables in Payin scenarios and Payout scenarios.
What does not affect the outcome
Everything else. These fields behave exactly as they do in production and have no influence on which scenario you get:
amountandcurrencycountrypaymentMethodTagName, andpayoutChannelfor payoutsdescriptionandpaymentReason— free text, use them for your own referencenotificationUrl- customer name, document, address, phone
- headers, including
Idempotency-Key
This is deliberate. It means you can test the same outcome across every market and payment method you operate in, without maintaining a separate set of scenario codes per country.
Idempotency-Key deserves a specific note: it behaves as it does in production — replaying a request with the same key returns the original result instead of creating a second payment — but it plays no part in choosing the scenario. Replaying an APPROVED request gives you the same payment back, not a second approval.
It also has a consequence you should know about: because country and paymentMethodTagName are not part of the decision, the sandbox will produce a scenario even where production could not. See Production realism by country.
Matching is forgiving
Before matching, the sandbox normalises both fields:
| Rule | Applies to |
|---|---|
| Case is ignored | Email and last name |
| Leading and trailing whitespace is trimmed | Email and last name |
| Accents and diacritics are removed | Last name |
So all of these select the same scenario:
[email protected] / TestApproved
[email protected] / TESTAPPROVED
[email protected] / TestApprovédAccents are stripped from the last name only, not from the email address. No published pair contains an accented email, so in practice you can copy the values as printed and vary the casing however your test fixtures happen to produce them.
Reading the naming convention
The pairs follow a pattern you will recognise after a few:
<scenario>@sandbox.payretailers.test / Test<Scenario>Useful for reading a log or a failing test at a glance — a request with identity.suspended@… is unmistakable in a stack trace. Do not infer pairs from the pattern, though: some scenario names do not map to their trigger word literally. The reference tables are authoritative.
The .test top-level domain is reserved by RFC 2606 and can never be registered, so these addresses cannot deliver mail anywhere. No real person receives anything because you ran a test.
Using this in an automated test suite
The shape that works well: keep one request template per market, and parameterise only the pair.
SCENARIOS = {
"approved": ("[email protected]", "TestApproved"),
"failed": ("[email protected]", "TestFailed"),
"cancelled": ("[email protected]", "TestCancelled"),
"pending": ("[email protected]", "TestPending"),
}
def payin_request(scenario, market):
email, last_name = SCENARIOS[scenario]
body = market.template()
body["customer"]["email"] = email
body["customer"]["lastName"] = last_name
return bodyBecause the pair is the only thing that varies, the same suite runs unchanged across every country you operate in — and your market templates stay focused on what actually differs between markets: currency, document format, address shape.
Two things to avoid asserting on: the customer email and last name are persisted on the transaction as sent, so do not assert that they match a real customer record; and do not assert on description, which the sandbox returns untouched.
Keep these values out of production
The email address and last name are real customer fields. In production they feed identity verification and anti-fraud checks. A sandbox pair that survives into a production configuration or a shared fixture creates a transaction with a customer who does not exist.
Before going live, grep your production configuration, seed data and CI environment variables for @sandbox.payretailers.test and for Test* last names. It is a two-minute check and the failure mode is a payment attributed to a customer who does not exist.
Next
- Receiving webhooks — the asynchronous half of most scenarios.
- Payin scenarios — all 12 pairs and their outcomes.
- Payout scenarios — all 6 pairs and their outcomes.
Updated about 8 hours ago