Dalongpay Buy Crypto by card

Version 1.0

API

To call API you should send POST request to address:
https:/test-buy.dalongpay.com/ (TEST)
https://buy.dalongpay.com/ (Production)

API Methods

Request Path Parameters (POST) Comments
API initialization / Not necessary
brand - brand_name
amount_eur - amount in EUR
Support of branded pages (starting, input form, error page)

If not specified – page is in standard design

Amount_eur – specified if it is necessary to specify fix EUR amount. Note: “currency” is a mandatory field for cryptocurrency specification in which will be converted EUR amount. In case the “amount” is filled – it has the priority and Amount_eur will not be taken into account.
Payment form / Necessary
email - user email
address - destination address cryptocurency
amount - amount of cryptocurrency
currency - currency (ETH,BTC,ZCASH,LTC,DASH)

Not necessary
brand - brand_name
callback_url - URL used for sending confirmations after receiving money on the address.
accept_redirect - redirect URL used for successed payment
reject_redirect - redirect URL used for rejected payment
User will be redirected to 3D secure page in case of success

If the card parameters pass the verification, authorization and payment is confirmed, the funds will be deposited to the customer personal account at Dalongpay and then automatically transferred to the transfer address.

Callback

If parameter callback_url was defined during initialization, information about confirmations willbe send to this url by POST request with parameters:

POST request including:
email - email of customer
address - destination cryptocurrency address
txid - ID transaction in blockchain network
value - amount of crypto currency - currency (BTC, LTC, ETH, ZCASH, DASH)

Current rates

To get current rates you should send GET request to URL:
https://buy.dalongpay.com/info/course/CURRENCY - Production
https://test-buy.dalongpay.com/info/course/CURRENCY - Test

CURRENCY types:
BTC - Bitcoin
LTC - Litecoin
ETH - Ethereum
DASH - DASH
ZCASH - Zcash

Example

For instance, to get rate Litecoin/EUR you should send request:
https://buy.dalongpay.com/info/course/LTC







Result will be returned in JSON format:

{
  "currency":"LTC",
  "course":"127.38"
} 

General Information

Dalongpay button (DBP) - a tool for organizing fund raising or receiving payments in various cryptocurrencies, which can be placed on web page on the Internet.

How to use it: register in Dalongpay, get the button code (through our wizard or create it by your own using the API documentation), integrate it into any place on your website and start receiving payments quickly, safely and conveniently.

How it works: visitors of your website fill in a few simple custom form fields and receive an individual address for transferring the cryptcurrency. The amount will be credited to your account in the Dalongpay system as soon as the transfer will get the required number of confirmations in Blockchain.

How do I learn about the transaction: download and install our Android or iOS apps and you will be able to receive notifications of every successful operation as well as an email.

What cryptocurrencies are supported: Bitcoin (BTC), Litecoin (LTC), Dash (DASH), Ethereum (ETH), Zcash (ZEC).

Which fiat currencies are supported: EUR, USD, RUB.

Supported languages: Russian (RU), English (EN).

https://test-button.dalongpay.com/test/

Depending on your needs, you can use one of the following button operation modes:

  1. accepting any amounts in any of the supported cryptocurrencies (crowdfunding, collecting donations more examples);
  2. accepting of fixed amounts in a specified cryptocurrency (crowdfunding, collection of donations, more examples);
  3. accepting of fixed fiat currencies amounts (crowdfunding, collection of donations, more examples);
  4. accepting of any amount of cryptocurrency for any supported fiat currency (crowdfunding, collection of donations, more examples).

During the payment, the web-form requests the email address of the user for the opportunity, if necessary, contact the user in the future. Email is checked for compliance with standards, but confirmation by the user is necessary. Based on user data in the Dalongpay system, a receipt for funds is generated. When performing the operation, the address is generated, to which the customer must send funds using the tools for working with cryptocurrencies (for example, the services provided by Dalongpay). The address is given to the user in text form, as well as in the form of a QR code. If the funds are sent, they are credited to the partner account in the Dalongpay system. The receipt receives the status "Confirmed".

If the user does not send funds, the receipt remains unpaid. At this stage, the lifetime of the receipt is not limited.

Mode: acceptance of payments in different amounts in any of the supported cryptocurrencies.

