Brazil: wallet rewards (top-up bonus, cashback, loyalty miles)
Built: 2026-11-03. Written for operators in Brazil and whoever maintains the code.
Brazilian ride apps pay riders to keep money in the app. 99Pay paid a bonus on balance added by Pix, and cashback on rides paid from it. Uber and 99 let riders earn airline and bank miles on every trip. Riders in Brazil collect these from Livelo, Smiles, LATAM Pass, Esfera and Azul Fidelidade.
RideKit has three rules for this. Each is set per market and starts off.
| Rule | What it does | Brazil ships with |
|---|---|---|
| Top-up bonus | A top-up through a chosen method earns the share of the highest tier it reaches | Pix: R$50 → 3%, R$100 → 5%, R$200 → 7%; up to R$50 a month per rider |
| Ride cashback | A ride paid from the wallet earns this share of its fare back | 2%, up to R$30 a month per rider |
| Partner points | Every ride the rider pays earns partner points, for riders who gave their member number | Livelo, 1 point per R$1 |
These are a starting point. Set your own in Admin → Wallet rewards.
What the operator does (Admin → Wallet rewards)
- Rules.
- Switch rewards on. Only money paid in from that moment counts, so switching on never pays out for the past.
- Choose the top-up methods. "Pix (Asaas)" is how Pix top-ups arrive.
- Edit the tiers (up to 6) and the monthly bonus cap.
- Set the cashback share and its monthly cap.
- Switch partner points on, and choose the partner (or type another) and the rate, such as 1.5 points per R$1.
- The month. Bonus paid against the total topped up, cashback paid, points earned, riders rewarded, and member numbers linked.
- Accrual files. Accrual file (N points) downloads every point not yet
sent and marks it sent in one batch. Send the file to the partner as their
accrual file (arquivo de acúmulo). It is semicolon-separated with a BOM:
participante;pontos;data;transacao;valor;moeda. Each file is listed with who made it. It can be downloaded again, but its points are never sent twice. Making or downloading a file is audited, because it carries member numbers.
What the rider sees (rider app → Wallet)
- A Rewards card with:
- the top-up tiers by method, as chips;
- the cashback share;
- the partner and its rate;
- what this month has earned so far, in money and points.
- Quick top-up amounts that reach a tier show the bonus they earn, for example "R$ 5,00 bonus by Pix".
- Link a member number: a CPF with dots and dashes, or a card number. It
is kept as letters and digits and shown masked (
••••••5678). The rider can remove it at any time. - The bonus and cashback arrive in the wallet as "Cashback" lines.
How it settles
- A sweep runs every 30 seconds and looks back at most a week, and never before
the rules were switched on. It handles:
- top-ups credited through a chosen method;
- completed rides paid from the wallet (cashback);
- completed rides of riders with a member number (points).
- Which rides count:
- rides on a company account do not count, and neither do sponsored rides;
- a ride that cost nothing does not count;
- cash, Pix and card rides earn points, but only wallet rides earn cashback.
- Each source counts once. Every top-up or ride gets exactly one row in
wallet_rewards. A top-up below the first tier, or past the monthly cap, is recorded as skipped and never looked at again. - Bonus and cashback are promotional credit. They are booked as
cashback, from the promo budget (promo_liability). Each source has its own idempotency key, so a retry moves no money. Wallet transfers hold this credit back for 90 days like any promo credit, so a promotion cannot be passed around. - Points are owed to the partner, not paid by RideKit. They wait as
pendinguntil the operator makes the file.
Tested end to end
- API (
rewards-e2e.mjs, 28 checks):- off by default;
- a bad date refused, and a short member number refused;
- a CPF linked and masked;
- a real Pix top-up of R$100 through the Asaas mock earned R$5 within half a minute, so the wallet went up R$105, booked as cashback;
- a wallet ride earned 2% back and 13 Livelo points;
- a cash ride earned points but no cashback;
- the R$50 monthly cap: R$500 earned R$35, then the next R$500 only R$10;
- the rider's month totals;
- admin totals;
- the accrual file, its points marked sent, nothing left the second time, and the same file downloaded again.
- Admin in Chrome (
admin-rewards.mjs):- the Brazil tiers and Pix shown;
- switching on, raising a tier and choosing Smiles at 1.5 saved, with
sinceset to now; - a real ride earned 19 Smiles points;
- the file downloaded as
acumulo-smiles-….csvwith the member and points; - the file listed and the button disabled after.
- Rider app on the iOS simulator (Arabic, RTL):
- the card and the bonus badge on R$50;
- linking "sm 1234 5678" saved
SM12345678, shown masked; - the tier chips read correctly right-to-left.
For the code
| What | Where |
|---|---|
| Rules, tiers, caps, points, member numbers | backend/src/wallet/wallet-rewards.ts (+ spec) |
| Sweep, rider view and link, admin overview, accrual file | backend/src/wallet/wallet-rewards.service.ts |
| The credit (CASHBACK from promo liability) | backend/src/wallet/wallet.service.ts (creditReward) |
| Market section | walletRewards (markets/market.entity.ts, validated in markets.service.ts) |
| API | GET /wallet/rewards, PUT/DELETE /wallet/rewards/loyalty, GET /admin/wallet-rewards, POST /admin/wallet-rewards/loyalty-file, GET /admin/wallet-rewards/loyalty-file/:id |
| Storage | migration 179: wallet_rewards, loyalty_memberships, loyalty_batches |
| Admin | app/(dashboard)/wallet-rewards/page.tsx, 15 languages |
| Rider app | src/components/WalletRewards.tsx, src/lib/wallet-rewards.ts, wallet screen, 14 languages |
Check before launch. Points need a commercial agreement with the partner, who also sets the exact layout of the accrual file. Map the CSV to their layout if it differs. Bonus and cashback are a promotion: publish their rules (tiers, caps, how long the credit stays) in your terms, as the CDC requires for promotional offers. Have your accountant confirm how they are booked.