The Coin2Send API provides a simple interface where merchants can use to programmatically interact with their account.

Transfer

The transfer method can be used to transfer funds to other user account.

URL: https://www.coin2send.com/api/v1/transfer
Method: POST

  • $api_id The API ID of your merchant account.
  • $api_key The API Key of your merchant account.
  • $amount The amount to transfer
  • $currency The currency of transaction (BTC or USD, in case your use USD, the amount will be converted from your BTC wallet)
  • $wallet The coin code of your wallet, ex: BTC
  • $to_account The username of receiver account
  • $memo Comment about this transacction

Response: 200 OK, application/json

{
"status": "success",
"transaction_id": "SJDCIXYSJSCMNXS"
}

PHP Example

<?php

$post_data = array(
    'api_id' => 'SDJ324HJJCKSDBJKBDSJXC',
    'api_key' => 'SDOJ3RK3JRS8CUS98CYSX89CHURHJKSCBKXCBKSBDFJKSBC',
    'amount' => '0.0005',
    'currency' => 'BTC',
    'wallet' => 'BTC',
    'to_account' => 'demo',
    'memo' => 'Withdrawal request #152'
);

$handle = curl_init();
curl_setopt_array($handle, array(
CURLOPT_URL => 'https://www.coin2send.com/api/v1/transfer',
CURLOPT_POSTFIELDS => $post_data,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false
));
$response = curl_exec($handle);
curl_close($handle);

 

[ Back to top ]

 

Create Deposit

The Create Deposit method is for making your own custom checkout page, so buyers don't have to leave your page.

URL: https://www.coin2send.com/api/v1/deposit
Method: POST

  • $api_id The API ID of your merchant account.
  • $api_key The API Key of your merchant account
  • $amount The amount to deposit
  • $currency The currency of deposit (BTC or USD, in case your use USD, the amount will be converted to the currency wallet)
  • $wallet The coin code of your wallet where you will receive the deposit, ex: BTC
  • $comment Any comment about this deposit, it will displayed in your deposit history.
  • $status_url (optional) URL to notify when deposit is completed.

Response: 200 OK, application/json

{
"status": "success",
"transaction_id": "35CBA167617AF7",
"address": "35tXX7q1Awp1rLx6YN7a2CiYVhRqzUWjg9",
"amount": "0.01884429",
"timeout":"1555710118"
}

PHP Example

<?php

$post_data = array(
    'api_id' => 'SDJ324HJJCKSDBJKBDSJXC',
    'api_key' => 'SDOJ3RK3JRS8CUS98CYSX89CHURHJKSCBKXCBKSBDFJKSBC',
    'currency' => 'USD',
    'amount' => '100',
    'wallet' => 'BTC',
    'comment' => 'Deposit by user demo',
    'status_url' => 'http://www.mysite.com/notify.php?invoice=54'
);

$handle = curl_init();
curl_setopt_array($handle, array(
CURLOPT_URL => 'https://www.coin2send.com/api/v1/deposit',
CURLOPT_POSTFIELDS => $post_data,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false
));
$response = curl_exec($handle);
curl_close($handle);

 

Example of callback (notify.php)

You will receive the notification of payment when deposit is credited to your account, it means with 3 or more confirmations.

<?php
$username = 'coin2send'; //Your Coin2Send username
$api_id = 'SDJ324HJJCKSDBJKBDSJXC'; //Your API ID
$api_key = 'SDOJ3RK3JRS8CUS98CYSX89CHURHJKSCBKXCBKSBDFJKSBC'; //Your API Key

$merchant = $_POST['merchant']; //Your Coin2Send username
$transaction_id = $_POST['transaction_id']; //Unique ID of Coin2Send deposit
$currency = $_POST['currency']; //The original currency of the transaction.
$amount = $_POST['amount'];  //Amount of the original transaction
$wallet = $_POST['wallet']; //The currency of merchant wallet.
$amount2 = $_POST['amount2']; //Amount added in merchant wallet without fees
$address = $_POST['address']; //Currency address where deposit was made
$txid = $_POST['txid']; //The TX ID of the payment to the merchant.
$hash = $_POST['hash']; //Data required to validate the deposit


if($hash  == md5($username.':'.$transaction_id.':'.$amount.':'.$currency.':'.$wallet.':'.$api_id.':'.$api_key)){
  //Deposit is valid
}else{
  //Deposit is invalid
}

 

[ Back to top ]

 

Create withdrawal

Send bitcoin from your wallet to another bitcoin address. All transactions include a 0.00005 BTC miners fee.

URL: https://www.coin2send.com/api/v1/withdraw
Method: POST

  • $api_id The API ID of your merchant account.
  • $api_key The API Key of your merchant account
  • $address Recipient Bitcoin address
  • $currency The currency of your withdrawal request (BTC or USD, in case your use USD, the amount will be converted to the currency wallet)
  • $amount The amount to send
  • $wallet The coin code of your wallet where the funds will be taken. Ex: BTC
  • $comment Any comment about this request.

Response: 200 OK, application/json

{
"status": "success",
"transaction_id": "SJKSEH44578CV734"
}

PHP Example

<?php

$post_data = array(
    'api_id' => 'SDJ324HJJCKSDBJKBDSJXC',
    'api_key' => 'SDOJ3RK3JRS8CUS98CYSX89CHURHJKSCBKXCBKSBDFJKSBC',
    'address' => '1B76fnreixsdOSDhsjcsgsrfgxgfxkZ8Q'
    'currency' => 'USD',
    'amount' => '50',
    'wallet' => 'BTC',
    'comment' => 'Payment to user demo'
);

$handle = curl_init();
curl_setopt_array($handle, array(
CURLOPT_URL => 'https://www.coin2send.com/api/v1/withdraw',
CURLOPT_POSTFIELDS => $post_data,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false
));
$response = curl_exec($handle);
curl_close($handle);

 

[ Back to top ]

 

Get Balance

The Get Balance method can be used to get your balance amount of your selected wallet.

URL: https://www.coin2send.com/api/v1/balance
Method: POST

  • $api_id The API ID of your merchant account.
  • $api_key The API Key of your merchant account
  • $wallet The coin code of your wallet, ex: BTC

Response: 200 OK, application/json

{
"status": "success",
"balance": "0.018521000"
}

PHP Example

<?php

$post_data = array(
    'api_id' => 'SDJ324HJJCKSDBJKBDSJXC',
    'api_key' => 'SDOJ3RK3JRS8CUS98CYSX89CHURHJKSCBKXCBKSBDFJKSBC',
    'wallet' => 'BTC',
);

$handle = curl_init();
curl_setopt_array($handle, array(
CURLOPT_URL => 'https://www.coin2send.com/api/v1/balance',
CURLOPT_POSTFIELDS => $post_data,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false
));
$response = curl_exec($handle);
curl_close($handle);

 

[ Back to top ]