In this mode, your visitor determines the amount and in what currency he wants to transfer funds to you. This mode is best suited for collecting donations or crowdfunding.

To connect this mode, you will need:

  • DalongpayID, If you do not have it, you can get it at this link;
  • Button label, optional;
  • Comment for all payments made using this button, optional.

Installing a button on your page:

1. Connect the button script by placing the following code on the page:

<script type="text/javascript" src="https://test-button.dalongpay.com/js/v1/dalongpay.js"></script>

2. Create a configuration code by placing the following code on the page between the <body> </body> tags:

<script type="text/javascript">
   var cfConfig = {
   CID: "enter your DalongpayID",	        	// need to get in Dalongpay
   type: "free",// mode
   lang: "EN",							// language
   comment: "enter your comment or leave it blank"		// payment comment
}
</script>

3. Create a block with a button by placing the following code in the place where you want to display the button:

<div class="dalongpay">
   <button onclick="dpInit(this, cfConfig);">button label</button>
</div>

4. Optional. If you want to use the Dalongpay corporate style button, connect the style file by placing the following code on the page between the <head> </head> tags:

<link rel="stylesheet" href="https://test-button.dalongpay.com/test/style.css"> 

Example:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>DalongPay Button – test page </title>
    <link rel="stylesheet" href="https://test-button.dalongpay.com/test/style.css">
</head>
<body>
    <h2>Donate any sum in any cryptocurrency</h2>
    <div class="dalongpay">
        <button onclick='dpInit(this, cfConfig);'>Donate</button>
    </div>

    <script type="text/javascript" >
      var cfConfig = {
        CID: "enter your DalongpayID",				// need to get in Dalongpay
        type: "fixed",						// mode
        lang: "EN",						// language
        amount: [enter the amount],				// amount of payment
        currency: "choose the currency",				// payment currency
        comment: "enter your comment or leave it blank"		// payment comment
      }
    </script>
    <script type="text/javascript" src="https://test-button.dalongpay.com/js/v1/dalongpay.js"></script>
</body>
</html>

Mode: accepting of fixed amounts in a specified cryptocurrency.

In this mode, you define both the payment amount and the cryptocurrency in which it will be accepted. This mode is best suited for collecting donations or crowdfunding.

To connect this mode, you need:

  • DalongpayID, If you do not have it, you can get it at this link;
  • Payment amount, optional;
  • choose the type of cryptocurrency in which you want to receive payments: BTC, ETH, LTC, DASH, ZCASH;
  • button label, optional;
  • comment for all payments made using this button, optional.

Installing a button on your page:

1. Connect the button script by placing the following code on the page:

<script type="text/javascript" src="https://test-button.dalongpay.com/js/v1/dalongpay.js"></script>

2. Create a configuration code by placing the following code on the page between the <body> </ body> tags:

<script type="text/javascript" >
    var cfConfig = {
    CID: "enter your DalongpayID",				// need to get in Dalongpay
    type: "fixed",						// mode
    lang: "EN",							// language
    amount: [enter the amount],					// payment amount
    currency: " choose the currency ",				//payment currency[BTC,ETH, LTC, DASH, ZCASH]
    comment: " enter your comment or leave it blank "		// payment comment
}
</script>

3. Create a block with a button by placing the following code in the place where you want to display the button:

<div class=”dalongpay”>
    <button onclick='dpInit(this, cfConfig);'>button label</button>
</div>

4. Optional. If you want to use the Dalongpay corporate style button, connect the style file by placing the following code on the page between the <head> </ head> tags:

<link rel="stylesheet" href="https://test-button.dalongpay.com/test/style.css">

Example:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>DalongPay Button – test page</title>
    <link rel="stylesheet" href="https://test-button.dalongpay.com/test/style.css">
</head>
<body>
    <h2>Donate any amount in any cryptocurrency</h2>
    <div class="dalongpay">
        <button onclick='dpInit(this, cfConfig);'>Donate</button>
    </div>

    <script type="text/javascript" >
      var cfConfig = {
        CID: "enter your Dalongpay ID",				// need to get in Dalongpay
        type: "fixed",						// mode
        lang: "EN",						// language
        amount: [enter the amount],				// payment amount
        currency: " choose the currency ",			// payment currency
        comment: " enter your comment or leave it blank "	// payment comment
      }
    </script>
    <script type="text/javascript" src="https://test-button.dalongpay.com/js/v1/dalongpay.js"></script>
