Overview

ChainMyne Pay provides a standards-based REST interface that enables application developers to interact with their ChainMyne Pay merchant account. Using the ChainMyne Pay API, clients can create a depositing wallet address to accept BTC, ETH, and LTC for payment, real time digital asset to fiat rates, and receive notification of payments received.

Environment

 The Following Environments are available

 

Base URL BTC Bockchain
BTC Production https://api.chainmynepay.com:5000/usr/wallet/btc/create mainnet
BTC Sandbox https://api.digitalpaydev.com:5000/usr/wallet/btc/create testnet
BCH Production https://api.chainmynepay.com:5000/usr/wallet/bch/create mainnet
BCH Sandbox https://api.digitalpaydev.com:5000/usr/wallet/bch/create testnet
ETH Production https://api.chainmynepay.com:5000/usr/wallet/eth/create mainnet
ETH Sandbox https://api.digitalpaydev.com:5000/usr/wallet/eth/create ropsten
LTC Production https://api.chainmynepay.com:5000/usr/wallet/ltc/create mainnet
LTC Sandbox https://api.digitalpaydev.com:5000/usr/wallet/ltc/create testnet

 

Getting Started

In order to use Trade API, the user will have to go through few simple steps:

API key

HMAC authorization header

API key

To use API, users will need to obtain API Public key and Secret Key, which are passed to API with every request. API keys can be generated in your merchant dashboard at dashboard.chainmynepay.com under Settings > API Keys section.

 

HMAC authorization header value

Once the user obtains the API key, it is all set up! Now, the only thing left is to form an HMAC authorization header variable. In order to form this header, user will need following variables:

var apikey = ‘public key’; // key obtained from ChainMyne Pay

var secretkey = ‘secret key’; // secret obtained from ChainMyne Pay

var timestamp = Math.floor(Date.now() / 1000); // timestamp in seconds

var nonce = Math.floor(Math.random() * Math.floor(1000000)); // random nonce integer

The last variable, which is needed is Parameters from body (JSON), String consists of ALL parameters from body separated by ‘&’ sign if more than one (for example: ‘ref_id=mk1231sa11&timestamp=1588364168&nonce=900288).

bodyString=’ref_id=mk1231sa11&timestamp=1588364168&nonce=900288’

 

If the url and/or currency variables are being passed in the body, they must be added as follows

bodyString=’ref_id=mk1231sa11&url=https://yourwebhookurl.com&timestamp=1588364168&nonce=900288&currency=USD’

Finally, user has to put all of the variables together and encode them:

parameters from url and body

var hmacDigest = CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA512(bodyString, secretkey));

var authentication = btoa(apikey + ‘:’ + hmacDigest);

That’s it! User can now use variable ‘authentication’ as header to communicate with trade API.

Merchant id to be used in the header *Required

A merchant Id is required to be passed in the header.

 

User Merchant ID can be found in the user ChainMyne Pay dashboard at dashboard.chainmynepay.com or api.digitalpaydev.com under Settings > section Account information section.

 

Receiving Payments

Create Payment Wallet Address

Post Create Wallet Address API

<asset> variable = btc, eth, bch

https://api.chainmynepay.com:5000/usr/wallet/<asset>/create

https://api.digitalpaydev.com:5000/usr/wallet/<asset>/create

 

Headers:

apikey. 9c0c51ee6f3798e3aae63ea630ddd2b7265fe54f

(public key value)

merchant_id (Merchant id in Account Information)

authentication. (authentication value generated)

RAW JSON BODY

{ “ref_id”: “user unique reference/invoice id per client”,

“url”: “https://yourwebhookurl.com”, (optional field, this will override the webhook url set in the API key options. )

“timestamp”: 1550838976, “nonce”: 693795,“currency”:”USD” ( options USD,CAD,EUR. If field is not included USD is used by default. )}

Example Successful Response

