Send assets
Learn how to integrate 0xpay API with your web-platform
Sending transactions through the API is not as different from the fiat money transfer flow. Users need to specify the recipients address and the amount of assets to send.
If you need to automate your merchant withdrawals you can simply make a request to the Public API. Later, 0xpay will notify you about status updates on your withdrawal.
Detailed Withdrawal Workflow
Option 1: Withdrawal only
For example, a user on your platform has deposited 0.5 ETH to his balance and now wants to withdraw them.
User goes to "Withdrawal/Send funds" option of your website and specifies withdrawal details (currency, amount, recipients' wallet address).
When user hits "Send" button, your platform makes a request to 0xpay processing.
0xpay creates an outgoing transaction to the user's wallet address and provides notification callbacks to your platform, informing about the status of withdrawal.
When the transaction is confirmed, you'll receive a notification with "Confirmed" status.
At this point, you can deduct ETH from the user's balance.
Option 2: Exchange + Withdrawal
Let's detail a case where a user has 0.5 ETH on your platform, but he wants to withdraw BTC to his wallet. You can use Exchange + Withdrawal methods to eliminate the hustle with balance management and volatile exchange rates.
This operation will require at least two subsequent request to 0xpay API, as you'll need to get the estimate for exchange before sending assets.
User goes to "Withdrawal/Send funds" option of your website and inputs his BTC wallet address and amount to withdraw.
When user hits "Send/Calculate" button, your platform makes the first request to 0xpay API, in order to estimate the exchange + withdrawal operation.
0xpay calculates exchange parameters and responds with a notification to your platform. You can display these parameters (exchange rate, pair, fees) on the platform for the users to acknowledge.
When user presses the "Send" button to send his withdrawal, your platform makes a second request to 0xpay API.
0xpay makes an exchange operation and creates an outgoing transaction to the user's wallet address. After this, 0xpay provides notification callbacks to your platform, informing about the status of withdrawal.
When the transaction is confirmed, you'll receive a notification with "Confirmed" status.
At this point, you can deduct ETH from the user's balance.
Last updated