Why BRL and USDC
The example uses Brazil because Pix settles instantly and the sandbox simulates it from start to finish. USDC is a dollar stablecoin, so your customer ends up holding dollars on-chain: think of a Brazilian client paying an invoice in reais while your customer keeps the proceeds in dollars. The same calls work in other corridors. Change the currency inaccounts, the rail, and sourceCurrency, for example MXN over SPEI. See Coverage for every currency, rail, and network.
Build it with your AI agent
Copy a prompt into Cursor, Claude Code, Codex, or any coding agent. Both read this page and the API spec before writing code.- Build it for me
- Step by step
The agent writes and runs the full script, then reports back.
Prompt
How it works
Before you start
- A sandbox API key. See Authentication.
- The sandbox base URL,
https://api-sandbox.lumx.io. See Environments.
1. Create a customer with a BRL account
Every pay-in belongs to a customer, and the BRL has to land in an account in that customer’s name. Create both in one call:accounts lists the currencies to open.
Request
Response (excerpt)
id. In the sandbox, the last digit of taxId sets the verification outcome, and a taxId that ends in 5 is approved. See Sandbox magic numbers.
2. Request the terms of service link
A customer has to accept the Lumx terms of service before verification can start.Request
Response
{} as the body. A POST without a body is rejected with 411. In the sandbox, the customer moves to APPROVED as soon as you request the link.
3. Wait for the BRL account to be active
The account can only receive money once it isACTIVE. After the customer is approved, it goes through REQUESTED and PROVISIONING to ACTIVE. In the sandbox this takes about a minute.
Request
Response (excerpt)
4. Create the on-ramp
The on-ramp says what you expect to receive and what to deliver: 1,000 BRL over Pix, converted to USDC on Polygon. Polygon is one of several supported networks, andblockchain picks it.
Request
Response
state.payment.brCodeis the Pix code the payer pays. In the sandbox, the payment is simulated and the on-ramp continues on its own.- The
Idempotency-Keyheader makes a retried request safe: the same key never creates a second on-ramp. See Idempotency. purposedeclares why the money moves.PERSONAL_ACCOUNTfits a customer funding their own wallet. See Purpose codes.
5. Wait for the USDC
The on-ramp moves throughTRADING and TRANSFERRING_STABLECOIN to SUCCESS. In the sandbox this takes about a minute.
Request
Response (excerpt)
baseTargetAmount is the USDC before fees, fees breaks them down, and finalTargetAmount is what reached the customer’s wallet. blockExplorerUrl opens the on-chain transfer.
The customer now holds USDC. Pay it out in the payout quickstart.
What changes in production
- Verification: your customer opens the terms of service link and completes KYC or KYB. See Individual Verification and Business Verification.
- The payment: the payer pays the
brCodefrom any Pix app. If nobody pays within the payment window, the on-ramp expires. See Transactions. - Status updates: subscribe to the
account.activeandonramp.*webhooks instead of polling. - Recurring deposits: to convert every deposit into an account without one call per payment, use an autoconversion rule.
Related resources
Payout: USDC to BRL
Pay the USDC out to a Pix key.
Autoconversion rules
Convert every deposit automatically, with no call per payment.
Collect BRL via Pix
The full pay-in guide, with locked rates and webhooks.
Coverage
Every currency, rail, and network you can swap in.