Quickstart
Ten minutes from credentials to a completed payment with a webhook in your hands. No configuration, no SDK, no code — just two requests.
Before you start
Your sandbox credentials. Our support team creates your sandbox shop and sends you three values. One shop covers both payin and payout — the same credentials work for everything in this guide.
| Value | Used as |
|---|---|
| Subscription key | Ocp-Apim-Subscription-Key header |
| Shop ID | Basic auth username |
| Secret key | Basic auth password |
If you do not have them yet, contact your PayRetailers representative to have your sandbox shop created.
A public endpoint to receive webhooks. Most outcomes in the sandbox arrive asynchronously, so without this you can only see half of what the sandbox does. For a first run, a hosted request bin is enough — no code required. Create one now and keep the tab open; you will need the URL in a moment.
Your endpoint must be publicly reachable. localhost, 127.0.0.1 and private IP ranges will not receive deliveries.
Step 1 — Send a payment that will be approved
Export your values, then send the request. Replace notificationUrl with your own.
export SUBSCRIPTION_KEY="..."
export SHOP_ID="..."
export SECRET_KEY="..."
export WEBHOOK_URL="https://your-endpoint.example/hooks"
curl -i -X POST "https://sandbox.payretailers.com/payments/v2/transactions" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Ocp-Apim-Subscription-Key: $SUBSCRIPTION_KEY" \
-u "$SHOP_ID:$SECRET_KEY" \
-d '{
"paymentMethodTagName": "PIX",
"amount": "100000",
"currency": "BRL",
"country": "BR",
"language": "PT",
"description": "quickstart-001",
"notificationUrl": "'"$WEBHOOK_URL"'",
"customer": {
"firstName": "Maria",
"lastName": "TestApproved",
"email": "[email protected]",
"country": "BR",
"personalId": "00000000000",
"city": "Sao Paulo",
"address": "Av Paulista 1000",
"zip": "01310100",
"phone": "5511987654321"
}
}'Two fields in that request are doing the work:
customer.email and customer.lastName select the scenario. The pair [email protected] / TestApproved means approve this payment.
paymentMethodTagName picks the payment method, using the same tag you will use in production. Everything else — amount, description, address — behaves exactly as it does in production.
Two details worth knowing about the rest of the body:
amount is in minor units. The 100000 above is 1,000.00 BRL, not 100,000. Same convention as production.
The sandbox does not validate document formats. personalId accepts any well-formed value, so you do not need a valid CPF, DNI or CURP to get started. Production does validate, so make sure your own code produces correctly formatted documents before you go live — that is one check the sandbox will not catch for you.
Step 2 — Read the synchronous response
You get 200, and a body containing:
{
"uid": "a1b2c3d4-...",
"status": "PENDING"
}PENDING is correct and expected. It is not an error and not a timeout: it means the payment has been created and the outcome is on its way. This mirrors production, where a PIX payment is confirmed a moment after it is initiated.
Save the uid.
Step 3 — Watch the webhook arrive
Look at your webhook receiver. About five seconds after the response, a POST lands with the final outcome:
{
"uid": "a1b2c3d4-...",
"type": "payment",
"status": "APPROVED",
"message": "",
"billing": { "currency": "BRL", "amount": 100000 }
}The webhook is the transaction object again, with the status updated — not an event envelope. Correlate on uid, the one you saved in Step 2.
That is the whole loop: request, acknowledgement, webhook. In production this is the sequence your integration has to handle, and it is the reason the sandbox exists.
If nothing arrives, check that your endpoint returned 200. When it does not, the sandbox retries on the same schedule production uses — which is also how you test your own retry handling later.
Step 4 — Or read it by polling
If you cannot receive webhooks yet, ask for the payment instead. Wait at least six seconds first: poll immediately and you will read the initial PENDING, not the outcome.
sleep 6
curl "https://sandbox.payretailers.com/payments/v2/transactions/$UID" \
-H "Accept: application/json" \
-H "Ocp-Apim-Subscription-Key: $SUBSCRIPTION_KEY" \
-u "$SHOP_ID:$SECRET_KEY"The status is now APPROVED.
Webhooks are the mechanism to build against — polling exists so you are not blocked before your receiver is ready.
Step 5 — Now make it fail
Change two values in the request from Step 1. Nothing else:
- "lastName": "TestApproved",
- "email": "[email protected]",
+ "lastName": "TestFailed",
+ "email": "[email protected]",Send it again. You still get 200 — but the body is different, and final:
{
"uid": "b2c3d4e5-...",
"status": "FAILED",
"message": "AMOUNT_INVALID"
}No PENDING, no webhook. The outcome is decided.
Two things to take from this. First, 200 does not mean the payment succeeded — read status on the body, and message when it is FAILED. Treating any 2xx as success is the most common integration mistake we see, and it is the one that ships orders that were never paid for.
Second, some outcomes are final in the response and others are acknowledged first and resolved by webhook. Your integration needs both paths. Each scenario declares which it is — see the Payin scenarios reference.
What you just proved
- Your credentials work.
- Your webhook receiver works, and you can read a real PayRetailers webhook payload.
- You can trigger a success and a failure on demand, by changing two strings.
Next
- How scenarios are selected — the mechanism in full, including how the matching behaves with case, whitespace, and accents.
- Receiving webhooks — signature verification, retries, and testing your own failure handling.
- Payin scenarios and Payout scenarios — all 18 outcomes with their trigger pairs.
- Production realism by country — read this before you build error handling for a specific market.
Updated about 8 hours ago