</body>
</html>

Mode: accepting of fixed fiat currencies amounts.

In this mode, select one of the supported fiat currencies and the amount in it. After your customer chooses a convenient cryptocurrency to pay with, the amount of payment will be automatically calculated based on the current exchange rate at that time. In addition to collecting donations and crowdfunding, this mode can also be used to pay for goods or services.

To connect this mode, you need:

  • DalongpayID. If you do not have it, you can get it at this link;
  • Payment amount, optional;
  • choose the type of the currency in which the amount is indicated: EUR, USD, RUB;
  • button label, optional;
  • a comment for all payments made using this button, optional.

Installing a button on your page:

1. Connect the button script by placing the following code on the page:

<script type="text/javascript" src="https://test-button.dalongpay.com/js/v1/dalongpay.js"></script>

2. Create a configuration code by placing the following code on the page between the <body> </ body> tags:

<script type="text/javascript" >
   var cfConfig = {
   CID: "enter your DalongpayID",				// need to get in Dalongpay
   type: "fixed_fiat",						// mode
   lang: "EN",							// language
   amount_f: [enter the amount],				// payment amount
   currency_f: "choose the currency",				// payment currency [EUR, USD, RUB]
   comment: " enter your comment or leave it blank "		// payment comment
}
</script>

3. Create a block with a button by placing the following code in the place where you want to display the button:

<div class=”dalongpay”>
   <button onclick='dpInit(this, cfConfig);'>button label</button>
</div>

4. Optional. If you want to use the Dalongpay corporate style button, connect the style file by placing the following code on the page between the <head> </ head> tags:

<link rel="stylesheet" href="https://test-button.dalongpay.com/test/style.css">

Example:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>DalongPay Button – test page</title>
    <link rel="stylesheet" href="https://test-button.dalongpay.com/test/style.css">
</head>
<body>
    <h2>Donate any amount in any cryptocurrency</h2>
    <div class="dalongpay">
        <button onclick='dpInit(this, cfConfig);'>Donate</button>
    </div>

    <script type="text/javascript" >
      var cfConfig = {
        CID: "enter your DalongpayID",				// need to get in Dalongpay
        type: "fixed_fiat",					// mode
        lang: "EN",						// language
        amount_f: [enter the amount],				// payment amount
        currency_f: " choose the currency ",			// payment currency
        comment: " enter your comment or leave it blank "	// payment comment
      }
    </script>
    <script type="text/javascript" src="https://test-button.dalongpay.com/js/v1/dalongpay.js"></script>
</body>
</html>

Mode: accepting payments by cryptocurrency of the chosen fiat currency, with the possibility of choosing the amount by customer.

In this mode, your visitor determines the amount and currency in what he wants to transfer funds to you. For convenience, he has the opportunity to enter the amount in the chosen fiat currency. The transfer amount is automatically calculated, based on the current exchange rate. This mode is best suited for collecting donations or crowdfunding.

To connect this mode, you need:

  • DalongpayID. If you do not have it, you can get it at this link this link;
  • the amount in the fiat currency, which will be on the website by default, the user can change on request;
  • choose the type of the currency in which the amount will be indicated: EUR, USD, RUB;
  • button label, optional;
  • a comment for all payments made using this button, optional.

Installing a button on your page:







1. Connect the button script by placing the following code on the page:

<script type="text/javascript" src="https://test-button.dalongpay.com/js/v1/dalongpay.js"></script>

2. Create a configuration code by placing the following code on the page between the <body> </ body> tags:

<script type="text/javascript" >
    var cfConfig = {
    CID: "enter your DalongpayID",				// need to get in Dalongpay
    type: "free_fiat",						// mode
    lang: "EN",							// language
    amount_f: [enter the amount],				// payment amount
    currency_f: " choose the currency ",				// payment currency [EUR, USD, RUB]
    comment: " enter your comment or leave it blank "		// payment comment
    }
</script>

3. Create a block with a button by placing the following code in the place where you want to display the button:

<div class=”dalongpay”>
   <button onclick='dpInit(this, cfConfig);'>button label</button>
</div>

4. Optional. If you want to use the Dalongpay corporate style button, connect the style file by placing the following code on the page between the <head> </ head> tags:

