API di scambio di criptovaluta - Indacoin

api

On this page, you can find methods that are used to enable your service with the cryptocurrency exchange features of Indacoin. For example, if you want to provide your customers with the option to pay via credit/debit cards, with our API you will be able to do that.

How to become a partner with Indacoin:

  • Select the type of the integration you are interested in.
  • Contact us to verify your company’s profile.
  • Receive the partnername and the secret for the integration.
  • Start API implementation.

For more information on the possible use of our API please email us to [email protected]

Types of integration

Light integration

You can forward users to URL without the creation of transaction by API, cur_from should be used from the list (USD, EURO, RUB) cur_to should be short_name of the coin.

Full list: https://indacoin.com/api/mobgetcurrenciesinfoi

General view of the query: https://indacoin.com/gw/payment_form?partner={YourPartnerName}&cur_from={CurrencyFrom}&cur_to={CurrencyTo}&amount={Amount}&address={WalletAddress}&user_id={UserID}

See example

Standard integration

  • The minimum transaction limit is 30 USD / EUR, and the maximum limit is 3000 USD / EUR
  • When a user makes a payment, you have to get ID-transaction for conducting this payment. To do so make a request exgw_createTransaction, where you choose amounts, currencies and wallet address.
  • To forward the client to the page of the payment, you need to use ID-transaction to create a URL.

In both types of the integration the customer goes to our platform to make the payment, to get verified and to receive the confirmation of the purchase.

After the client makes the payment, you get a callback about every change in the status of the transaction.

Possible statuses of transaction:

  • NotFound — the transaction hasn't been found;
  • Chargeback — chargeback has been filed;
  • Declined — we declined the payment, very likely because the card wasn't 3D secure;
  • Cancelled — the payment wasn’t made during some hours after the creation of the order;
  • Failed — general case when payment failed due to various reasons;
  • Draft — not paid yet or there were no tries to pay;
  • Paid — money has been withdrawn from the user's bank account;
  • Verification — the user started the verification;
  • FundsSent — the coins have been sent to the user's wallet but have not been received;
  • Finished — coins have been received successfully.

Also, you can check the status here:

https://indacoin.com/api/exgw_gettransactioninfo

https://indacoin.com/api/exgw_getTransactions

The purchase is considered to be successful when the status Finished is reached.

Methods:

Create transaction

POST /api/exgw_createTransaction
- create new transaction
Parameters in json:
user_id - string;
cur_in - string(eur, usd);
cur_out - string (btc,eth,usd,euro);
target_address - string
amount_in - decimal
Optional parameters:
success_url - url for redirecting user after successful payment, transaction_id in get parameter will be added to url;
fail_url - url for redirecting user after failed payment, transaction_id in get parameter will be added to url;
extra_info - json object with extra info ( will be returned back with all callbacks and transaction info);
tag - tag parameter if needed

Get price

(the method is valid only for crypto processing)
/api/GetCoinConvertAmount/{currencyFrom}/{currencyTo}/{amount:decimal}/{partner?}/{userId?}
- receive amount user will get
Parameters in GET:
Currency - string (usd, euro);
Amount - numeric_string;
PartnerName - string

Transaction history

POST /api/exgw_getTransactions
- receive info about last transactions
Parameters in json:
user_id - string;
tx_id - string;
status - tx_status;
created_at - int/timestamp;
hash - string (or null);
cur_in - string (usd, eur);
cur_out - string (btc, eth, usd, euro);
amount_in - numeric_string;
amount_out - numeric_string;
target_address - string;
limit - int;
offset - int
all parameters are optional

Transaction info

POST /api/exgw_gettransactioninfo
- receive transaction's info
Parameters in json:
transaction_id - numeric

Example of how to create the request on PHP and Node.js

$method = 'POST';
$target_url = 'https://indacoin.com/api/exgw_createTransaction';
$user_id = 'test_user_1';
$cur_in = 'usd';
$cur_out = 'btc';
$target_address = '1FeGgKxU5gjC562wZXd67VTVfwcSjpqv3Y';
$amount_in = '55';

