Create Withdrawal

Notes

Withdrawals send coins to a specified address or $PayByName tag over the coin networks and optionally send an IPN when complete.
If you are sending to another CoinPayments user and you have their $PayByName tag or merchant ID you can also use 'create_transfer' for faster sends that don't go over the coin networks when possible.

API POST Fields (in addition to the Main Fields described in the Introduction)

Field NameDescriptionRequired?
Create Withdrawal
cmdcreate_withdrawalYes
amountThe amount of the withdrawal in the currency below.Yes
add_tx_feeIf set to 1, add the coin TX fee to the withdrawal amount so the sender pays the TX fee instead of the receiver.No
currencyThe cryptocurrency to withdraw. (BTC, LTC, etc.)Yes
currency2Optional currency to use to to withdraw 'amount' worth of 'currency2' in 'currency' coin. This is for exchange rate calculation only and will not convert coins or change which currency is withdrawn.
For example, to withdraw 1.00 USD worth of BTC you would specify 'currency'='BTC', 'currency2'='USD', and 'amount'='1.00'
No
addressThe address to send the funds to, either this OR pbntag must be specified.
Remember: this must be an address in currency's network.
See Desc
pbntagThe $PayByName tag to send the withdrawal to, either this OR address must be specified. This will also override any destination tag specified.See Desc
domainAn Unstoppable Domain to send to. Setting a destination tag along with domain is undefined and should not be attempted.See Desc
dest_tagThe extra tag to use for the withdrawal for coins that need it (Destination Tag for Ripple, Payment ID for Monero, Message for XEM, etc.)No
ipn_urlURL for your IPN callbacks. If not set it will use the IPN URL in your Edit Settings page if you have one set.No
auto_confirmIf set to 1, withdrawal will complete without email confirmation.No
noteThis lets you set the note for the withdrawal.No
Create Mass Withdrawal
cmdcreate_mass_withdrawalYes
wdThe withdrawals are passed in an associative array called wd, each having the parameters from 'create_withdrawal' except auto_confirm which is always 1 in mass withdrawals. The key of each withdrawal is used to return the result (same as 'create_withdrawal' again.) The key can contain ONLY a-z, A-Z, and 0-9. Withdrawals with empty keys or containing other characters will be silently ignored.Yes

API Response

A successful call to the 'create_withdrawal' command will give you a result similar to this (JSON):
{
   "error":"ok",
   "result":{
      "id":"hex string",
      "status":0,
      "amount":1.00, // The amount withdrawn
   }
}
The result wil have the following fields:
  • id = The CoinPayments withdrawal ID. (This is not a coin network TX ID.)
  • status = 0 or 1. 0 = Withdrawal created, waiting for email confirmation. 1 = Withdrawal created with no email confirmation needed.

Create Mass Withdrawal Example

Example Call (using our code sample downloadable from this documentation area.)
$req = array(
        'wd[wd1][amount]' => 1.00,
        'wd[wd1][address]' => '1BitcoinAddress',
        'wd[wd1][currency]' => 'BTC',
        'wd[wd2][amount]' => 0.0001,
        'wd[wd2][address]' => '1BitcoinAddress',
        'wd[wd2][currency]' => 'BTC',
        'wd[wd3][amount]' => 0.0001,
        'wd[wd3][address]' => '1BitcoinAddress',
        'wd[wd3][currency]' => 'LTC',
        'wd[wd4][amount]' => 0.01,
        'wd[wd4][address]' => '1BitcoinAddress',
        'wd[wd4][currency]' => 'BTC',
);
$return = coinpayments_api_call('create_mass_withdrawal', $req);
print_r($return);
Example Response from the Call Above
The 1st three withdrawals have purposeful errors, the 4th has correct parameters:
(
    [error] => ok
    [result] => Array
        (
            [wd1] => Array
                (
                    [error] => That amount is larger than your balance!
                )

            [wd2] => Array
                (
                    [error] => Minimum withdrawal amount is 0.00020000 for this coin!
                )

            [wd3] => Array
                (
                    [error] => That is not a valid address for that coin!
                )

            [wd4] => Array
                (
                    [error] => ok
                    [id] => 5d2b60b70c2ee37b954c197f6907f7743286693163c388815dd18bb49188aa48
                    [status] => 1
                    [amount] => 0.01000000
                )

        )
)