<link rel="stylesheet" href="https://test-button.dalongpay.com/test/style.css">

Example:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>DalongPay Button – test page</title>
    <link rel="stylesheet" href="https://test-button.dalongpay.com/test/style.css">
</head>
<body>
    <h2> Donate any amount in any cryptocurrency </h2>
    <div class="dalongpay">
        <button onclick='dpInit(this, cfConfig);'>Donate</button>
    </div>

    <script type="text/javascript" >
      var cfConfig = {
        CID: "enter your DalongpayID",				// need to get in Dalongpay
        type: "free_fiat",					// mode
        lang: "EN",						// language
        amount_f: [enter the amount],				// payment amount
        currency_f: " choose the currency ",			// payment currency
        comment: " enter your comment or leave it blank "	// payment comment
      }
    </script>
    <script type="text/javascript" src="https://test-button.dalongpay.com/js/v1/dalongpay.js"></script>
</body>
</html>

Using Pay API

Example https://github.com/DalongPayAPI/Demo

To make request you should send POST request to URL:
https://test-payapi.dalongpay.com/v1/ (Test)
https://payapi.dalongpay.com/v1/ (Production)

Parameters of request should have working method (m), and parameters of query (q).

Parameters are encoding by method crypt with keys, the sum of ApiKEY, SessionKEY and ClientKEY (excluding session initialization method).

ApiKEY and ClientKEY – are constant provided by Dalongpay. SessionKEY – received any time with session initialization request. It is sent prior each request. (SessionKEY is valid for 1 minute)

The system response is encrypted using crypt with key, which is formed as a sum of ApiKEY, SessionKEY и ClientKEY.

To start working with system response, it should be decrypted, using decrypt with key method. This key is formed as a sum of ApiKEY, SessionKEY и ClientKEY.

If to make a request is used incorrect or invalid SessionKEY, then API gives HTTP error 401.

If invalid method is used to form the request, the API initialization method is started.

API methods

Markings:
AK - ApiKEY
CK - ClientKEY
SK - SessionKEY

API initializations

Response
{"description":"Dalongpay PAY Api","version":"1.0"}

Session initialization

Response is encrypted using CK method.

Request
m = init
q = {"key": "CK"}
Response
{"key":"SK"}

Receipt creation

sec_param – string, which is encrypted with key AK+SK+CK

Response is encrypted using AK+SK+CK

state:

  • new
  • pending
  • complete
Request
m = get
q = {"key": "SK", "param": "sec_param"}
sec_param = crypt( '{"currency":"BTC", "amount":"0.01"}', AK.SK.CK)
Response
{"receipt":"ID",
"address":"incomming address",
"currency":"BTC",
"amount":"0.01",
"received":"0",
"confirm":"0",
"TxID":"",
"state":"new",
"date":"2018-03-19 23:00:00"
}

Receipt information

sec_param - string, which is encrypted with key AK+SK+CK

Response is encrypted using AK+SK+CK

state:

  • new
  • pending
  • complete
Request
m = receipt
q = {"key": "SK", "param": "sec_param"}
sec_param = crypt('{"receipt":"receiptID"}', AK.SK.CK)
Response
{"receipt":"ID",
"address":"incomming address",
"currency":"BTC",
"amount":"0.01",
"received":"0",
"confirm":"0",
"TxID":"",
"state":"new",
"date":"2018-03-19 23:00:00"
}

List of receipts

sec_param - string, which is encrypted with key AK+SK+CK

Response is encrypted using AK+SK+CK

If param is not specified, response is 10 last checks.

Request
m = list
q = {"key": "SK", "param": "sec_param"}

sec_param = crypt('{"start":"0", "count":"10", "begin":"2018-01-01","end":"2018-01-31"}', AK.SK.CK)
Response
{"receipt":"ID",
"address":"incomming address",
"currency":"BTC",
"amount":"0.01",
"received":"0",
"confirm":"0",
"TxID":"",
"state":"new",
"date":"2018-03-19 23:00:00"
}

Receiving funds notifications

Pay API sends callback to customers’ address when funds are received on the specified wallet.

Callback includes POST request of received payment, which has receipt information in the following format.

Parameters:

