API

The use of API won't make any interaction with your account wallet for Hosted Checkout.

GET Generate a wallet

3 credits

/api/v1/{cryptocurrency}/wallet
Request Headers
x-api-key Your API Key
Request
Query Parameters
mnemonic
optional
Mnemonic to use for generation of extended public and private keys.
Example
<?php

$curl = curl_init();

curl_setopt_array($curl, [
	CURLOPT_HTTPHEADER => [
		"x-api-key: Your_API_Key"
	],
	CURLOPT_URL => "https://coinmkr.com/api/v1/BTC/wallet",
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_CUSTOMREQUEST => "GET",
]);

$response = curl_exec($curl);
$error = curl_error($curl);

curl_close($curl);

if ($error) {
	echo "cURL Error #:" . $error;
} else {
	echo $response;
}
Status code: 200
{

    "status": "success",
    "mnemonic": "card plunge more media lawn hurry tank spirit income embody sausage immune seat despair unhappy eye sweet work used exhibit peanut move bacon trust",
    "xpub": "xpub6Ed6J9BNN1y89rVpf6CTc4AJsKPJcr3fZoPCQajG1KD6D3ZwAqfwohkiUfDLZ93sPwa2ewxnVdmoXZJfedseKrrJAdgxvLzifi9yb3NG69F"

}

GET Generate deposit address from xPub

3 credits

/api/v1/{cryptocurrency}/address
Request Headers
x-api-key Your API Key
Request
Path Parameters
xpub
required
Extended public key of a wallet.
index
required
Derivation index of the desired address to be generated.
number >= 0
Example
<?php

$curl = curl_init();

curl_setopt_array($curl, [
	CURLOPT_HTTPHEADER => [
		"x-api-key: Your_API_Key"
	],
	CURLOPT_URL => "https://coinmkr.com/api/v1/BTC/address?xpub=YOUR_XPUB&index=0",
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_CUSTOMREQUEST => "GET",
]);

$response = curl_exec($curl);
$error = curl_error($curl);

curl_close($curl);

if ($error) {
	echo "cURL Error #:" . $error;
} else {
	echo $response;
}
Status code: 200
{

    "status": "success",
    "address": "bc1qk7gkj4lshzxp0p46u3ltmljjkhs806vp8nvy5z"

}

POST Generate private key for an address

3 credits

/api/v1/{cryptocurrency}/key
Request Headers
x-api-key Your API Key
Request
Request Body schema: application/json
mnemonic
required
Mnemonic to generate private key from.
index
required
Derivation index of private key to generate.
number >= 0
Example
<?php

$curl = curl_init();

$payload = array(
	"mnemonic" => "card plunge more media lawn hurry tank spirit income embody sausage immune seat despair unhappy eye sweet work used exhibit peanut move bacon trust", 
	"index" => 0
);

curl_setopt_array($curl, [
	CURLOPT_HTTPHEADER => [
		"Content-Type: application/json",
		"x-api-key: Your_API_Key"
	],
	CURLOPT_POSTFIELDS => json_encode($payload),
	CURLOPT_URL => "https://coinmkr.com/api/v1/BTC/key",
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_CUSTOMREQUEST => "POST",
]);

$response = curl_exec($curl);
$error = curl_error($curl);

curl_close($curl);

if ($error) {
	echo "cURL Error #:" . $error;
} else {
	echo $response;
}
Status code: 200
{

    "status": "success",
    "private_key": "Kzixyi351r5GMXDaFANRRpRYt5eBm16guju2UcwzoT15uS98uvdX"

}

Webhook Subscriptions

Subscriptions allow users to receive notifications of incoming transactions.

POST Create a subscription

30 credits / day / address

/api/v1/{cryptocurrency}/subscription
Request Headers
x-api-key Your API Key
Request
Request Body schema: application/json
address
required
The address to watch incoming transactions.
url
required
Your webhook URL where you will receive the notifications.
Example
<?php

$curl = curl_init();

$payload = array(
	"address" => "bc1qk7gkj4lshzxp0p46u3ltmljjkhs806vp8nvy5z", 
	"url" => "https://website.com/webhook"
);

curl_setopt_array($curl, [
	CURLOPT_HTTPHEADER => [
		"Content-Type: application/json",
		"x-api-key: Your_API_Key"
	],
	CURLOPT_POSTFIELDS => json_encode($payload),
	CURLOPT_URL => "https://coinmkr.com/api/v1/BTC/subscription",
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_CUSTOMREQUEST => "POST",
]);

$response = curl_exec($curl);
$error = curl_error($curl);

curl_close($curl);

if ($error) {
	echo "cURL Error #:" . $error;
} else {
	echo $response;
}
Status code: 200
{

    "status": "success",
    "id": "c0e48e4cae927"

}

Postback notification

10 credits for each fired web hook

HTTP POST JSON notifications for any incoming transaction at a specified address. This notification applies to transactions in the native blockchain currency or with any type of blockchain tokens.

Webhook is invoked when a transaction is added to a block or when it appears in the mempool (ETH and BSC).

The request body of the POST request is a JSON object with the following structure:

{

    "address": "bc1q7500usac9ncc809rpv7nukc464xf47w5t6zzfp",
    "txId": "69507cf8e642a3d84da135f83b8763fac91c3ecf0c8593903418d2c7dbc5a35b",
    "asset": "BTC",
    "blockchain": "BTC",
    "amount": "0.00267722",
    "webhook_id": "c0e48e4cae927"

}

We use your API Key as the HMAC shared secret key to generate an HMAC signature of the raw JSON data. The HMAC signature is sent as a HTTP header called COINMKR_SIGNATURE.

Example:

<?php
$api_key = "Your_API_Key";

$raw_post_data = file_get_contents('php://input');

$signature = hash_hmac("sha256", $raw_post_data, $api_key);

if($signature != $_SERVER['HTTP_COINMKR_SIGNATURE']){
	die('Invalid signature');
}

$json = json_decode($raw_post_data);

$address = $json->address;
$txId = $json->txId;
$asset = $json->asset;
$blockchain = $json->blockchain;
$amount = $json->amount;
$webhook_id = $json->webhook_id;

DELETE Cancel existing subscription

2 credits

/api/v1/subscription/{webhook_id}
Request Headers
x-api-key Your API Key
Request
Path Parameters
webhook_id
required
Webhook ID
Example: c0e48e4cae927
Example
<?php

$curl = curl_init();

$webhook_id = 'c0e48e4cae927';

curl_setopt_array($curl, [
	CURLOPT_HTTPHEADER => [
		"x-api-key: Your_API_Key"
	],
	CURLOPT_URL => "https://coinmkr.com/api/v1/subscription/".$webhook_id,
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_CUSTOMREQUEST => "DELETE",
]);

$response = curl_exec($curl);
$error = curl_error($curl);

curl_close($curl);

if ($error) {
	echo "cURL Error #:" . $error;
} else {
	echo $response;
}
Status code: 200
{

    "status": "success"

}

GET List all active subscriptions

3 credits

/api/v1/subscriptions
Request Headers
x-api-key Your API Key
Request
Query Parameters
p Number of page to display
Example: p=2
Example
<?php

$curl = curl_init();

curl_setopt_array($curl, [
	CURLOPT_HTTPHEADER => [
		"x-api-key: Your_API_Key"
	],
	CURLOPT_URL => "https://coinmkr.com/api/v1/subscriptions",
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_CUSTOMREQUEST => "GET",
]);

$response = curl_exec($curl);
$error = curl_error($curl);

curl_close($curl);

if ($error) {
	echo "cURL Error #:" . $error;
} else {
	echo $response;
}
Status code: 200
{

    "status": "success",
    "page": 1,
    "total_pages": 1
    "total": 1
    "data": [
        {
            "id": "13d9d93d78a69",
            "address": "bc1qk7gkj4lshzxp0p46u3ltmljjkhs806vp8nvy5z",
            "asset": "BTC",
            "url": "https://website.com/webhook"
        }
    ]
}

Quotes and Conversion

Get latest prices of supported cryptocurrencies, conversion from fiat to crypt and vice versa.

GET Get price of cryptocurrency

2 credits

/api/v1/crypto/quotes/{cryptocurrency}
Request Headers
x-api-key Your API Key
Request
Query Parameters
amount Amount of crypto to convert to fiat, by default amount is 1
Example: amount=1.5
currency Fiat currency code supported, by default it returns in USD.
Example: currency=EUR
Example
<?php

$curl = curl_init();

curl_setopt_array($curl, [
	CURLOPT_HTTPHEADER => [
		"x-api-key: {api_key}"
	],
	CURLOPT_URL => "https://coinmkr.com/api/v1/crypto/quotes/BTC?amount=1.5&currency=EUR",
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_CUSTOMREQUEST => "GET",
]);

$response = curl_exec($curl);
$error = curl_error($curl);

curl_close($curl);

if ($error) {
	echo "cURL Error #:" . $error;
} else {
	echo $response;
}
Status code: 200
{

    "status": "success",
    "crypto": "BTC",
    "crypto_amount": 1.5,
    "fiat": "Euro",
    "fiat_price": 41978.8148115026

}

GET Convert fiat to cryptocurrency

2 credits

/api/v1/fiat/conversion/{fiat_currency}
Request Headers
x-api-key Your API Key
Request
Query Parameters
amount Amount of fiat to convert to crypto, by default amount is 1
Example: amount=1500
crypto Cryptocurrency code supported, by default it returns in BTC.
Example: crypto=LTC
Example
<?php

$curl = curl_init();

curl_setopt_array($curl, [
	CURLOPT_HTTPHEADER => [
		"x-api-key: {api_key}"
	],
	CURLOPT_URL => "https://coinmkr.com/api/v1/fiat/conversion/PEN?amount=1500&crypto=LTC",
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_CUSTOMREQUEST => "GET",
]);

$response = curl_exec($curl);
$error = curl_error($curl);

curl_close($curl);

if ($error) {
	echo "cURL Error #:" . $error;
} else {
	echo $response;
}
Status code: 200
{

    "status": "success",
    "fiat": "Peruvian Nuevo Sol",
    "fiat_amount": 1500,
    "crypto": "LTC",
    "crypto_amount": 4.69326627

}

GET Convert fiat to other fiat currency

2 credits

/api/v1/fiat/exchange/USD
Request Headers
x-api-key Your API Key
Request
Query Parameters
amount Amount of fiat base to convert, by default amount is 1
Example: amount=1500
to Fiat currency code to convert.
Example: to=EUR
Example
<?php

$curl = curl_init();

curl_setopt_array($curl, [
	CURLOPT_HTTPHEADER => [
		"x-api-key: {api_key}"
	],
	CURLOPT_URL => "https://coinmkr.com/api/v1/fiat/exchange/USD?amount=500&to=EUR",
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_CUSTOMREQUEST => "GET",
]);

$response = curl_exec($curl);
$error = curl_error($curl);

curl_close($curl);

if ($error) {
	echo "cURL Error #:" . $error;
} else {
	echo $response;
}
Status code: 200
{

    "status": "success",
    "from": "USD",
    "to": "EUR",
    "amount": 500,
    "result": 459.1199

}