Last Price:  USD 
API | Generate Invoices
INTRODUCTION
The Coinlink generate invoices API is the quickest and easiest way to begin accepting automated bitcoin payments. Consisting of just one simple http GET request, it can be up and running in minutes.

Whether the clients are registered on coinlink or not, coinlink generate invoices API ensures the highest speed of processing their payments. Therefore they won't have to wait for the confirmations from the bitcoin network anymore. To elaborate, coinlink members have the privilege to instantly pay for their orders. And for none coinlink members, you -as a merchant- get from coinlink the privilege of specifying for each requested invoice the number of confirmations needed between 1 and 6 based on its amount, so if the amount is not worth waiting for as many confirmations, the transaction will be quickly confirmed from our part.

Our API provides peace of mind for both you and your client specially if the client is not registered in coinlink, starting with generating a unique bitcoin address along with each generated invoice, your server will be constantly notified using a simple callback about any payment sent from the client to the generated address or any status update of the payment that is controlled by our API engine based on your required confirmations. And your client can do multiple payments and monitoring them with a clear grid that includes the amounts and their status.

API AUTHENTICATION
Generating an invoice requires authentication. You need to provide 3 parameters to authenticate a request:
  • API key
  • Nonce
  • Signature
API KEY
To get an API key, go to "Account", "Security" and then "API Access". Set permissions and click "Generate key".
NONCE
Nonce is a regular integer number. It must be increasing with every request you make. Example: if you set nonce to 1 in your first request, you must set it to at least 2 in your second request. You are not required to start with 1.
SIGNATURE
Signature is a HMAC-SHA256 encoded message containing: nonce, client ID and API key. The HMAC-SHA256 code must be generated using a secret key that was generated with your API key. This code must be converted to it's hexadecimal representation (64 uppercase characters).
Example (PHP):
$message = $nonce.$client_id.$api_key;
$singature = strtoupper(hash_hmac('sha256', $message, $secret));

GENERATE INVOICES
This method creates a unique address which should be presented to the customer. Any payments sent to this address will be forwarded to your own bitcoin address. Each time a payment is forwarded the callback URL will be called.
GET https://www.coinlink.net/apis/receivep?mode=create
SIGNATURE and API KEY are required and have to be sent as headers in your requests to the above link.
Exacmple (PHP):
$headers = array(
'Key: '.$key,
'Signature: '.strtoupper(hash_hmac('sha256', $nonce.$client_id.$key, $secret)),
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
PARAMETERS
  • nonce must be incremental with every request you make. Example: if you set nonce to 1 in your first request, you must set it to at least 2 in your second request. You are not required to start with 1.
  • amount must be a BTC value. You can use our API converter to convert USD value to BTC value.
  • instant_only must be 1 or 0.
  • address instant_only is set to 0)> must be limited to 34 characters in length.
  • required_confirmations instant_only is set to 0)> must be between 1 and 6.
  • callback must be sent in a URL format and limited to 255 characters in length.
  • return_failure must be sent in a URL format and limited to 255 characters in length.
  • return_success must be sent in a URL format and limited to 255 characters in length.
For more info:
  • instant_only, Set to 1 to only allow coinlink users to pay on this transaction.
  • address, The bitcoin address that received the payments.
  • required_confirmations, Number of confirmations can be between 1 and 6, you freely specify it based on the amount of the requested invoice. Once a payment is sent to the invoice address, We will notify your server using a simple callback by returning "PENDING" as the status of the transaction. Meanwhile our system keeps monitoring the transaction confirmations. when the number of confirmations meets the number of your requested required confirmations, we notify your server again with the status "CONFIRMED".
  • callback, The callback URL to be notified when a payment is received. Remember to URL Encode the callback url when calling the create method.
  • return_failure, Where to redirect the user on cancellation. URL Encode the failure url when calling the create method.
  • return_success, Where to redirect the user on payment success. URL Encode the success url when calling the create method.
RETURNS
  • HTTP_SIGNATURE
  • HTTP_KEY
  • client_id
  • nonce
  • transaction_hash
  • time_received
  • input_address
  • value
  • transaction_status
For more security:
HTTP_SIGNATURE is a HMAC-SHA256 encoded message containing: your requested nonce, your client ID and your API key. The HMAC-SHA256 code is encoded using your secret key that was generated with your API key. Two headers are added to our response so you can validate our response in your callback script to prevent fraudulent actions.
Example (PHP):
function callback_is_valid($signature, $key, $secret, $nonce, $client_id) {
$good_sign = strtoupper(hash_hmac('sha256', $nonce.$client_id.$key, $secret));
return ($signature == $good_sign);
}

DOWNLOAD GENERATE INVOICES PHP EXAMPLE
© 2015 Coinlink Ltd.