Requirements to start the flow.
API key
Have an API key (Tutorial here).
Order flow
Some customers, especially those with smaller transaction sizes, may need to settle multiple orders at once in order to mitigate the operational overhead of paying for each transaction independently. To support this use case, we have created a suite of endpoints that allow users to pay for more than one buy order with a single bank transfer and more than one sell order with a single blockchain transaction. This guide will walk you through how to use the bulk crypto payment system for off ramps.1
Create bulk payment
Before you can start creating orders, you need to create a bulk payment that you will use to pay for multiple orders at once. This needs to be done each time you want to create a new set of orders that a single payment will cover.Assuming you want to sell USDC (Solana) in Mexico, then you would pass the following fields in the request body:Keep the
id from the response, since every order you want this payment to cover has to reference it. The bulk payment starts out in awaitingDepositAddress and has no depositAddress yet, which is fine because you do not need it until you are ready to pay.Create bulk crypto payment
2
Create a quote
Create a quote for the order. Assuming you would like to sell USDC (Solana) for MXN, you would provide the following fields in the body:Additionally, you need to specify the order size. You can either specify how much USDC (Solana) you would like to sell, like this (selling $150,000 USDC (Solana)):Or you can alternatively specify the amount of MXN you would like to receive, like this (receiving $1,000,000 MXN):Quotes expire. The
expiresAt field is the date and time after which the quote can no longer be used to create an order, and the window is short, so create the order in the next step promptly. Quote each order right before you create it rather than quoting them all up front.Go to create quote endpoint
Learn more about how quotes work
3
Create order
Once you are satisfied with a quote, you can create an order to book the trade. Assuming you would like to continue with the quote you created in the previous step to sell USDC (Solana) for MXN, then you would provide the following body:The
bulkCryptoPaymentId is what attaches the order to the bulk payment. An order created without it gets its own individual deposit address and has to be paid for on its own.Go to create order
4
Create more orders (optional)
Before settling this order, you can create other orders with the same
bulkCryptoPaymentId. By doing so, you will add them to the bulk crypto
payment and thus will only need to make one payment to settle multiple orders.
Each order you add increases the amount of the bulk crypto payment by its
amountCrypto, so only read that total once you have finished adding orders.5
Wait for the order to be ready to accept payment
After creating an order, it will update its
status field as it goes through its lifecycle. Once the status field is equal to awaitingPayment, the order is ready to receive payment. When all of the orders you added to the bulk crypto payment are in this status, you can get ready to send the payment.Go to check order status
6
Get payment instructions
Retrieve payment amount and the deposit address specified by the bulk payment you created earlier. Get the bulk crypto payment by its
id and read the amount field, which is the total across every order attached to it, and the depositAddress field.Get crypto bulk payment
7
Complete payment
Send the USDC (Solana) specified by the
amount field of the bulk crypto
payment to the address specified by the depositAddress field of the bulk
crypto payment, in a single transfer. Make sure to send the exact amount to
avoid delays. If the amount does not match, the bulk payment lands in
insufficientAmountReceived or excessAmountReceived and needs to be sorted
out with Rio before the orders can settle.8
Order is complete
Once Rio confirms your payment, the orders attached to the bulk payment settle and Rio sends the fiat to the bank account you specified on each one. You will be able to view the details of the payout by inspecting the
payoutsSent field of the order.Poll order status or subscribe to webhooks
Go to check order status
Go to register a webhook
Subscribe to
orders webhooks to get order updates pushed to you instead of
polling.Disclaimer: All technical documentation is subject to the terms and
conditions, which apply supplementarily and take precedence over the
documentation.