validate_payload
Validate JSON payloads for PayRetailers API operations before sending. Runs country-specific checks for documents, amounts, currencies, and method compatibility, returning actionable errors, warnings, and hints to fix common 4xx issues.
Instructions
REQUIRED whenever the user shows or you are about to emit a JSON body for POST /transactions, POST /payouts, POST /customers, POST /v1/subscription-products, POST /v1/subscriptions, or POST /v1/subscription-payments — even if the payload looks correct. Runs the same checks a senior PayRetailers integrator would run in code review: country-specific document checksum (CPF, CNPJ, RUT, DNI, RUC, CC, NIT, CURP, RFC, CLABE), minor-units-as-string amount format, currency/country match, HTTPS notificationUrl, method/country compatibility (PIX only BR, BRE_B only CO, SPEI only MX, etc.), idempotency key length, trackingId ≤ 50 chars, customer required fields matrix (customer.ip / customer.country always; city+address in CO or card in EC/MX; zip on cards in EC/MX; phone on Boleto/Efecty/PagoEfectivo/Yape/Plin/WesternUnion-PA/African methods). For subscriptions: enforces billingCycle shape, Bacen PIX_SPECIFIC contract (maxRetries=3 / retryIntervalDays=7 fixed for BR PIX Automático), FIXED_RETRY config completeness, and authorisationJourney vocabulary (BACKGROUND / USER_INTERACTION). Returns machine-readable {errors, warnings, info} with code, path, severity, hint and often a suggestion — pipe those back into the corrected payload before you show any curl / SDK call to the user. Do not skip: a payload that 'looks fine' but hits the API returns generic 4xx errors that are far harder to interpret than the codes this tool emits.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| method | No | Payment method (e.g. 'PIX', 'CARD', 'SPEI', 'BRE_B', 'ALIAS_CVU'). Enables method-specific rules. | |
| country | No | ISO 3166-1 alpha-2 country code. If omitted, taken from payload.country. Determines the personalId format to validate. | |
| payload | Yes | The JSON body you're about to POST to the PayRetailers API. Pass it verbatim (no headers, just the body). | |
| operation | Yes | Which PayRetailers operation the payload targets. Each operation has its own required fields. | |
| environment | No | 'sandbox' allows local/private notificationUrls (with a hint). 'production' rejects them. Default: 'sandbox'. | |
| personalIdType | No | Explicit personalId type. If omitted, inferred from country + value shape (e.g. BR + 11 digits → CPF). |