{

“status”: “success”,

“data”: {

“ref_id”: “cor121121”,

“price”: 8632.59,

“address”: “moep287CANJhZoyssrigoHtkMwBiz6uhDt”,

“coin”: “BTC”,

“expires”: “2020-05-04 14:32:46.480”

}

}

Example Failed Response

{

“status”: “error”,

“message”: “Access Invalid”

}

Or

{

“status”: “error”,

“message”: ” Could Not Create Address

}

ChainMyne Pay Payment Webhook Callback Notification:

Instant Payment Notifications (IPNs) are sent from ChainMyne Pay upon every confirmed status change. IPNs are posted to your webhook URL specified in the user ChainMyne Pay dashboard. If the ChainMyne Pay gateway receives an HTTP/1.1 200 OK response from your server, the message is deemed to have been correctly delivered.

NOTE: This does not mean the user application correctly handled the data – only that it was received successfully by the user server!

If an HTTP error code is received by the gateway, ChainMyne Pay server will attempt to resend the IPN at increasing time intervals.

The amount of time between each re-post is as follows: 1 minute delay, 2 minute delay, 4 minute delay, 8 minute delay, 20 minute delay, 40 minute delay, 80 minute delay, 160 minute delay, 320 minute delay, 640 minute delay and 1,280 minute delay. The IPN system stops re-posting when:

ChainMyne Pay receives a basic HTTP “200 OK” response from your web server, or

when 1,280 minutes have passed since the initial post.

Note: This functionality applies to both Sandbox and Live accounts.

Webhook URL (IPN) Response

Headers

signature CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA512(Body, secretkey));

Body

{“ref_id”:”wm_123323″,

“price”:8550.26,

“amount”:0.0006,

“total”:5.13,

“date_time”:”1588354319000″,

“transaction_id”:”c3c2920e4705cc37c57d0937576d6346c27ca81f2b9e507fd47a1de113b7bba9″,

“coin”:”BTC”,

“network”:”testnet”,

“currency”:”USD”

}

Get Transaction Status

https://api.chainmynepay.com:5000/usr/wallet/transactions

https://api.digitalpaydev.com:5000/usr/wallet/transactions

Headers

apikey. 9c0c51ee6f3798e3aae63ea630ddd2b7265fe54f

(public key value)

merchant_id (Merchant id in Account Information)

authentication. (authentication value generated)

RAW JSON BODY

{“address”: “bchtest:qpggts6de95hnutg8wrxx55mh9z2dnxp2v64tuqn73”,

“timestamp”: 1550838976, “nonce”: 693795}

Example Successful Response

{

“status”: “success”,

“data”: {

“date_time”: “2020-07-31T22:10:21.000Z”,

“address”: “bchtest:qpggts6de95hnutg8wrxx55mh9z2dnxp2v64tuqn73”,

“status”: “Paid”, (Paid,Pending)

“payment_amount”: 0.01655245,

“total_payment”: 6.54,

“txid”: “0bd4d3c2ab491649bc5c7328aba8d46b2c2c856ca5cd8261d489a7e01c2a5f12”,

“price”: 395.23,

“currency”: “CAD”,

“coin”: “BCH”

}

}

 

Get API Key

POST   https://api.<domain>.com:5000/keyauth

POST   https://api.digitalpaydev.com:5000/keyauth

Headers

‘Content-Type’: ‘application/json’

Body

{“username”:”clients@email”,

“password”:”clients password”

}

Success Response

{

    “status”: “success”,

    “data”: {

        “name”: “Merchant Name”,

“merchant_id”:”merchant  id”

        “public_key”: “qw92332bb6f07da62f17fdec1f703e3214cf2d78vv6”,

        “secret_key”: “3w0482d4f3ea4f1f12f8fe250605472989990c6bsc”

    }

}

Error Responses

Invalid credentials

{

    “status”: “error”,

    “message”: “Invalid Credentials”

}

Accounts KYC Not Verified

{

    “status”: “error”,

    “message”: “Not Verified”

}

en_US