Module interactions
Detailed description of interaction between merchant and whitebit payout module for automatic operation
You can use the whitebit accept and whitebit payout module bundle to fully automate the exchange process using exchange liquidity.
Setting up auto-conversion
Let's look at the BTC-LTC direction as an example.
First you need to set up the BTC and LTC currencies.
Also on the ‘Payment Settings’ step for BTC currency set the payment acceptance ‘Automatic’ - choose ‘WhiteBit Exchanger’ from the list.
For LTC currency on the step ‘Payment settings’ set the payments ‘Automatic’ - choose ‘WhiteBit Exchanger’ from the list.
Set up the BTC-LTC direction.
At the step ‘Course type’ choose the exchange rate ‘Automatic’ - choose WhiteBIT parser from the list (having previously enabled it on the page ‘Parsers’ - ‘More courses’ in the block with whitebit parser - move the slider opposite ‘Enable’ to the active position) - BTC/LTC pair - ‘Add’ - save changes.
Also configure other parameters for the direction (commission, etc.). Be sure to check the correctness of the rate and commission settings (additionally check with whitebit commissions).
Next, you need to configure Whitebit Merchant and Whitebit payouts.
Please note that the currency to which the auto-conversion will be performed (‘Convert to’ in the Merchant settings) and the currency from which the payment will be made (‘Withdraw from’ in the payment module settings) must match to automate the process.
On the whitebit merchant settings page, specify the ‘USDT’ parameter for ‘Convert to’ - click ‘Save’. On the whitebit payment module settings page, specify the ‘USDT’ parameter for ‘Withdraw from’ - click ‘Save’.
Principle of operation
For example, a client wants to exchange 0.1 BTC for 40 LTC at a rate of 1:400 (including our commission)
We will accept BTC currency via whitebit (i.e. whitebit will generate a unique deposit address for a specific request. Our script will display this address to the client at the payment step of the application).
After the amount of BTC (specified in the request or more, i.e. ≥0.1 BTC) is received at the specified address in one payment - BTC will be converted to USDT (a market order will be placed to sell in the pair BTC/USDT). This will happen because we have set the ‘USDT’ parameter for ‘Convert to’. The whitebit merchant will change the status of the request to ‘For payment’ and in the comment to this action will indicate that the BTC deposit was successfully received.
Next, it is necessary to pay out LTC to the client. Depending on the ‘Auto Exchange’ settings (in the direction settings), the following may happen: a) If ‘Auto Exchange’ is off, then to start the payout module (to start paying out LTC to the address specified by the client), the operator will need to click the ‘ALLOW AUTO PAYOUT’ button in the admin panel in the details of the request. b) If ‘Auto PAYOUT’ is enabled, the payout will start automatically.
As soon as the payout module is launched - the payout process starts. On the exchange in the LTC/USDT pair, a market order to buy 40+ LTC is placed (‘+’ means that the LTC withdrawal fee will also be taken into account). This happens because we have set the ‘USDT’ parameter for ‘Withdraw from’ on the whitebit payout module settings page. That is, we have marked that it is necessary to get the required currency for withdrawal from the pair with USDT (buy the required currency for USDT).
A request for withdrawal of 40 LTC to the address specified by the client in the application is made.
After successful payment, the payout module changes the status of the request to ‘Completed’.
Your profit remains in the currency that the client received, in this example it is LTC, on your balance.
Please note that in Currency/USDT pairs we will use buy stock market order, i.e. we will place an order to buy the exact amount of Currency to be withdrawn by the client + commission for withdrawal of Currency. That is, in such pairs we consider that Currency is stock and USDT is money. For example, BTC (stock) / USDT (money).
However, in USDT/Currency pairs, a regular sell market order will be used. This means that a USDT sell order will be placed + 0.3% slippage on the glass (as we cannot know the exact average purchase price) + Currency withdrawal fee. For example, USDT (stock) / EUR (money).
Features of the module's behaviour
Deposit credited after the end of the application validity time
The request time is over - the status of the request is ‘Deleted’ and the request goes to the ‘Closed’ tab
whitebit transmits via API that payment has been received and the status of the request is set to ‘Withheld’, and the request goes to the ‘Frozen’ tab.
The operator checks that the funds have been received. And then decides what to do with the request. Either to make a refund or to recalculate the rate and, upon agreement with the client, to pay another amount or another option.
Depending on your choice, you change the status of the request and continue working.
If you know that it may take a long time for the currency to be credited, for example for destinations where the customer gives BTC, it is recommended to increase the application validity time.
Depositing a token on another network
There may be a situation where funds are received at the address for deposit, but the network is different from the one indicated in the application. In this case, the order will have the status ‘Withheld’ with the comment ‘BE CAREFUL! Check the deposit network for this order! (ARBITRUM != ERC20)’, for example.
Deposit of a smaller amount
Suppose the generated deposit address receives less than the amount specified in the order. In that case, the whitebit merchant will display the status ‘Payment Error’ with the comment ‘INCORRECT AMOUNT’ for the order.
Last updated