Parameter Description
receipt Receipt ID
address Cryptocurrency wallet address, to which should be sent funds.
currency Currency of operation.
amount The sum to be received.
received The sum actually received.
confirm Number of confirmations of the payment. (0-6)
TxID Operation ID in blockchain system.
state Status of receipt: New - new operation, Pending – waiting for payment confirmation, Complete – payment if confirmed
date Date and time of receipt (GMT).

Validity of receipt – new, waiting for payment confirmation (pending), payment is complete (complete).
The amount of confirmations required to complete the payment – 6. As soon as the amount of confirmations reaches 6, the receipt is considered as completed (payment is completed) and no more notification about receiving funds will be formed. POST-request is encrypted using AK+CK

Request
{"receipt":"ID",
"address":"incomming address",
"currency":"BTC",
"amount":"0.01",
"received":"0.01",
"confirm":"1",
"TxID":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"state":"pending"}

Encryption and decryption

Encryption function

function crypt($text, $key) {
  $ivlen = openssl_cipher_iv_length($cipher="AES-128-CBC");
  $iv = openssl_random_pseudo_bytes($ivlen);
  $ciphertext_raw = openssl_encrypt($text, $cipher, $key, $options=OPENSSL_RAW_DATA, $iv);
  $hmac = hash_hmac('sha256', $ciphertext_raw, $key, $as_binary=true);
  $crypt_text = base64_encode( $iv.$hmac.$ciphertext_raw );
  return $crypt_text;
}

Decryptions function







function decrypt($crypt_text, $key) {
  $decrypt_text = '';
  $c = base64_decode($crypt_text);
  $ivlen = openssl_cipher_iv_length($cipher="AES-128-CBC");
  $iv = substr($c, 0, $ivlen);
  $hmac = substr($c, $ivlen, $sha2len=32);
  $ciphertext_raw = substr($c, $ivlen+$sha2len);
  $plaintext = openssl_decrypt($ciphertext_raw, $cipher, $key, $options=OPENSSL_RAW_DATA, $iv);
  $calcmac = hash_hmac('sha256', $ciphertext_raw, $key, $as_binary=true);
  if (hash_equals($hmac, $calcmac))
  {
   $decrypt_text =  $plaintext;
  }
  return $decrypt_text;
}

DalongPay OpenAPI

Version 1.0

DalongPay OpenAPI (OAPI) is designed for interaction of external clients with DalongPay payment service.

Address:
Test environment: https://test-openapi.dalongpay.com/v1
Live environment: https://openapi.dalongpay.com/v1

Authorization

In order to ensure security, the client must obtain an API-key. To do this, you need to contact support at support@dalongpay.com

Interaction with API is made within the framework of the session. Before executing queries to the API, you must initiate a session. In this case, the client application receives session-key. The lifetime of the session is 10 minutes. After the session time expires, the previously received session-key becomes invalid. You must re-initiate the session. You can initiate sessions each time you access OAPI.

Running OAPI queries

After initiating a session, you can perform queries against OAPI.

To do this, performed POST queries to get OAPI address containing the required parameters.

For security purposes, the query is signed as follows

Signature = sha256(api-key + param1 + param2 + … + paramN + session-key)

Where param1..paramN – query parameters

The signature is sent along with the query body. OAPI returns the HTTP response code and, if the query succeeds, the data is in JSON format.

Functions

Session

POST /start - Session initialization

Options

Name Description
api-key *required string (Query body) Api-key, got from DalongPay

Reply

Code Description
200 Successful authorization. Session Key is generated.
403 Authorization denied. Api-key is invalid.

Example:

{"session-key": "4sdRefecv"}

User

POST /user - Retrieving user data. If necessary - registration of a new user

Options | Name | Description | |---|---| |api-key required string (Query body) | Api-key, got from DalongPay |email required string (Query body) | Email of the user for which you want to receive data (or register a new user) |signature *required string (Query body) | Request Signature. Signature = sha256(api-key + email + session-key)

Reply

Code Description
200 The request was successfully completed. User data is generated.
403 Authorization denied. Incorrect Api-key, or data signature
500 Technical error of OAPI

Example:

{
    "UID": "DalongPay User ID",
    "accounts": {
        "BTC": "User Bitcoin address",
        "ETH": "User Eterium address",
        "LTC": "User Litecoin address",
        "DASH": "User Dash address",
        "ZCASH": "User Zcash address"
    }
}
EN RU
Show examples in: