Deposit and withdraw with Pix
Deposit reais with Pix to receive digital reais or dollars, and withdraw them to the user's Pix key.
Deposit reais with Pix to receive digital reais (BRLA, BRZ) or digital dollars (USDC, USDT), and withdraw them to the user's Pix key. Both directions are a quote and an order. The user must have passed identity verification: every quote takes their identityId and the address of the account (walletAddress) that sends or receives the money.
Both directions are a quote and an order. The user must have passed KYC: every quote takes their identityId, and the wallet that sends or receives the stablecoins.
Deposit with Pix
1. Quote
const quote = await notus.fiat.createFiatQuote({
from: { currency: 'BRL', amount: '500' },
to: { currency: 'BRLA' },
chainId: 137,
identityId: '<identity-id>',
walletAddress,
})The quote shows what the user receives (to.amount), the fees and expiresAt. To fix the amount received instead, send to.amount and leave from.amount out.
Money lives on a network, like a bank system; chainId: 137 selects Polygon, where Pix deposits and withdrawals run. Here, amount: '500' is 500 reais and BRLA is digital reais ('BRZ' is also digital reais; 'USDC' and 'USDT' are digital dollars).
2. Create the order
const order = await notus.fiat.createFiatDepositOrder({ quoteId: quote.quoteId })order.depositInstructions holds the Pix charge: a copy-and-paste Pix key (pixKey) and the same charge as a QR code image (base64QrCode). Show them; the user pays from their bank app.
The digital reais or dollars arrive in the user's account a few moments after the payment clears.
The stablecoins arrive in the wallet a few moments after the payment clears.
Withdraw to a Pix key
1. Quote
const quote = await notus.fiat.createFiatQuote({
from: { currency: 'BRLA', amount: '200' },
to: { currency: 'BRL' },
chainId: 137,
identityId: '<identity-id>',
walletAddress,
})2. Create the order
const order = await notus.fiat.createFiatWithdrawalOrder({
quoteId: quote.quoteId,
paymentMethod: { type: 'PIX', pixKey: 'maria@example.com' },
})The Pix key must belong to the user who passed identity verification; a key in someone else's name is refused with PIX_KEY_NOT_HOLDER.
The Pix key must belong to the user who passed KYC; a key in someone else's name is refused with PIX_KEY_NOT_HOLDER.
To pay a company's QR code instead, see Pay a Pix QR code.
3. Approve and send
const { userOperationHash, authorization } = order.withdrawalInstructions
await notus.userOperations.executeUserOperation({
userOperationHash,
signature: await signer.signMessage({ message: { raw: userOperationHash } }),
})The user approves userOperationHash in your app with their key, and you submit that approval to executeUserOperation. When authorization is not null (on some accounts' first operation), the user approves its hash with their key and you send it as authorization too. Once the digital reais or dollars reach the payment provider, the reais are sent to the Pix key.
When authorization is not null (an EIP-7702 wallet's first operation), sign its hash and send it as authorization too. Once the stablecoins reach the provider, the reais are sent to the Pix key.
Follow the order
Listen for the ramp.deposit and ramp.withdraw notifications your server receives, or read the account's history (types ON_RAMP and OFF_RAMP).
Listen for the ramp.deposit and ramp.withdraw webhooks, or read the wallet's history (types ON_RAMP and OFF_RAMP).
An order goes PROCESSING, then COMPLETED; it can also be DELAYED (still processing after 30 minutes), IN_COMPLIANCE_REVIEW, FAILED or REFUNDED.
Your fee
Add your own fee to a withdrawal with fees: { percent, fixed } on the quote. It is shown in the quote and sent to your treasury.
Withdrawals under review
The payment provider can hold a Pix withdrawal for a compliance review (IN_COMPLIANCE_REVIEW). The money is in flight: the review ends in COMPLETED or FAILED.
While the provider still allows it, the account owner can give up on the withdrawal and get the money back:
GET /api/v1/admin/transactions/{transactionId}/actionstells which actions the provider accepts right now (CANCEL,REFUND_CRYPTO) and why not.POST /api/v1/admin/transactions/{transactionId}/cancelcancels the pending payout. Only a withdrawal inIN_COMPLIANCE_REVIEWcan be cancelled. The call returns before the status changes: the transaction becomesFAILEDshortly after.- Wait for the
ramp.withdrawnotification withFAILED(or foractionsto reporttransaction.status: FAILED), thenPOST /api/v1/admin/transactions/{transactionId}/refund-via-cryptosends the money back to the account that funded the withdrawal. Only aFAILEDwithdrawal can be refunded, so a409right after the cancel is retryable. The transaction becomesREFUNDEDonce the provider confirms the transfer.
Both POSTs need the account owner's consent: the body carries their approval (signature), created with their key for the message Cancel withdrawal {transactionId} and refund it to my wallet. The same signature serves both calls, and the money only ever goes back to the account that funded the transaction.
While the provider still allows it, the wallet owner can give up on the withdrawal and get the crypto back:
GET /api/v1/admin/transactions/{transactionId}/actionstells which actions the provider accepts right now (CANCEL,REFUND_CRYPTO) and why not.POST /api/v1/admin/transactions/{transactionId}/cancelcancels the pending payout. Only a withdrawal inIN_COMPLIANCE_REVIEWcan be cancelled. The call returns before the status changes: the transaction becomesFAILEDshortly after.- Wait for the
ramp.withdrawwebhook withFAILED(or foractionsto reporttransaction.status: FAILED), thenPOST /api/v1/admin/transactions/{transactionId}/refund-via-cryptosends the crypto back to the wallet that funded the withdrawal. Only aFAILEDwithdrawal can be refunded, so a409right after the cancel is retryable. The transaction becomesREFUNDEDonce the provider confirms the transfer.
Both POSTs need the wallet owner's consent: the body carries the signature (EIP-191 personal_sign by the wallet's signer) of the message Cancel withdrawal {transactionId} and refund it to my wallet. The same signature serves both calls, and the crypto only ever goes back to the wallet that funded the transaction.
{ "signature": "0x..." }The refund is two transfers: the amount that reached the provider, then the network fee estimate from the Notus fee account a few minutes later, with no second call.
The refund is two transfers: the amount that reached the provider, then the network fee estimate from the Notus fee wallet a few minutes later, with no second call.
A fee your project collected stays in your treasury and is yours to return. A 409 means nothing was sent: the provider no longer allows the action (the Pix already left), FEE_REFUND_UNAVAILABLE (retry later) or FEE_REFUND_BLOCKED (contact support). The history reports complianceReviewStartedAt on the withdrawal so you can tell the user how long the review has run.
Tokens, providers and errors
- Tokens. BRLA, USDC and USDT go through Pods; BRZ goes through Transfero. All on Polygon (
chainId: 137). Name a provider withprovider: 'PODS' | 'TRANSFERO', or let Notus pick from the token. - Provider approval. Each provider approves the user's KYC on its own. A quote for a provider that hasn't approved the user fails with
FIAT_PROVIDER_KYC_NOT_APPROVED; check Get Identity Providers. - One withdrawal at a time. A second withdrawal order while one is being created for the same identity returns
409 FIAT_WITHDRAWAL_ORDER_IN_PROGRESS. - Limits are reserved when the order is created. Read what is left with Get Identity Financial Limits.
- Other errors.
FIAT_QUOTE_NOT_FOUND,FIAT_QUOTE_EXPIRED(quote again),FIAT_ORDER_ALREADY_EXISTS. isEstimate: trueon a quote means the provider gave an indicative price; the final amount is set when the order settles.- The v1 fiat routes (
/fiat/deposit/quote,/fiat/withdraw/quote…) still answer for older integrations but are no longer documented.