$nonce = 1000000;
$partnername=;//ask for it
$string=$partnername."_".$nonce;
$secret= ; //ask for it
$sig = base64_encode(hash_hmac('sha256', $string, $secret,true));

$arr = array(
  'user_id' => $user_id,
  'cur_in' => $cur_in,
  'cur_out' => $cur_out,
  'target_address' => $target_address,
  'amount_in' => $amount_in
);

$data = json_encode($arr);

$options = array(
  'http' => array(
    'header' => "Content-Type: application/json\r\n"
    ."gw-partner: $partnername\r\n"
    ."gw-nonce: ".$nonce."\r\n"
    ."gw-sign: ".$sig."\r\n",
    'method' => $method,
    'content' => $data
  )
)

$context = stream_context_create($options);
$result = file_get_contents($target_url, false, $context);

echo "start";
const request = require('then-request');
const crypto = require('crypto');

const method = 'POST';
const target_url = 'https://indacoin.com/api/exgw_createTransaction';
const user_id = 'test_user_1';
const cur_in = 'usd';
const cur_out = 'btc';
const target_address = '1FeGgKxU5gjC562wZXd67VTVfwcSjpqv3Y';
const amount_in = '55';

const nonce = 1000000;
const partnername = ''; // ask for it
const string = partnername + '_' + nonce;
const secret = ''; // ask for it
const sig = crypto.createHmac('sha256', secret).update(string).digest('base64');

const arr = {
  'user_id': user_id,
  'cur_in': cur_in,
  'cur_out': cur_out,
  'target_address': target_address,
  'amount_in': amount_in
};

request(method, target_url, {
  json: arr,
  headers: {
    "Content-Type": "application/json",
    "gw-partner": partnername,
    "gw-nonce": nonce,
    "gw-sign": sig
  }
}).done((res) => {
  console.log(res.getBody('utf-8'));
});

console.log('start');


Example of how to create the request for URL

To create the request you need to get transaction ID from the previous request.

$transaction_id =; //get it from previous method
$string=$partnername."_".$transaction_id;
$secret="secret";
$sig = base64_encode(base64_encode(hash_hmac('sha256', $string, $secret,true)));
const crypto = require('crypto');

const transaction_id =; //get it from previous method
const string = partnername + '_' + transaction_id;
const secret = "secret";
const sig = Buffer.from(crypto.createHmac('sha256', secret).update(string).digest('base64')).toString('base64');

https://indacoin.com/gw/payment_form?transaction_id=1154&partner=indacoin&cnfhash=Ny8zcXVWbCs5MVpGRFFXem44NW h5SE9xTitlajkydFpDTXhDOVMrOFdOOD0=

Callback section

To verify callback we will send you headers gw-sign, gw-nonce where nonce will be random number and sign will be

base64_encode(base64_encode(hash_hmac(
  'sha256',
  partnerName + '_' +
  trInfo.userId + '_' +
  nonce + '_' +
  trInfo.transactionId,
  $secret,
  true
)));
Buffer.from(Buffer.from(crypto.createHmac(
  'sha256',
  secret).update(
    partnerName + '_' +
    trInfo.userId + '_' +
    nonce + '_' +
    trInfo.transactionId
).digest('hex')).toString('base64')).toString('base64');

Example:

{
  "userId": "[email protected]"
  ,"transactionId": 453668
  ,"requestId": -1
  ,"status": "Draft"
  ,"createdAt": "2018-05-11T11:40:03.75Z"
  ,"confirmedAt": "0001-01-01T00:00:00Z"
  ,"finishedAt": "0001-01-01T00:00:00Z"
  ,"blockchainHash": ""
  ,"link": "/notify.aspx?confirm_code=&request_id=-1"
  ,"curIn": "USD"
  ,"curOut": "BTC"
  ,"amountIn": 112.0
  ,"amountOut": 0.010335
  ,"realAmountOut": 0.0
  ,"targetAddress": "{
    "btcAddress":
    "mtULnCAMY3iUiZmxGUqARhKuoiZQbFT36H"
  }"
  ,"reason": ""
  ,"extra_info": {}
  ,"couponCode": ""
}