Lydiax Merchant REST API
The Lydiax Merchant API is designed to be a predictable and intuitive interface to enable merchants to buy/sell supported cryptocurrencies.
Flows:
REST API URL: https://sandbox-merchant-api.lydiax.com/api/v1/
Authorization
The Lydiax Merchant API implements JWT to allow clients to log in without exposing their credentials. The process involves several steps:
Acquire an access token
- Use the access token to make authenticated requests
- Before you begin, you will need to get the client credentials from us.
Acquire an access token
The authentication key consists of your merchant code and password.
curl -X POST 'https://sandbox-merchant-api.lydiax.com/api/v1/auth/token'
-d '{"merchant_code" : "TESTMERCHANT0000111", "password" : "secret"}'
Exchanging an access token
The access token must be exchanged in any authorized requests in the header parameters. For example:
curl -X GET 'https://sandbox-merchant-api.lydiax.com/api/v1/buy/prices/BTC'
-H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJtZXJjaGFudElkIjoxLCJ0aW1lc3RhbXAiOjE1NDU4MjIwODd9.e_Qj_IgyZg09m5nJToQVZRDwVGJLTKLTgs0I3H9_uKM'
Authentication
This endpoint is used to acquire the access token.
Request body
Responses
Body
{
"data": {
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJtZXJjaGFudElkIjoxLCJ0aW1lc3RhbXAiOjE1NDU4MjIwODd9.e_Qj_IgyZg09m5nJToQVZRDwVGJLTKLTgs0I3H9_uKM"
},
"code": "00",
"message": "APPROVED",
"status": "APPROVED"
}
{cryptocurrencyCode}
{cryptocurrency}
{cryptocurrencyCode}
Merchant can get the best current buy rate of a cryptocurrency for buys and withdrawals.
Path variables
Request headers
Responses
OK
Body
Coin fiat money price
Fiat money currency
Coin type
{
"data": {
"buy_price": 3302.4,
"currency": "EUR",
"cryptocurrency": "BTC"
},
"code": "00",
"message": "APPROVED",
"status": "APPROVED"
}
{cryptocurrency}
Merchant can get the best current sell rate of a cryptocurrency for sells and deposits.
Path variables
currencyPair
Request headers
Responses
OK
Body
Fiat money currency
Coin type
{
"data": {
"sell_price": 3302.4,
"currency": "EUR",
"cryptocurrency": "BTC"
},
"code": "00",
"message": "APPROVED",
"status": "APPROVED"
}
{referenceId}
/cryptocurrency/{code}
{orderId}
{referenceId}
/cryptocurrency/{code}
Merchant can get customer’s balance for buy and sell orders.
Path variables
Customer reference id
Cryptocurrency code
Request headers
Responses
OK
Body
{
"data": {
"balance": 0.6,
"cryptocurrency": "LTC"
},
"code": "00",
"message": "APPROVED",
"status": "APPROVED"
}
Merchant can get his balance for buy and sell orders.
Request headers
Responses
OK
Body
FIat money currency
{
"data": {
"buysell": {
"balance": "1002931.53",
"currency": "EUR"
},
"exchange": {
"balance": "984554.09",
"currency": "EUR"
}
},
"code": "00",
"message": "APPROVED",
"status": "APPROVED"
}
Merchant can get an order price.
Request headers
Request body
Get a Buy Price to buy coins that you are gonna hold with Lydiax.
Get a Sell Price to sell your coins that you are holding with Lydiax.
Get a Withdraw Price to buy then withdraw it to a given customer coin wallet address.
Responses
Body
{
"data": {
"token": "nRRMlCnAwr5SHWeEaqe3a5BQLCAxtHVAEexsJsDcmhYmbCAEts1GM9U9ehek0IpO7YP4w1PLgrW3w6WSzSDBFq6EFWzt9iCqE1MhSmR1Fpo=",
"total_amount": 703.62,
"currency": "EUR",
"cryptocurrency_amount": 0.223,
"cryptocurrency": "BTC"
},
"code": "00",
"message": "APPROVED",
"status": "APPROVED"
}
Merchant can create an order.
Request headers
Request body
Customer’s first name
Customer’s last name
Customer’s email address
Only for withdraws
Coin wallet address for withdrawals
For XRP orders
Responses
Body
{
"data": {
"order_id": 11
},
"code": "00",
"message": "APPROVED",
"status": "APPROVED"
}
{orderId}
Merchants can query order details.
Path variables
Order id
Request headers
Authentication token
Responses
Body
Unique id of an order
Order type
For Merchant’s own deposits
Current status of an order
Currency amount of an order
Fiat money currency code
Cryptocurrency amount of an order
Cryptocurrency code
Merchants can create deposit addresses for their customers and get deposit addresses related to any customer.
{referenceId}
/cryptocurrency/{cryptocurrencyCode}
Merchant can create a customer spesific coin wallet address to receive coins.
Request headers
Request body
customerDepositAddress
Merchant’s customer reference id
Customer’s name
Customer’s surname
Customer’s email address
Responses
OK
Body
{
"data": {
"address": "2Mv2VAaATwnmaqxNLRWQB3vVUyjrMpy48zr"
},
"code": "00",
"message": "APPROVED",
"status": "APPROVED"
}
{referenceId}
/cryptocurrency/{cryptocurrencyCode}
Fetches a previously created deposit address for a customer.
Path variables
Merchant’s customer reference id
Coin type
Request headers
Responses
OK
Body
{
"data": {
"address": "2Mv2VAaATwnmaqxNLRWQB3vVUyjrMpy48zr"
},
"code": "00",
"message": "APPROVED",
"status": "APPROVED"
}
Payments differ from deposit as there is an expected payment amount from this action. Whereas, deposits can be made in any amount above minimum transaction value.
{id}
/conversionMerchant can create both amount and customer specific unique payment.
Request headers
Request body
Order EUR money amount
Merchant’s return url
Merchant’s failure url
Merchant’s name on invoice page
Customer’s ip address
Customer’s name
Customer’s last name
Customer’s email address
Responses
Body
Order id
{id}
/conversionMerchant can confirm previously created payment with cryptocurrency code.
Path variables
Order id that will be confirmed.
Request headers
Request body
Cryptocurrency code
Responses
Body
Order id
Order status
Order amount
Currency code
Cryptocurrency amount
Cryptocurrency code
Blockchain address
Merchant name
Merchant can create both amount and customer specific unique payment url.
Request headers
Request body
Order EUR money amount
Merchant’s return url
Merchant’s failure url
Merchant’s name on invoice page
Customer’s ip address
Customer’s name
Customer’s last name
Customer’s email address
Responses
Body
Merchant’s amount and customer specific unique payment url
Merchant can refund payments if available.
Request headers
Request body
Order id
Blockchain address which is payment will be refunded
Only for XRP refunds
Responses
Body
Returns TRUE if refund request is accepted
Merchant can accept payments if available.
Request headers
Request body
Order id
Responses
Body
Unique id of an order
Order type
Current status of order
Currency amount of an order
Currency code
Cryptocurrency amount of an order
Cryptocurrency code
Blockchain address
Blockchain transaction id
After the transaction is processed, callback in JSON format is sent to callback URL provided by merchant. Callbacks are sent for only deposit and withdraw transactions.
Callbacks are always sent:
- when received transaction was completed
- when its status was changed
Callback signature
Signature is used in callbacks and protects the message from changes. Each callback’s request is signed by the signature, signature of callback is sent in callback header.
Signature is calculated by Lydiax from callback secret(generated for merchant) value and JSON body of callback request with SHA-256. Callback secret is also generated by Lydiax and received by merchant with merchant code.
For example, you have following parameters:
Callback secret: 11qq22ww
Received callback’s JSON body
Then merchant will need to calculate SHA-256 signature of the following string:
{ “id”: 123, … }11qq22ww
The result string must be equal to string in the header Signature of callback.
Callback requests are sent with the following parameters.
Request headers
Callback signature
Request body
Unique id of order
Current status of order
Type of order
Reference id of merchant’s customer
Fiat money amount of order (Only available for deposits and payments)
Fiat money code (Only available for deposits and payments)
Cryptocurrency amount of order (Only available for deposits and payments)
Cryptocurrency code (Only available for deposits and payments)
Bitcoin
Ethereum
Litecoin
Ripple
Bitcoin Cash