Quick start

2021-03-23 14:32:32


Welcome to the API documentation of MODEN. From start-ups to corporate businesses, MODEN will help you manage the customer experience from start to finish.

In this document, you will find a tutorial and a complete API reference.

 

Claim


 

Before you start, you need to open a "merchant account" first, and we will review the application within 48 hours. After passing the review, you can obtain the APP ID and key through the following steps:

  1. login account
  2. "My Workbench" in the upper right corner of the navigation bar
  3. Check the APP ID and key in the settings

 

Basic URL and environment


 

All endpoints are REST ful:

The sandbox environment allows you to run tests without affecting real-time data.

After the sandbox test is completed, after confirming that there is no problem, just change the URL to the "production" URL to put it into the official environment.

 

Authentication


 

To use identity authentication, you need app id and secret.

1. Encode your app id and secret

Use Base64 to encode your app id and secret without spaces, separated by colons.

// example
$ echo -n myapp_id:secret | base64
bXshJklQG5leGlvaHViLmNvbTpteXBhc3N3b2lK

2. Create an authorization title

Use the value in step 1 as the content and add a string in front”Basic”

// example
Authorization: Basic bXshJklQG5leGlvaHViLmNvbTpteXBhc3N3b2lK

3. Send the request

Include the string in step 2 in the authorization header of the API request.

// example
curl -X POST https://api.modenpay.io/pay/inquire/wallet \
	-H 'Accept: application/json' \
	-H 'Authorization: Basic bXshJklQG5leGlvaHViLmNvbTpteXBhc3N3b2lK'

 

Create the first request


 

A good place to get acquainted with our API is by sending a "check balance" request to the server.

If the request is successful, the corresponding json information will be returned.

 

Send a request to the server through POST.

Example:

curl -X POST https://api.modenpay.io/pay/inquire/wallet \
	-H 'Accept: application/json' \
	-H 'Authorization: Basic <Your Basic Auth>'

 

If everything goes well, you get a response with a status of 200

{
	"status" : "success",
	"data" : {
		"totalAssets" : 0.000000,
		"coin" : "USDT"
	}
}

 

Of course, you may also get a response with a status of 412

{
	"status" : "fail",
	"code" : 10000,
	"message" : "xxxxxxx"
}

This is an error json return, you can find the corresponding error information according to the error code code. Error code reference table

 

Next step


 

After you successfully send the first request, you can perform the following tasks according to your needs.