Introduction
Overview
Welcome to MidChains Payments API documentation. These documents outline our Crypto Payments functionality and guidance of implementing through our APIs.
We have language bindings in Shell, Python, and JavaScript! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.
APIs are separated into two categories: Payment Service Data and Payment Processing. Payment Service Data APIs provide information on the Assets we promote for Payment Processing and are public. Payment Processing APIs require authentication and provide access to initiating payment requests, configuration of workspaces and reporting data.
Version: 1.0.0
Rate Limits
MidChains aims to provide a stable and secure platform for all users at all times. Accordingly, traffic is continuously monitored from all parties to identify patterns that may affect the network negatively. If traffic from a single account is identified as too high and the rate limit is hit, MidChains may temporarily throttle or restrict the account.
You have a rate limit that is based on a per API endpoint and per minute basis. If you reach your rate limit, you'll see an error response to let you know your rate limit has been temporarily exceeded.
Environments
MidChains Pay provides mainnet and sandbox access to assist users in the integration phases of Crypto Checkout.
| Environment | URL |
|---|---|
| Production | https://midchains.com/pay/ |
| Development | https://sandbox.midchains.com/pay/ |
Public Endpoints
Get All Cryptocurrencies
curl "https://sandbox.midchains.com/pay/api/v1/crypto/available_assets/" \
-H "{Content-Type:application/json}"
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status":"success",
"data":[
{
"Label":"BTC",
"Name":"Bitcoin",
"Asset":"Bitcoin",
"Network":"bitcoin",
"Price":16826.43
},
{
"Label":"BCH",
"Name":"Bitcoin Cash",
"Asset":"Bitcoin Cash",
"Network":"bitcoin cash",
"Price":101.5
},
{
"Label":"ADA",
"Name":"Cardano",
"Asset":"Cardano",
"Network":"cardano",
"Price":0.2591
},
{
"Label":"ETH",
"Name":"Ethereum",
"Asset":"Ethereum",
"Network":"ethereum",
"Price":1218.14
},
{
"Label":"LTC",
"Name":"Litecoin",
"Asset":"Litecoin",
"Network":"litecoin",
"Price":65.61
},
{
"Label":"MATIC",
"Name":"Polygon",
"Asset":"Polygon",
"Network":"ethereum",
"Price":0.7949
},
{
"Label":"XRP",
"Name":"Ripple",
"Asset":"Ripple",
"Network":"ripple",
"Price":0.3491
},
{
"Label":"SOL",
"Name":"Solana",
"Asset":"Solana",
"Network":"solana",
"Price":11.46
},
{
"Label":"XLM",
"Name":"Stellar",
"Asset":"Stellar",
"Network":"stellar",
"Price":0.0739
},
{
"Label":"USDC",
"Name":"USD Coin",
"Asset":"USD Coin",
"Network":"ethereum",
"Price":0.9999
}
]
}
This endpoint retrieves all Cryptocurrencies available in MidChains Pay.
HTTP Request
GET /api/v1/crypto/available_assets/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| Code | The Code of the Asset | True |
| Name | The Name of the Asset | False |
Get All Fiat Currencies
curl "https://sandbox.midchains.com/pay/api/v1/crypto/available_fiat/" \
-H "{Content-Type:application/json}"
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status":"success",
"data":[
{
"Label":"AED",
"Name":"Arab Emirates Dirhams",
"Asset":"Arab Emirates Dirhams"
},
{
"Label":"BHD",
"Name":"Bahraini Dinar",
"Asset":"Bahraini Dinar"
},
{
"Label":"HKD",
"Name":"Hong Kong Dollar",
"Asset":"Hong Kong Dollar"
},
{
"Label":"JOD",
"Name":"Jordan Dinar",
"Asset":"Jordan Dinar"
},
{
"Label":"OMR",
"Name":"Omani Rial",
"Asset":"Omani Rial"
},
{
"Label":"QAR",
"Name":"Qatar Riyals",
"Asset":"Qatar Riyals"
},
{
"Label":"SAR",
"Name":"Saudi Riyal",
"Asset":"Saudi Riyal"
},
{
"Label":"USD",
"Name":"United States Dollar",
"Asset":"United States Dollar"
}
]
}
This endpoint retrieves all Cryptocurrencies in MidChains Pay.
HTTP Request
GET /api/v1/crypto/available_fiat/
| Parameter | Description | Required |
|---|---|---|
| Code | The Code of the Fiat currency | False |
| Name | The Name of the Fiat currency | False |
Authentication
Get API key
To obtain your API token, use this code:
# With shell, you can just pass the correct header with each request
curl "https://sandbox.midchains.com/pay/users/api-token-auth/" \
-d "{username : email}" \
-d "{password : password}"
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"token": "6ea190e8df2cf898T53qd341b3c17tf1bc23aa3f"
}
Make sure to replace
tokenwith your API key.
MidChains Pay uses API keys to allow access to the API. You can register a new API key at our developer portal.
MidChains expects for the API key to be included in all protected API requests to the server in a header that looks like the following:
Authorization: Token token
| Parameter | Description | Required |
|---|---|---|
| token | Your API Key | True |
Scan Wallet Address
Get Wallet Risk Rating
curl "https://sandbox.midchains.com/pay/api/v1/crypto/scan_wallet/" \
-H "Authorization: Token $Token"
-d '{Asset : BCH}'
-d '{Address : ashfwertgjensdfgsdfhgfsgmhfdsdffsd}'
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status":"success",
"data":[
{
"Address":"tbcashfwertgjensdfgsdfhgsdfffs435gmhfdsgdffsd",
"Asset":"BTC",
"RiskRating":"TESTNET ADDRESS"
}
]
}
This endpoint retrieves a risk rating on the address that has been given.
HTTP Request
GET /api/v1/crypto/scan_wallet/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| Address | The Address being scanned | False |
| Asset | The ID of the Asset | False |
| RiskRating | The ratig of the address | False |
Payment Service Providers
Get PSP's supported Assets
curl "https://sandbox.midchains.com/pay/api/v1/payment_service_provider/supported_assets/" \
-H "Authorization: Token FGH345fsdfr7gfhfgjjghjgs"
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status":"success",
"data":[
{
"PaymentServiceProvider":"MidChains PSP",
"Asset":"BAND",
"Active":true,
"Name":"Band",
"Protocol":"ERC20",
"Network":"Ethereum",
"Price":1.94
},
{
"PaymentServiceProvider":"MidChains PSP",
"Asset":"BTC",
"Active":true,
"Name":"Bitcoin",
"Protocol":"UTXO",
"Network":"Bitcoin",
"Price":16818.45
},
{
"PaymentServiceProvider":"MidChains PSP",
"Asset":"BCH",
"Active":true,
"Name":"Bitcoin Cash",
"Protocol":"UTXO",
"Network":"Bitcoin Cash",
"Price":101.4
},
{
"PaymentServiceProvider":"MidChains PSP",
"Asset":"ADA",
"Active":true,
"Name":"Cardano",
"Protocol":"UTXO",
"Network":"Cardano",
"Price":0.2593
},
{
"PaymentServiceProvider":"MidChains PSP",
"Asset":"DASH",
"Active":true,
"Name":"Dash",
"Protocol":"UTXO",
"Network":"Dash",
"Price":43.89
},
{
"PaymentServiceProvider":"MidChains PSP",
"Asset":"DOGE",
"Active":true,
"Name":"Doge Coin",
"Protocol":"UTXO",
"Network":"Dogecoin",
"Price":0.07707
},
{
"PaymentServiceProvider":"MidChains PSP",
"Asset":"FTM",
"Active":true,
"Name":"Fantom",
"Protocol":"ERC20",
"Network":"Ethereum",
"Price":0.2022
},
{
"PaymentServiceProvider":"MidChains PSP",
"Asset":"LTC",
"Active":true,
"Name":"Litecoin",
"Protocol":"UTXO",
"Network":"Litecoin",
"Price":65.6
},
{
"PaymentServiceProvider":"MidChains PSP",
"Asset":"MATIC",
"Active":true,
"Name":"Polygon",
"Protocol":"ERC20",
"Network":"Ethereum",
"Price":0.7961
},
{
"PaymentServiceProvider":"MidChains PSP",
"Asset":"XRP",
"Active":true,
"Name":"Ripple",
"Protocol":"XRPL",
"Network":"ripple",
"Price":0.349
},
{
"PaymentServiceProvider":"MidChains PSP",
"Asset":"SOL",
"Active":true,
"Name":"Solana",
"Protocol":"SCP",
"Network":"Solana",
"Price":11.51
},
{
"PaymentServiceProvider":"MidChains PSP",
"Asset":"XLM",
"Active":true,
"Name":"Stellar",
"Protocol":"SCP",
"Network":"Stellar",
"Price":0.074
},
{
"PaymentServiceProvider":"MidChains PSP",
"Asset":"USDC",
"Active":true,
"Name":"USD Coin",
"Protocol":"ERC20",
"Network":"Ethereum",
"Price":0.9999
}
]
}
This endpoint retrieves Crypto Assets that the Payment Service Provider has configured to use as checkout methods.
HTTP Request
GET /api/v1/payment_service_provider/supported_assets/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| PaymentServiceProvider | The ID of the Payment Service Provider | False |
| Asset | The ID of the Asset | False |
| AssetCode | The Code of the Asset | False |
| AssetName | The Name of the Asset | False |
| Active | The Active Status of the Asset | False |
Add Asset to Payment Service Provider's Wallet
curl -X DELETE "https://sandbox.midchains.com/pay/api/v1/payment_service_provider/supported_assets/" \
-H "{Content-Type : application/json}" \
-H "{Authorization : Token FGH345fsdfr7gfhfgjjghjgs}" \
-d "{ Asset : DOGE }" \
-d "{ Active : True }"
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status":"success",
"data":{
"PaymentServiceProvider":"MidChains PSP",
"Asset":"DOGE",
"Active":true,
"Name":"Doge Coin",
"Protocol":"UTXO",
"Network":"Dogecoin",
"Price":0.07708
}
}
This endpoint adds a specific Cryptocurrency to your inventory.
HTTP Request
POST /api/v1/payment_service_provider/supported_assets/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| PaymentServiceProvider | The ID of the Payment Service Provider | False |
| Asset | The ID of the Asset | True |
| AssetCode | The Code of the Asset | False |
| AssetName | The Name of the Asset | False |
| Active | The Active Status of the Asset | True |
Update Payment Service Provider's Assets
curl -X PUT "https://sandbox.midchains.com/pay/api/v1/payment_service_provider/supported_assets/" \
-H "{Content-Type : application/json}" \
-H "{Authorization : Token FGH345fsdfr7gfhfgjjghjgs}" \
-d "{ Asset : BCH }" \
-d "{ Active : False }"
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status":"success",
"data":{
"PaymentServiceProvider":"MidChains PSP",
"Asset":"BCH",
"Active":false,
"Name":"Bitcoin Cash",
"Protocol":"UTXO",
"Network":"Bitcoin Cash",
"Price":101.4
}
}
This endpoint adds a Wallet for the specified Cryptocurrency.
HTTP Request
PUT /api/v1/payment_service_provider/supported_assets/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| PaymentServiceProvider | The ID of the Payment Service Provider | False |
| Asset | The ID of the Asset | True |
| AssetCode | The Code of the Asset | False |
| AssetName | The Name of the Asset | False |
| Active | The Active Status of the Asset | True |
Create Merchant Account
curl -X POST "https://sandbox.midchains.com/pay/api/v1/payment_service_provider/supported_assets/" \
-H "{Content-Type : application/json}" \
-H "{Authorization : Token FGH345fsdfr7gfhfgjjghjgs}" \
-d "{ email : email }" \
-d "{ firstname : firstname }" \
-d "{ lastname : lastname }" \
-d "{ Name : Name }" \
-d "{ Address : Address }" \
-d "{ Country : Country }" \
-d "{ Active : True }"
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status":"success",
"data":{
"Merchant":"TEST TWO MERCHANT",
"UUID":"Pay-cb7e04f7-bc5a-46da-9509-f157493eb25f",
"PaymentServiceProvider":"MidChains PSP",
"Name":"TEST TWO MERCHANT",
"Address":"123 Fake Street",
"Country":"Ireland",
"MerchantUUID":"Pay-cb7e04f7-bc5a-46da-9509-f157493eb25f",
"email":"test12345@gmail.com",
"firstname":"Joe",
"lastname":"Bloggs"
}
}
This endpoint creates a Merchant.
HTTP Request
POST /api/v1/payment_service_provider/merchants/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| Merchant | The ID of the Merchant | False |
| PaymentServiceProvider | The Payment Services Providers ID | False |
| Name | The Name of the Merchant | True |
| Address | The Address of the Merchant | False |
| Country | The Country of the Merchant | True |
Update Merchant Account
curl -X POST "https://sandbox.midchains.com/pay/api/v1/payment_service_provider/supported_assets/" \
-H "{Content-Type : application/json}" \
-H "{Authorization : Token FGH345fsdfr7gfhfgjjghjgs}" \
-d "{ email : email }" \
-d "{ firstname : firstname }" \
-d "{ lastname : lastname }" \
-d "{ Name : Name }" \
-d "{ Address : Address }" \
-d "{ Country : Country }" \
-d "{ Active : True }"
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status":"success",
"data":{
"message":"Merchant has been updated."
}
}
This endpoint updates a Merchant's information.
HTTP Request
PUT /api/v1/payment_service_provider/merchants/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| Merchant | The ID of the Merchant | False |
| PaymentServiceProvider | The Payment Services Providers ID | False |
| Name | The Name of the Merchant | True |
| Address | The Address of the Merchant | False |
| Country | The Country of the Merchant | True |
| Active | The Active of the Merchant | True |
Get Merchant Accounts
curl -X GET "https://sandbox.midchains.com/pay/api/v1/payment_service_provider/supported_assets/" \
-H "{Content-Type : application/json}" \
-H "{Authorization : Token FGH345fsdfr7gfhfgjjghjgs}" \
-d "{ MerchantUUID : Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07 }" \
-d "{ Name : Name }" \
-d "{ Country : Country }" \
-d "{ Active : True }"
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status":"success",
"data":[
{
"Merchant":"TEST TWO MERCHANT",
"Name":"TEST TWO MERCHANT",
"Address":"123 Fake Street",
"Country":"Ireland",
"Active":true,
"MerchantUUID":"Pay-cb7e04f7-bc5a-46da-9509-f157493eb25f",
"email":"test12345@gmail.com",
"firstname":"Joe",
"lastname":"Bloggs"
},
{
"Merchant":"Hashim's Phone Shop",
"Name":"Hashim's Phone Shop",
"Address":"25 Artillery Street",
"Country":"Ireland",
"Active":true,
"MerchantUUID":"Pay-feeb2416-159c-4442-af1e-3875a9d146ce",
"email":"test@gmail.com",
"firstname":"Hashim",
"lastname":"Omer"
}, ......
]
}
This endpoint returns information about Merchants.
HTTP Request
GET /api/v1/payment_service_provider/merchants/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| Merchant | The UUID of the Merchant | False |
| PaymentServiceProvider | The Payment Services Providers ID | False |
| Name | The Name of the Merchant | False |
| Address | The Address of the Merchant | False |
| Country | The Country of the Merchant | False |
| Active | The Active Status of a Merchant | False |
Add Merchant Assets
curl -X POST "https://sandbox.midchains.com/pay/api/v1/payment_service_provider/merchants/assets/" \
-H "{Content-Type : application/json}" \
-H "{Authorization : Token FGH345fsdfr7gfhfgjjghjgs}" \
-d "{ Merchant : Pay-feeb2416-159c-4442-af1e-3875a9d146ce }" \
-d "{ Asset : DOGE }"
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status":"success",
"data":{
"Merchant":"Merchant AB",
"Asset":"DOGE",
"Active":true,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Doge Coin",
"Network":"dogecoin",
"Price":0.07707
}
}
This endpoint adds an Asset for Merchants to be able to receive payments.
HTTP Request
POST /api/v1/payment_service_provider/merchants/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| Merchant | The ID of the Merchant | True |
| Asset | The ID of the Asset | True |
| AssetName | The Name of the Asset | False |
| AssetCode | The Code of the Asset | False |
| Active | The Active Status of the Asset | True |
| MinTransaction | The Minumum transaction amount of the Asset | False |
| MaxTransaction | The Maximum transaction amount of the Asset | False |
Update Merchant Assets
curl -X PUT "https://sandbox.midchains.com/pay/api/v1/payment_service_provider/merchants/assets/" \
-H "{Content-Type : application/json}" \
-H "{Authorization : Token FGH345fsdfr7gfhfgjjghjgs}" \
-d "{ Merchant : Pay-feeb2416-159c-4442-af1e-3875a9d146ce }" \
-d "{ Asset : LTC }" \
-d "{ Active : False }"\
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status":"success",
"data":{
"Merchant":"Merchant AB",
"Asset":"LTC",
"Active":false,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Litecoin",
"Network":"litecoin",
"Price":65.66
}
}
This endpoint updates an asset for the Merchants.
HTTP Request
PUT /api/v1/payment_service_provider/merchants/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| Merchant | The ID of the Merchant | True |
| Asset | The ID of the Asset | False |
| AssetName | The Name of the Asset | False |
| AssetCode | The Code of the Asset | False |
| Active | The Active Status of the Asset | False |
| MinTransaction | The Minumum transaction amount of the Asset | False |
| MaxTransaction | The Maximum transaction amount of the Asset | False |
Get Merchant Assets
curl -X GET "https://sandbox.midchains.com/pay/api/v1/payment_service_provider/merchants/assets/" \
-H "{Content-Type : application/json}" \
-H "{Authorization : Token FGH345fsdfr7gfhfgjjghjgs}" \
-d "{ MerchantUUID : UUID }"
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status":"success",
"data":[
{
"Merchant":"Merchant AB",
"Asset":"BTC",
"Active":true,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Bitcoin",
"Protocol":"UTXO",
"Network":"Bitcoin",
"Price":16826.24
},
{
"Merchant":"Merchant AB",
"Asset":"BCH",
"Active":true,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Bitcoin Cash",
"Protocol":"UTXO",
"Network":"Bitcoin Cash",
"Price":101.4
},
{
"Merchant":"Merchant AB",
"Asset":"ADA",
"Active":true,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Cardano",
"Protocol":"UTXO",
"Network":"Cardano",
"Price":0.2591
},
{
"Merchant":"Merchant AB",
"Asset":"DASH",
"Active":true,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Dash",
"Protocol":"UTXO",
"Network":"Dash",
"Price":44.03
},
{
"Merchant":"Merchant AB",
"Asset":"DOGE",
"Active":true,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Doge Coin",
"Protocol":"UTXO",
"Network":"Dogecoin",
"Price":0.07706
},
{
"Merchant":"Merchant AB",
"Asset":"FTM",
"Active":true,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Fantom",
"Protocol":"ERC20",
"Network":"Ethereum",
"Price":0.2024
},
{
"Merchant":"Merchant AB",
"Asset":"LTC",
"Active":true,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Litecoin",
"Protocol":"UTXO",
"Network":"Litecoin",
"Price":65.66
},
{
"Merchant":"Merchant AB",
"Asset":"MATIC",
"Active":true,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Polygon",
"Protocol":"ERC20",
"Network":"Ethereum",
"Price":0.7969
},
{
"Merchant":"Merchant AB",
"Asset":"SOL",
"Active":true,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Solana",
"Protocol":"SCP",
"Network":"Solana",
"Price":11.51
},
{
"Merchant":"Merchant AB",
"Asset":"USDC",
"Active":true,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"USD Coin",
"Protocol":"ERC20",
"Network":"Ethereum",
"Price":0.9999
}
]
}
This endpoint returns information about Merchants' Assets that have been configured for their checkout instance.
HTTP Request
GET /api/v1/payment_service_provider/merchants/assets/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| Merchant | The ID of the Merchant | True |
| Asset | The ID of the Asset | False |
| AssetName | The Name of the Asset | False |
| AssetCode | The Code of the Asset | False |
| Active | The Active Status of the Asset | False |
Get Merchant Transactions
curl -X GET "https://sandbox.midchains.com/pay/api/v1/payment_service_provider/merchants/assets/" \
-H "{Content-Type : application/json}" \
-H "{Authorization : Token FGH345fsdfr7gfhfgjjghjgs}" \
-d "{Merchant : Pay-feeb2416-159c-4442-af1e-3875a9d146ce }"
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status":"success",
"data":[
{
"TransactionID":"Transaction-ed03a142-afea-4fd2-a796-b1a4602873da",
"BaseCurrency":"USD",
"BaseCurrencyRequested":750.0,
"RequestedAmount":0.0101927,
"Address":"tb1qn7ffewjpx5sdr24xdvssusgccn2cqae9900t2a",
"DateTime":"2022-12-05T08:01:13.365618",
"Expiry":900,
"Note":null,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Asset":"BTC",
"Name":"Bitcoin",
"Protocol":"UTXO",
"Network":"Bitcoin",
"Price":17322.17,
"Transactions":[
{
"Merchant":"Merchant AB",
"Source":"tb1q2zjqklrn70glkndcdlqu6my7yarvndr2sf49q7",
"Destination":"tb1qn7ffewjpx5sdr24xdvssusgccn2cqae9900t2a",
"Asset":"BTC",
"Amount":0.0101927,
"NetworkFee":0.0,
"Status":"COMPLETED",
"AMLRiskRating":null,
"DateTime":"2022-12-05T08:09:30.326935",
"TransactionHash":"76bbe0ec3ac0d470984ebb441dc46851d661ee4e1e6bff644b53063d498b9099",
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07"
}
]
}
]
}
This endpoint returns information about Merchants' Assets that have been configured for their checkout instance.
HTTP Request
GET /api/v1/payment_service_provider/transactions/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| Merchant | The ID of the Merchant | True |
| Asset | The ID of the Asset | False |
| AssetName | The Name of the Asset | False |
| AssetCode | The Code of the Asset | False |
| Active | The Active Status of the Asset | False |
Create Merchant Transactions
curl -X GET "https://sandbox.midchains.com/pay/api/v1/payment_service_provider/merchants/assets/" \
-H "{Content-Type : application/json}" \
-H "{Authorization : Token FGH345fsdfr7gfhfgjjghjgs}" \
-d "{Merchant : Pay-feeb2416-159c-4442-af1e-3875a9d146ce }"
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status":"success",
"data":{
"Merchant":"Merchant AB",
"TransactionID":"Transaction-dc040bdc-084e-40cf-bf20-1969db0787c4",
"Asset":"BTC",
"RequestedAmount":0.001837,
"Address":"tb1qmvupfjm3yns29mja6tut9f8uatwrrp0awk0v49",
"Expiry":180,
"Note":null,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Bitcoin",
"Network":"bitcoin",
"Protocol":"UTXO"
},
"Link":"https://sandbox.midchains.com/pay/api/v1/merchant/checkout/Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07/Transaction-dc040bdc-084e-40cf-bf20-1969db0787c4/"
}
This endpoint returns information about Merchants' Assets that have been configured for their checkout instance.
HTTP Request
POST /api/v1/payment_service_provider/transactions/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| Merchant | The ID of the Merchant | True |
| Asset | The ID of the Asset | False |
| AssetName | The Name of the Asset | False |
| AssetCode | The Code of the Asset | False |
| Active | The Active Status of the Asset | False |
Get FIAT Balances
curl -X GET "https://sandbox.midchains.com/pay/api/v1/payment_service_provider/balances/" \
-H "{Content-Type : application/json}" \
-H "{Authorization : Token FGH345fsdfr7gfhfgjjghjgs}" \
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status":"success",
"data":[
{
"Code":"HKD",
"Status":"Completed",
"Balance":0.0
},
{
"Code":"OMR",
"Status":"Completed",
"Balance":0.0
},
{
"Code":"BHD",
"Status":"Completed",
"Balance":0.0
},
{
"Code":"AED",
"Status":"Completed",
"Balance":8035.0
},
{
"Code":"QAR",
"Status":"Completed",
"Balance":0.0
},
{
"Code":"USD",
"Status":"Completed",
"Balance":2100.0
},
{
"Code":"SAR",
"Status":"Completed",
"Balance":0.0
}
]
}
This endpoint returns the current holdings of your Crypto Wallet.
HTTP Request
GET /api/v1/payment_service_provider/balances/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| Merchant | The ID of the Merchant | False |
| Code | The Symbol of the Asset | False |
| Status | The Status of the balances | False |
| BAlance | The Sum of transactions | False |
Merchants
Get Available Assets
curl -X GET "https://sandbox.midchains.com/pay/api/v1/merchant/available_assets/" \
-H "{Content-Type : application/json}" \
-H "{Authorization : Token $Token}" \
-d "{Asset : ETH}" \
-d "{Active : true}" \
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status":"success",
"data":[
{
"Asset":"BTC",
"Name":"Bitcoin",
"Network":"bitcoin",
"Active":true,
"Price":16830.21
},
{
"Asset":"ADA",
"Name":"Cardano",
"Network":"cardano",
"Active":true,
"Price":0.2592
},
{
"Asset":"DASH",
"Name":"Dash",
"Network":"dash",
"Active":true,
"Price":44.05
},
{
"Asset":"DOGE",
"Name":"Doge Coin",
"Network":"dogecoin",
"Active":true,
"Price":0.07717
},
{
"Asset":"FTM",
"Name":"Fantom",
"Network":"ethereum",
"Active":true,
"Price":0.2024
},
{
"Asset":"LTC",
"Name":"Litecoin",
"Network":"litecoin",
"Active":true,
"Price":65.74
},
{
"Asset":"MATIC",
"Name":"Polygon",
"Network":"ethereum",
"Active":true,
"Price":0.797
},
{
"Asset":"XRP",
"Name":"Ripple",
"Network":"ripple",
"Active":true,
"Price":0.349
},
{
"Asset":"SOL",
"Name":"Solana",
"Network":"solana",
"Active":true,
"Price":11.52
},
{
"Asset":"USDC",
"Name":"USD Coin",
"Network":"ethereum",
"Active":true,
"Price":0.9999
}
]
}
This endpoint returns a checkout instance on with a Crypto Address.
HTTP Request
GET /api/v1/merchant/available_assets/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| Asset | The Aymbol of the Asset | False |
| Name | The Name of the Asset | False |
| Network | The Assets Blockchain network | False |
| Price | The price of the asset in USD | False |
| Active | Active Status of the Asset | False |
Get Merchants Assets
curl -X GET "https://sandbox.midchains.com/api/v1/merchant/supported_assets/" \
-H "{Content-Type : application/json}" \
-H "{Authorization : Token $Token}" \
-d "{Asset : ETH}" \
-d "{Active : true}" \
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status":"success",
"data":[
{
"Merchant":"Merchant AB",
"Asset":"BTC",
"Active":true,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Bitcoin",
"Network":"bitcoin",
"Price":16829.39
},
{
"Merchant":"Merchant AB",
"Asset":"ADA",
"Active":true,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Cardano",
"Network":"cardano",
"Price":0.2593
},
{
"Merchant":"Merchant AB",
"Asset":"DASH",
"Active":true,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Dash",
"Network":"dash",
"Price":44.05
},
{
"Merchant":"Merchant AB",
"Asset":"DOGE",
"Active":true,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Doge Coin",
"Network":"dogecoin",
"Price":0.07713
},
{
"Merchant":"Merchant AB",
"Asset":"DOGE",
"Active":false,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Doge Coin",
"Network":"dogecoin",
"Price":0.07713
},
{
"Merchant":"Merchant AB",
"Asset":"ETH",
"Active":false,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Ethereum",
"Network":"ethereum",
"Price":1218.92
},
{
"Merchant":"Merchant AB",
"Asset":"FTM",
"Active":true,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Fantom",
"Network":"ethereum",
"Price":0.2024
},
{
"Merchant":"Merchant AB",
"Asset":"LTC",
"Active":true,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Litecoin",
"Network":"litecoin",
"Price":65.72
},
{
"Merchant":"Merchant AB",
"Asset":"MATIC",
"Active":true,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Polygon",
"Network":"ethereum",
"Price":0.7968
},
{
"Merchant":"Merchant AB",
"Asset":"SOL",
"Active":true,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Solana",
"Network":"solana",
"Price":11.5
},
{
"Merchant":"Merchant AB",
"Asset":"USDC",
"Active":true,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"USD Coin",
"Network":"ethereum",
"Price":0.9999
}
]
}
This endpoint returns a checkout instance on with a Crypto Address.
HTTP Request
GET /api/v1/merchant/supported_assets/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| Asset | The Aymbol of the Asset | False |
| Name | The Name of the Asset | False |
| Network | The Assets Blockchain network | False |
| MerchantUUID | The UUID of the Merchant | False |
| Price | The price of the asset in USD | False |
| Active | Active Status of the Asset | False |
Add Available Assets
curl -X POST "https://sandbox.midchains.com/pay/api/v1/merchant/supported_assets/" \
-H "{ Content-Type : application/json }" \
-H "{ Authorization : Token $Token }"
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status": "success",
"data": [
{
"Merchant": "Merchant AB",
"Asset": "BTC",
"Active": true,
"MerchantUUID": "Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name": "Bitcoin",
"Network": "bitcoin",
"Price": 16855.08
},
{
"Merchant": "Merchant AB",
"Asset": "ADA",
"Active": true,
"MerchantUUID": "Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name": "Cardano",
"Network": "cardano",
"Price": 0.2615
},
{
"Merchant": "Merchant AB",
"Asset": "DASH",
"Active": true,
"MerchantUUID": "Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name": "Dash",
"Network": "dash",
"Price": 45.37
},
{
"Merchant": "Merchant AB",
"Asset": "DOGE",
"Active": true,
"MerchantUUID": "Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name": "Doge Coin",
"Network": "dogecoin",
"Price": 0.07578
},
{
"Merchant": "Merchant AB",
"Asset": "DOGE",
"Active": false,
"MerchantUUID": "Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name": "Doge Coin",
"Network": "dogecoin",
"Price": 0.07578
},
{
"Merchant": "Merchant AB",
"Asset": "ETH",
"Active": false,
"MerchantUUID": "Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name": "Ethereum",
"Network": "ethereum",
"Price": 1219.41
},
{
"Merchant": "Merchant AB",
"Asset": "FTM",
"Active": true,
"MerchantUUID": "Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name": "Fantom",
"Network": "ethereum",
"Price": 0.2046
},
{
"Merchant": "Merchant AB",
"Asset": "LTC",
"Active": true,
"MerchantUUID": "Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name": "Litecoin",
"Network": "litecoin",
"Price": 70.42
},
{
"Merchant": "Merchant AB",
"Asset": "MATIC",
"Active": true,
"MerchantUUID": "Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name": "Polygon",
"Network": "ethereum",
"Price": 0.8019
},
{
"Merchant": "Merchant AB",
"Asset": "SOL",
"Active": true,
"MerchantUUID": "Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name": "Solana",
"Network": "solana",
"Price": 11.36
},
{
"Merchant": "Merchant AB",
"Asset": "USDC",
"Active": true,
"MerchantUUID": "Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name": "USD Coin",
"Network": "ethereum",
"Price": 1.0
}
]
}
This endpoint returns a checkout instance on with a Crypto Address.
HTTP Request
POST /api/v1/merchant/supported_assets/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| Merchant | The Merchants Name | False |
| Asset | The Asset Symbol | False |
| Active | The Active status of the asset | False |
| MerchantUUID | The Merchants UUID | False |
| Name | The Assets Name | False |
| Network | The Assets Network | False |
| Price | The Assets current price | False |
Get Transactions
curl -X GET "https://sandbox.midchains.com/pay/api/v1/merchant/transactions/" \
-H "{Content-Type : application/json}" \
-H "{Authorization : Token $token}" \
-d "{Status : PAID }"
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status": "success",
"data": [
{
"TransactionID": "Transaction-ed03a142-afea-4fd2-a796-b1a4602873da",
"BaseCurrency": "USD",
"BaseCurrencyRequested": 750,
"RequestedAmount": 0.0101927,
"Status":"PAID",
"Address": "tb1qn7ffewjpx5sdr24xdvssusgccn2cqae9900t2a",
"DateTime": "2022-12-05T08:01:13.365618",
"Expiry": 900,
"MerchantUUID": "Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Asset": "BTC",
"Name": "Bitcoin",
"Protocol": "UTXO",
"Network": "Bitcoin",
"Transactions": [
{
"Merchant": "Merchant AB",
"Source": "tb1q2zjqklrn70glkndcdlqu6my7yarvndr2sf49q7",
"Destination": "tb1qn7ffewjpx5sdr24xdvssusgccn2cqae9900t2a",
"Asset": "BTC",
"Amount": 0.0101927,
"NetworkFee": 0,
"Status": "COMPLETED",
"AMLRiskRating": null,
"DateTime": "2022-12-05T08:09:30.326935",
"TransactionHash": "76bbe0ec3ac0d470984ebb441dc46851d661ee4e1e6bff644b53063d498b9099",
"MerchantUUID": "Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07"
}
]
}
]
}
This endpoint returns a checkout instance on with a Crypto Address.
HTTP Request
GET /api/v1/merchant/transactions/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| Merchant | The Name of the Merchant | False |
| Asset | The Symbol of the Asset | False |
| RequestedAmount | The Requested amount in Crypto | False |
| Address | The deposit Address | False |
| Expiry | The Expiry time in seconds | True |
| Link | The url to the checkout | False |
Create Transaction Request
curl -X POST "https://sandbox.midchains.com/pay/api/v1/merchant/transactions/" \
-H "{Content-Type : application/json}" \
-H "{Authorization : Token $token}" \
-d "{SettlementCurrency : LTC}" \
-d "{BaseCurrency : USD}" \
-d "{Amount : 50}" \
-d "{Expiry : 1200}" \
-d "{Description : Description}"
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status":"success",
"data":{
"Merchant":"Merchant AB",
"TransactionID":"Transaction-881b41c8-8462-4356-8a33-a7eebe34a8e5",
"Asset":"LTC",
"RequestedAmount":0.728637,
"Address":"tltc1q6frg9a9qt5vftvl6p6fmenpsg79yfhlavzx6yw",
"Expiry":1200,
"Note":null,
"MerchantUUID":"Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07",
"Name":"Litecoin",
"Network":"litecoin",
"Protocol":"UTXO",
"Link":"https://sandbox.midchains.com/pay/api/v1/merchant/checkout/Pay-23132f23-f45f-4c3a-a93a-b96f55c81b07/Transaction-881b41c8-8462-4356-8a33-a7eebe34a8e5/"
}
}
This endpoint returns a checkout instance on with a Crypto Address.
HTTP Request
POST /api/v1/merchant/transactions/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| Merchant | The Name of the Merchant | False |
| Asset | The Symbol of the Asset | False |
| RequestedAmount | The Requested amount in Crypto | False |
| Address | The deposit Address | False |
| Expiry | The Expiry time in seconds | True |
| Link | The url to the checkout | False |
Get Balances
curl -X GET "https://sandbox.midchains.com/pay/api/v1/merchant/balances/" \
-H "{Content-Type : application/json}" \
-H "{Authorization : Token $token}" \
-d "{Status : PAID }"
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status": "success",
"data": [
{
"Code": "HKD",
"Status": "Completed",
"Balance": 0
},
{
"Code": "QAR",
"Status": "Completed",
"Balance": 0
},
{
"Code": "SAR",
"Status": "Completed",
"Balance": 0
},
{
"Code": "USD",
"Status": "Completed",
"Balance": 2100
},
{
"Code": "AED",
"Status": "Completed",
"Balance": 8
}
]
}
This endpoint returns a checkout instance on with a Crypto Address.
HTTP Request
GET /api/v1/merchant/transactions/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| Code | The Symbol of the Asset | False |
| Status | The Status | False |
| Balance | The current balance | False |
Register Bank Account
curl -X POST "https://sandbox.midchains.com/pay/api/v1/merchant/bank_accounts/" \
-H "{Content-Type : application/json}" \
-H "{Authorization : Token $token}" \
-d "{ Currency : AED , }"
-d "{AccountHolderName : Joe Blogs}"
-d "{AccountNumber : 1176328262}"
-d "{Iban : AIBK1231231236}"
-d "{Swift : TEST}"
-d "{BankName : ADCB}"
-d "{BankAddress : 123 Fake Street}"
-d "{Active : True}"
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status":"success",
"data":{
"Merchant":"Pay-60108c19-feae-468e-9917-61bc8342c540",
"Currency":"AED",
"AccountHolderName":"Matthew",
"AccountNumber":"AccountNumber",
"Iban":"AIBK12312312376",
"Swift":"TEST",
"BankName":"ADCB",
"BankAddress":"123 Fake Street",
"Default":false,
"Active":true
}
}
This endpoint registers a bank account for settlement of funds.
HTTP Request
POST /api/v1/merchant/bank_accounts/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| Currency | The currency Symbol (FIAT) | True |
| AccountHolderName | The Account holders Name | True |
| AccountNumber | The Account number | True |
| Iban | The Bank accounts Iban | True |
| BankName | The Name of the Bank | True |
| BankAddress | The Address of the bank | True |
| Swift | Banks Swift Code | False |
| Default | Bank account is your Default | False |
| Active | Active status of the Account | False |
GET Bank Accounts
curl -X POST "https://sandbox.midchains.com/pay/api/v1/merchant/bank_accounts/" \
-H "{Content-Type : application/json}" \
-H "{Authorization : Token $token}" \
-d "{ Currency : AED , }"
-d "{AccountHolderName : Joe Blogs}"
-d "{AccountNumber : 1176328262}"
-d "{Iban : AIBK1231231236}"
-d "{Swift : TEST}"
-d "{BankName : ADCB}"
-d "{BankAddress : 123 Fake Street}"
-d "{Active : True}"
The above command returns a 200 HTTP Status Code and JSON structured like this:
{
"status":"success",
"data": [
{
"Merchant":"Pay-60108c19-feae-468e-9917-61bc8342c540",
"Currency":"AED",
"AccountHolderName":"Matthew",
"AccountNumber":"AccountNumber",
"Iban":"AIBK12312312376",
"Swift":"TEST",
"BankName":"ADCB",
"BankAddress":"123 Fake Street",
"Default":false,
"Active":true
}
]
}
This endpoint registers a bank account for settlement of funds.
HTTP Request
GET /api/v1/merchant/bank_accounts/
URL Parameters
| Parameter | Description | Required |
|---|---|---|
| Currency | The currency Symbol (FIAT) | False |
| AccountHolderName | The Account holders Name | False |
| AccountNumber | The Account number | False |
| Iban | The Bank accounts Iban | False |
| BankName | The Name of the Bank | False |
| BankAddress | The Address of the bank | False |
| Swift | Banks Swift Code | False |
| Default | Bank account is your Default | False |
| Active | Active status of the Account | False |
WEBHOOK
Configuring a listener
MidChains Payments will send Webhook messages to the endpoints specified by relevant Merchant and their Payment Service Provider. MidChains will send notifications whether the payment has been received and amount details.
If you are facing issues receiving webhook messages, there is an endpoint to request a resend of all messages that have not been delivered.
Errors
The MidChain Pay API uses the following error codes:
| Error Code | Meaning |
|---|---|
| 400 | Bad Request -- Your request is invalid. |
| 401 | Unauthorized -- Your API key is wrong. |
| 403 | Forbidden -- You do not have acces to this endpoint. |
| 404 | Not Found -- The page you have request has not been found. |
| 405 | Method Not Allowed -- Request method is not allowed. |
| 406 | Not Acceptable -- You requested a format that isn't json. |
| 410 | Gone -- The endpoint requested has been removed from our servers. |
| 429 | Too Many Requests -- Too many requests to the system. |
| 500 | Internal Server Error -- We encountered an error in our server. Please try again later. |
| 503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |