NAV
cURL NodeJS PHP Go Python

介绍

Mimos Commerce提供了一个简单而强大的REST API,可将加密货币付款集成到您的业务或应用程序中。 该API参考文档提供了有关可用服务的可访问点以及如何与它们交互的信息。

API入口: https://api.mimos.io/crypto-checkout/

接入指南

MimosPay作为支付方式

通过MimosPay接受付款,需要在API请求带上Token。并且在请求发送之前需要进行密码签名。

获取API Key

设置 -> API Keys页面中创建生成API Key。

  1. 点击添加API Key
  2. 填写表单内容
    • 标签, 比如: e电商平台
    • 支付成功跳转地址
    • 支付失败跳转地址
    • Webhook地址,用于接收MimosPay推送事件的
  3. 继续点击按钮生成API KEY
  4. 点击复制API KEY或者手动复制以保存创建生成的新API Key和API Secret

提示:

对请求签名

Request Headers Example

[
  ...
  "X-MM-APP-ID": "6e1dd7ce21874898b0b77b3288f006fa",
  "X-MM-TIMESTAMP": 1594127461389,
  "X-MM-NONCE": "2hjkr7iveci"
  ...
]

Request Body Example

{
  "external_order_id":"3qqx2a6vd96x67c91cplq",
  "name":"iphone 11",
  "price":"599",
  "currency":"USD",
  "metadata":"{\"image_url\":\"https://images-na.ssl-images-amazon.com/images/I/61wjAvw5B2L._AC_SX425_.jpg\",\"customer_id\":\"123456\",\"customer_name\":\"my-user-name\"}"
}
# Assume the API key is '6e1dd7ce21874898b0b77b3288f006fa'
A = 'X-MM-APP-ID=6e1dd7ce21874898b0b77b3288f006fa&external_order_id=3qqx2a6vd96x67c91cplq&name=iphone 11&price=599&currency=USD&metadata={"image_url":"https://images-na.ssl-images-amazon.com/images/I/61wjAvw5B2L._AC_SX425_.jpg","customer_id":"123456","customer_name":"my-user-name"}&X-MM-TIMESTAMP=1594647652397&X-MM-NONCE=2hjkr7iveci'

stringA= 'X-MM-APP-ID=6e1dd7ce21874898b0b77b3288f006fa&X-MM-NONCE=2hjkr7iveci&X-MM-TIMESTAMP=1594647652397&currency=USD&external_order_id=3qqx2a6vd96x67c91cplq&metadata={"image_url":"https://images-na.ssl-images-amazon.com/images/I/61wjAvw5B2L._AC_SX425_.jpg","customer_id":"123456","customer_name":"my-user-name"}&name=iphone 11&price=599'

# Assume the API Secret is '1bbbwkGuHBZhnVatOrglZyeiBzuOvYvKgNvzZCWlQHqh6m0uHWpE5h95H62BSnymJL'
stringB= stringA + '&key=1bbbwkGuHBZhnVatOrglZyeiBzuOvYvKgNvzZCWlQHqh6m0uHWpE5h95H62BSnymJL'

# MD5, '416D616F6F796778DAC3EEF2F179739D'
signatureVal = MD5(stringB).toUpperCase()

# HmacSHA256, '6BCABDD525CAE130F52D614C4F7B26727C6EDFD28777A2A76B717002E7136721'
signatureVal = HmacSHA256(stringB, secrect).toUpperCase()

Request samples

# You can also use wget
curl -X POST https://api.mimos.io/crypto-checkout/v1/charges \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'X-MM-APP-ID: 6e1dd7ce21874898b0b77b3288f006fa' \
  -H 'X-MM-TIMESTAMP: 1594127461389' \
  -H 'X-MM-SIGNATURE: 416D616F6F796778DAC3EEF2F179739D' \
  -H 'X-MM-NONCE: 2hjkr7iveci'
  --data-binary '{"external_order_id":"3qqx2a6vd96x67c91cplq","name":"iphone 11","price":"599","currency":"USD","metadata":"{\"image_url\":\"https://images-na.ssl-images-amazon.com/images/I/61wjAvw5B2L._AC_SX425_.jpg\",\"customer_id\":\"123456\",\"customer_name\":\"my-user-name\"}"}'
const fetch = require('node-fetch');
const inputBody = {
  "metadata": "{\"image_url\":\"https://images-na.ssl-images-amazon.com/images/I/61wjAvw5B2L._AC_SX425_.jpg\",\"customer_id\":\"123456\",\"customer_name\":\"my-user-name\"}",
  "price": "599",
  "name": "iphone 11",
  "external_order_id": "3qqx2a6vd96x67c91cplq",
  "currency": "USD"
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'X-MM-APP-ID':'6e1dd7ce21874898b0b77b3288f006fa',
  'X-MM-TIMESTAMP':'1594127461389',
  'X-MM-SIGNATURE':'416D616F6F796778DAC3EEF2F179739D',
  'X-MM-NONCE':'2hjkr7iveci'
};

fetch('https://api.mimos.io/crypto-checkout/v1/charges',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'X-MM-APP-ID' => '6e1dd7ce21874898b0b77b3288f006fa',
    'X-MM-TIMESTAMP' => '1594127461389',
    'X-MM-SIGNATURE' => '416D616F6F796778DAC3EEF2F179739D',
    'X-MM-NONCE' => '2hjkr7iveci',
);

$client = new \GuzzleHttp\Client(['base_uri' => 'https://api.mimos.io:443/crypto-checkout/v1/']);

// Define array of request body.
$request_body = array(
  "external_order_id": "3qqx2a6vd96x67c91cplq",
  "price": "599",
  "name": "iphone 11",
  "currency": "USD"
  'metadata': '{"image_url": "https://images-na.ssl-images-amazon.com/images/I/61wjAvw5B2L._AC_SX425_.jpg","customer_id":"123456","customer_name":"my-user-name"}',
);

try {
    $response = $client->request('POST','charges', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }
 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "X-MM-APP-ID": []string{"6e1dd7ce21874898b0b77b3288f006fa"},
        "X-MM-TIMESTAMP": []string{"1594127461389"},
        "X-MM-SIGNATURE": []string{"416D616F6F796778DAC3EEF2F179739D"},
        "X-MM-NONCE": []string{"2hjkr7iveci"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.mimos.io/crypto-checkout/v1/charges", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'X-MM-APP-ID': '6e1dd7ce21874898b0b77b3288f006fa',
  'X-MM-TIMESTAMP': '1594127461389',
  'X-MM-SIGNATURE': '416D616F6F796778DAC3EEF2F179739D',
  'X-MM-NONCE': '2hjkr7iveci'
}

r = requests.post('https://api.mimos.io/crypto-checkout/v1/charges', data = payload, headers = headers)

print(r.json())

  1. 准备请求头和请求内容

    • X-MM-APP-ID, 你的API Key
    • X-MM-TIMESTAMP, API请求带上UTC时间戳,以毫秒为单位。客户端时间戳和系统时间戳最多允许5分钟的时间差,超过此范围将会返回Invalid X-MM-TIMESTAMP异常
    • X-MM-NONCE, 唯一的随机字符串用于防止重复请求
    • 请求主体内容
  2. 将请求头和请求内容以key-value格式按照ASCII码升序排序(value不为空)并以URL键值对(比如:key1=value1&key2=value2…)拼接成字符串stringA
    请留意以下规则:

    • 参数名ASCII码从小到大排序(字典序)
    • 参数的值为空不参与签名
    • 参数名区分大小写
    • 如果参数的值是一个JSON对象或数组,需要将它进行字符串化处理
  3. 再将API Secrect作为key的值拼接到stringA中得到stringB

  4. 最后使用MD5对stringB做摘要并将结果转换成全部大写的signatureVal

发送请求

更多详情,请参考创建充值(收款)订单

订阅事件

Webhook Example - Headers

[
  ...
  "X-MM-APP-ID": "6e1dd7ce21874898b0b77b3288f006fa"
  "X-MM-NONCE": "15aea03df5cb4f1092c6d15ad0460c59"
  "X-MM-SIGNATURE": "14D6A89E4FA1F60B00DB47B379BE3B52"
  "CONTENT-TYPE": "application/json"
  "CONTENT-LENGTH": 1354
  ...
]

Webhook Example - Body Payload

{
  "id": "tpxXfXTxY7",
  "type": "charge:complete",
  "create_at": "2020-07-09T01:23:04.632Z",
  "data": {
    "order_identifier": "3v9YNZzCpG4ltpwgdFDcTR",
    "external_order_id": "nk8yl77ffy8m74oxq0f9gi",
    "name": "iphone 11",
    "amount": "599",
    "currency": "CNY",
    "payment_method": "ethereum",
    "type": "FIXED_VALUE",
    "created_at": "1594300750683",
    "expired_at": "1594301050683",
    "state": "COMPLETE",
    "sub_state": "NONE",
    "addresses": {
      "ethereum": "0x983eB33A8Bf4D17A600dEaC6cb95E94CF1F3D8EB"
    },
    "payments": [
      {
        "network": "ethereum",
        "tx_hash": "0x8d86e3e73aba33806e830a034d1442cd286380c6ff8d989e66d8d3afaaaf35d5",
        "tx_index": "2",
        "amount": "0.352212",
        "currency": "ETH",
        "base_amount": "599",
        "state": "COMPLETE",
        "detected_at": "1594300924112",
        "confirmed_at": "1594300984154",
        "block": {
          "network_id": "5",
          "height": "3016320",
          "hash": "0xf8933c1cebef545e9a5f8e3eacdd3633fc16d68f8290b0dacf5b1bc4ee0a44be",
          "time": "1594300924112",
          "required_confirmed": "6",
          "accumulated_confirmed": "6",
          "forked": false
        }
      }
    ],
    "metadata": "{\"image_url\": \"https://images-na.ssl-images-amazon.com/images/I/61wjAvw5B2L._AC_SX425_.jpg\", \"customer_id\": \"123456\", \"customer_name\": \"my-user-name\"}",
    "charge_url": "https://w.dev.mimos.io/crypto-checkout/3v9YNZzCpG4ltpwgdFDcTR",
    "required_info": {
      "bill_address": true,
      "customer_name": false
    },
    "bill_address": "test@mimos.io",
    "recipient_name": "test-new-api",
    "crypto_amount": "0.352212",
    "crypto_currency": "ETH"
  }
}

设置里订阅(设置Webhook地址)后,你将会收到对应的事件。

所有MimosPay的Webhook请求都会包含以下请求头,

建议你在收到Webhook请求后,对请求内容进行签名校验

签名的内容包含,

签名方式参考规则

更多详情,请参考Resource - Event.

充值(收款)

创建充值(收款)订单

你需要创建一笔充值(收款)订单来接受加密货币付款

Code samples

# You can also use wget
curl -X POST https://api.mimos.io/crypto-checkout/v1/charges \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'X-MM-APP-ID: 6e1dd7ce21874898b0b77b3288f006fa' \
  -H 'X-MM-TIMESTAMP: 1594643572157' \
  -H 'X-MM-SIGNATURE: B0499D4EDF0D82A6B18C192311C0C97C' \
  -H 'X-MM-NONCE: ttmx9loxhtl'
  --data-binary '{"external_order_id":"yz7ls58srfih1zmr4dw6y","name":"iphone 11","price":"599","currency":"USD","metadata":"{\"image_url\":\"https://images-na.ssl-images-amazon.com/images/I/61wjAvw5B2L._AC_SX425_.jpg\",\"customer_id\":\"123456\",\"customer_name\":\"my-user-name\"}"}'
const fetch = require('node-fetch');
const inputBody = {
  "metadata": "{\"image_url\":\"https://images-na.ssl-images-amazon.com/images/I/61wjAvw5B2L._AC_SX425_.jpg\",\"customer_id\":\"123456\",\"customer_name\":\"my-user-name\"}",
  "price": "599",
  "name": "iphone 11",
  "external_order_id": "yz7ls58srfih1zmr4dw6y",
  "currency": "USD"
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'X-MM-APP-ID':'6e1dd7ce21874898b0b77b3288f006fa',
  'X-MM-TIMESTAMP':'1594643572157',
  'X-MM-SIGNATURE':'B0499D4EDF0D82A6B18C192311C0C97C',
  'X-MM-NONCE':'ttmx9loxhtl'
};

fetch('https://api.mimos.io/crypto-checkout/v1/charges',
{
  method: 'POST',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'X-MM-APP-ID' => '6e1dd7ce21874898b0b77b3288f006fa',
    'X-MM-TIMESTAMP' => '1594643572157',
    'X-MM-SIGNATURE' => 'B0499D4EDF0D82A6B18C192311C0C97C',
    'X-MM-NONCE' => 'ttmx9loxhtl',
);

$client = new \GuzzleHttp\Client(['base_uri' => 'https://api.mimos.io:443/crypto-checkout/v1/']);

// Define array of request body.
$request_body = array(
  "external_order_id": "yz7ls58srfih1zmr4dw6y",
  "price": "599",
  "name": "iphone 11",
  "currency": "USD"
  'metadata': '{"image_url": "https://images-na.ssl-images-amazon.com/images/I/61wjAvw5B2L._AC_SX425_.jpg","customer_id":"123456","customer_name":"my-user-name"}',
);

try {
    $response = $client->request('POST','charges', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }
 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "X-MM-APP-ID": []string{"6e1dd7ce21874898b0b77b3288f006fa"},
        "X-MM-TIMESTAMP": []string{"1594643572157"},
        "X-MM-SIGNATURE": []string{"B0499D4EDF0D82A6B18C192311C0C97C"},
        "X-MM-NONCE": []string{"ttmx9loxhtl"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.mimos.io/crypto-checkout/v1/charges", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

import json
import requests
import hashlib

appId = '9b0798f2971148ba9828820612ae34bb'
appKey = 'gPGZwIu7r5bVP6B8q0HDrEtpM8VOqkTEjXkdfh4lGjYUum7h5ohYoJEfcmaxVork'
timestamp = 1595497196656

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'X-MM-APP-ID': appId,
  'X-MM-TIMESTAMP': "{}".format(timestamp),
  'X-MM-SIGNATURE': 'B0499D4EDF0D82A6B18C192311C0C97C',
  'X-MM-NONCE': 'ttmx9loxhtl'
}

payload = {
  "metadata": "{\"image_url\":\"https://images-na.ssl-images-amazon.com/images/I/61wjAvw5B2L._AC_SX425_.jpg\",\"customer_id\":\"123456\",\"customer_name\":\"my-user-name\"}",
  "price": "599",
  "name": "iphone 11",
  "external_order_id": "order-ad-{}".format(timestamp),
  "currency": "USD"
}

total = {'X-MM-APP-ID': headers['X-MM-APP-ID'], 'X-MM-NONCE': headers['X-MM-NONCE'],
         'X-MM-TIMESTAMP': headers['X-MM-TIMESTAMP']}

# add payload TotalPrapameter
for k in list(payload.keys()):
   total[k]=payload[k]

t_keys = list(total.keys())
t_keys.sort()

stringA = ""
for k in t_keys :
  stringA+= "{}={}&".format(k, total[k])

stringA+= "key={}".format(appKey)

m = hashlib.md5()
m.update(stringA.encode("utf-8"))
h = m.hexdigest().upper()

headers['X-MM-SIGNATURE'] = h

r = requests.post('https://api.dev.mimos.io/crypto-checkout/v1/charges', data = json.dumps(payload), headers = headers)

print(r.json())

HTTP请求

POST /v1/charges

Body parameter

{
  "external_order_id":"yz7ls58srfih1zmr4dw6y",
  "name":"iphone 11",
  "price":"599",
  "currency":"USD",
  "metadata":"{\"image_url\":\"https://images-na.ssl-images-amazon.com/images/I/61wjAvw5B2L._AC_SX425_.jpg\",\"customer_id\":\"123456\",\"customer_name\":\"my-user-name\"}"
}

请求头

Name Type Required Description
X-MM-APP-ID string true 你的API Key
X-MM-TIMESTAMP number true UTC时间戳,以毫秒为单位, 5分钟内数据有效
X-MM-NONCE string true 唯一的随机字符串, 防止重复提交
X-MM-SIGNATURE string true 请求内容的签名

请求主体

Name Type Required Description
external_order_id string true 商户系统中的订单号
name string true 商品订单名称
price number true 本地法币价格
currency string true 本地法币币种, 请参考支持的法币币种
metadata string false 商户自定义内容,JSON格式并字符串化
MimosPay支持的字段,如下:
  • image_url: 客户将在收银台页面看到的图片缩略图,地址格式应以http(s)开头,并且以后缀作为结尾jpg|gif|png|jpeg|svg
success_redirect_url string false 设置(覆盖)支付成功后的跳转地址
failure_redirect_url string false 设置(覆盖)支付失败后的跳转地址
webhook_url string false 设置(覆盖)Webhook回调地址

请求响应

Response Examples,

{
  "status":"201",
  "code":"0",
  "message":"created",
  "data":{
    "merchant_id":"117510825734795264",
    "order_id":"37877858784210944",
    "order_identifier":"3v9YNZzCpG41vgMGZtRLPD",
    "external_order_id":"yz7ls58srfih1zmr4dw6y",
    "name":"iphone 11",
    "amount":"599",
    "currency":"USD",
    "type":"FIXED_VALUE",
    "created_at":"1594643585263",
    "expired_at":"1594644485263",
    "state":"PRE_ORDER",
    "sub_state":"NONE",
    "charge_pricing":{
      "ethereum":{
        "amount":"2.460093",
        "currency":"ETH"
      }
    },
    "metadata":"{\"image_url\":\"https://images-na.ssl-images-amazon.com/images/I/61wjAvw5B2L._AC_SX425_.jpg\",\"customer_id\":\"123456\",\"customer_name\":\"my-user-name\"}",
    "charge_url":"https://w.mimos.io/crypto-checkout/3v9YNZzCpG41vgMGZtRLPD",
    "required_info":{
      "bill_address":true,
      "customer_name":false
    },
    "recipient_name":"test-new-api"
  }
}
# Invalid X-MM-TIMESTAMP
{
  "status":"400",
  "code":"22000004",
  "message":"Invalid X-MM-TIMESTAMP",
  "error":{
    "module":"22",
    "module_name":"CHECKOUT_API",
    "code":"22000004",
    "message":"Invalid X-MM-TIMESTAMP",
    "key":"biz.invalid.request.timestamp"
  }
}
Status Meaning Description Schema
201 Created Created ApiResponse
400 Bad Request Bad Request ApiResponse
404 Not Found Not Found ApiResponse
500 Internal Server Error Internal Server Error ApiResponse

更新充值(收款)订单

如果在创建订单时候,包含了必填信息的设置,客户将需要填写必要信息以继续支付。默认必填信息:用户账单邮件地址,支付方式。

同时MimosPay将提供加密货币地址,以接收当前充值(收款)。

客户应该订单超时前进行加密货币的付款。

Code samples

# You can also use wget
curl -X PUT https://api.mimos.io/crypto-checkout/v1/charges/{order_identifier} \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'
  --data-binary '{"payment_method":"ethereum","bill_address":"test@test.io"}'
const fetch = require('node-fetch');
const inputBody = {
  "bill_address":"test@test.io",
  "payment_method":"ethereum"
};
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'
};

fetch('https://api.mimos.io/crypto-checkout/v1/charges/{order_identifier}',
{
  method: 'PUT',
  body: JSON.stringify(inputBody),
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
);

$client = new \GuzzleHttp\Client(['base_uri' => 'https://api.mimos.io:443/crypto-checkout/v1/']);

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('PUT','{orderIdentifier}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PUT", "https://api.mimos.io/crypto-checkout/v1/charges/{order_identifier}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

payload = {
  "bill_address":"test@test.io",
  "payment_method":"ethereum"
}
r = requests.put('https://api.mimos.io/crypto-checkout/v1/charges/{order_identifier}', data = payload, headers = headers)

print(r.json())

HTTP请求

PUT /v1/charges/{order_identifier}

Request Path

order_identifier: 订单唯一标识符

请求参数

Body parameter

{
  "payment_method":"ethereum",
  "bill_address":"test@test.io"
}

请求主体

Name Type Required Description
payment_method string true 支付方式,参考:支持的加密货币币种:
  • ethereum
  • bitcoin
  • tether
bill_address string false 客户电子邮箱地址,用于接收支付或是退款状态通知
customer_name string false 客户名

请求响应

Response Examples,

{
  "status":"200",
  "code":"0",
  "message":"success",
  "data":{
    "merchant_id":"117510825734795264",
    "order_id":"37877858784210944",
    "order_identifier":"3v9YNZzCpG41vgMGZtRLPD",
    "external_order_id":"yz7ls58srfih1zmr4dw6y",
    "name":"iphone 11",
    "amount":"599",
    "remain_amount":"599",
    "currency":"USD",
    "payment_method":"ethereum",
    "type":"FIXED_VALUE",
    "created_at":"1594643932916",
    "expired_at":"1594644232916",
    "state":"NEW",
    "sub_state":"NONE",
    "addresses":{
      "ethereum":"0xd5f7fEE1f0E0dCecccc80a847fE57e9DEcDDad88"
    },
    "charge_pricing":{
      "ethereum":{
        "amount":"2.460692",
        "currency":"ETH"
      }
    },
    "metadata":"{\"image_url\": \"https://images-na.ssl-images-amazon.com/images/I/61wjAvw5B2L._AC_SX425_.jpg\", \"customer_id\": \"123456\", \"customer_name\": \"my-user-name\"}",
    "charge_url":"https://w.mimos.io/crypto-checkout/3v9YNZzCpG41vgMGZtRLPD",
    "required_info":{
      "bill_address":true,
      "customer_name":false
    },
    "bill_address":"test@test.io",
    "recipient_name":"test-new-api",
    "crypto_amount":"2.460692",
    "crypto_currency":"ETH"
  }
}
Status Meaning Description Schema
200 OK OK ApiResponse
404 Not Found Not Found ApiResponse
500 Internal Server Error Internal Server Error ApiResponse

查询充值(收款)订单

通过订单唯一标识符查询订单详细信息。创建订单成功时,也会返回当前订单详细信息。

Code samples

# You can also use wget
curl -X GET https://api.mimos.io/crypto-checkout/v1/charges/{order_identifier} \
  -H 'Accept: application/json'
const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'
};

fetch('https://api.mimos.io/crypto-checkout/v1/charges/{order_identifier}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
);

$client = new \GuzzleHttp\Client(['base_uri' => 'https://api.mimos.io:443/crypto-checkout/v1/']);

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','{orderIdentifier}', array(
        'headers' => $headers,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.mimos.io/crypto-checkout/v1/charges/{order_identifier}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('https://api.mimos.io/crypto-checkout/v1/charges/{order_identifier}', headers = headers)

print(r.json())

HTTP请求

GET /v1/charges/{order_identifier}

Request Path

order_identifier: 订单唯一标识符

请求参数

Name Type Required Description
show_details boolean false 显示详细信息,默认:是

Example responses

200 Response, show_details = false

{
  "status":"200",
  "code":"0",
  "message":"success",
  "data":{
    "merchant_id":"117510825734795264",
    "order_id":"37870665871618048",
    "order_identifier":"3v9YNZzCpG41vgz5kCjwyK",
    "external_order_id":"c3yo4kmimhw0v8924ch36m9",
    "name":"iphone 11",
    "amount":"99",
    "remain_amount":"0.01",
    "currency":"CNY",
    "payment_method":"ethereum",
    "type":"FIXED_VALUE",
    "created_at":"1594641884350",
    "expired_at":"1594642184350",
    "state":"CANCEL",
    "sub_state":"UNDERPAID",
    "metadata":"{\"image_url\": \"https://images-na.ssl-images-amazon.com/images/I/61wjAvw5B2L._AC_SX425_.jpg\", \"customer_id\": \"123456\", \"customer_name\": \"my-user-name\"}",
    "charge_url":"https://w.mimos.io/crypto-checkout/3v9YNZzCpG41vgz5kCjwyK",
    "required_info":{
      "bill_address":true,
      "customer_name":false
    },
    "bill_address":"test@aerohive.com",
    "recipient_name":"test-new-api",
    "crypto_amount":"0.057915",
    "crypto_currency":"ETH"
  }

200 Response, show_details = true

{
  "status":"200",
  "code":"0",
  "message":"success",
  "data":{
    "merchant_id":"117510825734795264",
    "order_id":"37870665871618048",
    "order_identifier":"3v9YNZzCpG41vgz5kCjwyK",
    "external_order_id":"c3yo4kmimhw0v8924ch36m9",
    "name":"iphone 11",
    "amount":"99",
    "remain_amount":"0.01",
    "currency":"CNY",
    "payment_method":"ethereum",
    "type":"FIXED_VALUE",
    "created_at":"1594641884350",
    "expired_at":"1594642184350",
    "state":"CANCEL",
    "sub_state":"UNDERPAID",
    "addresses":{
      "ethereum":"0x0A4C37559feE8EbB30d21242E370e332564d60C1"
    },
    "charge_pricing":{
      "ethereum":{
        "amount":"0.000004",
        "currency":"ETH"
      }
    },
    "payments":[
      {
        "network":"ethereum",
        "tx_hash":"0x7932bc20a7cfe2343e7d8ca08fb613d47465725f11a109a837be16070b89ffb1",
        "tx_index":"0",
        "amount":"0.057911",
        "currency":"ETH",
        "base_amount":"98.99",
        "state":"COMPLETE",
        "detected_at":"1594642153956",
        "confirmed_at":"1594642212623",
        "block":{
          "network_id":"5",
          "height":"3039067",
          "hash":"0x37d5cd540512590692a23a2be0c7a553e328aad3a1835660fe2666a5bdab8dc0",
          "time":"1594642153956",
          "required_confirmed":"6",
          "accumulated_confirmed":"6",
          "forked":false
        }
      }
    ],
    "metadata":"{\"image_url\": \"https://images-na.ssl-images-amazon.com/images/I/61wjAvw5B2L._AC_SX425_.jpg\", \"customer_id\": \"123456\", \"customer_name\": \"my-user-name\"}",
    "charge_url":"https://w.mimos.io/crypto-checkout/3v9YNZzCpG41vgz5kCjwyK",
    "required_info":{
      "bill_address":true,
      "customer_name":false
    },
    "bill_address":"test@aerohive.com",
    "recipient_name":"test-new-api",
    "crypto_amount":"0.057915",
    "crypto_currency":"ETH",
    "refunds":[
      {
        "network":"ethereum",
        "to_address":"0x0Ad3355B3023f73a2C443Fe2C8440735d1589596",
        "amount":"0.057911",
        "currency":"ETH",
        "state":"COMPLETE",
        "detected_at":"1594642448830",
        "confirmed_at":"1594642452707",
        "tx_hash":"0xe7c24562dcefc45c11c2716d88fb1ae52d4971295454a912fb2734711b6420a4",
        "tx_index":"1",
        "block":{
          "network_id":"5",
          "height":"3039087",
          "hash":"0x400a1111fcb8f3eec6c1e222b78260b1bbce8b58df97d8257cd5c53ca41f5564",
          "time":"1594642448742",
          "required_confirmed":"6",
          "accumulated_confirmed":"6",
          "forked":false
        }
      }
    ]
  }
}

请求响应

Status Meaning Description Schema
200 OK OK ApiResponse
400 Bad Request Bad Request ApiResponse
404 Not Found Not Found ApiResponse
500 Internal Server Error Internal Server Error ApiResponse

Webhooks

Webhooks (回调通知)可以帮助商户更及时的掌握充值(收款)相关事件。可以通过设置页面编辑你的API Key配置对应的URL来订阅事件。

Request Example - Headers

[
  ...
  "X-MM-APP-ID": "6e1dd7ce21874898b0b77b3288f006fa"
  "X-MM-NONCE": "15aea03df5cb4f1092c6d15ad0460c59"
  "X-MM-SIGNATURE": "14D6A89E4FA1F60B00DB47B379BE3B52"
  "CONTENT-TYPE": "application/json"
  "CONTENT-LENGTH": 1354
  ...
]

Request Example - Body Payload

{
  "id": "tpxXfXTxY7",
  "type": "charge:complete",
  "create_at": "2020-07-09T01:23:04.632Z",
  "data": {
    "order_identifier": "3v9YNZzCpG4ltpwgdFDcTR",
    "external_order_id": "nk8yl77ffy8m74oxq0f9gi",
    "name": "iphone 11",
    "amount": "599",
    "currency": "CNY",
    "payment_method": "ethereum",
    "type": "FIXED_VALUE",
    "created_at": "1594300750683",
    "expired_at": "1594301050683",
    "state": "COMPLETE",
    "sub_state": "NONE",
    "addresses": {
      "ethereum": "0x983eB33A8Bf4D17A600dEaC6cb95E94CF1F3D8EB"
    },
    "payments": [
      {
        "network": "ethereum",
        "tx_hash": "0x8d86e3e73aba33806e830a034d1442cd286380c6ff8d989e66d8d3afaaaf35d5",
        "tx_index": "2",
        "amount": "0.352212",
        "currency": "ETH",
        "base_amount": "599",
        "state": "COMPLETE",
        "detected_at": "1594300924112",
        "confirmed_at": "1594300984154",
        "block": {
          "network_id": "5",
          "height": "3016320",
          "hash": "0xf8933c1cebef545e9a5f8e3eacdd3633fc16d68f8290b0dacf5b1bc4ee0a44be",
          "time": "1594300924112",
          "required_confirmed": "6",
          "accumulated_confirmed": "6",
          "forked": false
        }
      }
    ],
    "metadata": "{\"image_url\": \"https://images-na.ssl-images-amazon.com/images/I/61wjAvw5B2L._AC_SX425_.jpg\", \"customer_id\": \"123456\", \"customer_name\": \"my-user-name\"}",
    "charge_url": "https://w.dev.mimos.io/crypto-checkout/3v9YNZzCpG4ltpwgdFDcTR",
    "required_info": {
      "bill_address": true,
      "customer_name": false
    },
    "bill_address": "test@mimos.io",
    "recipient_name": "test-new-api",
    "crypto_amount": "0.352212",
    "crypto_currency": "ETH"
  }
}
A = 'crypto_currency=ETH&amount=599&addresses={"ethereum":"0x983eB33A8Bf4D17A600dEaC6cb95E94CF1F3D8EB"}&metadata={"image_url": "https://images-na.ssl-images-amazon.com/images/I/61wjAvw5B2L._AC_SX425_.jpg", "customer_id": "123456", "customer_name": "my-user-name"}&sub_state=NONE&crypto_amount=0.352212&payments=[{"network":"ethereum","tx_hash":"0x8d86e3e73aba33806e830a034d1442cd286380c6ff8d989e66d8d3afaaaf35d5","tx_index":"2","amount":"0.352212","currency":"ETH","base_amount":"599","state":"COMPLETE","detected_at":"1594300924112","confirmed_at":"1594300984154","block":{"network_id":"5","height":"3016320","hash":"0xf8933c1cebef545e9a5f8e3eacdd3633fc16d68f8290b0dacf5b1bc4ee0a44be","time":"1594300924112","required_confirmed":"6","accumulated_confirmed":"6","forked":false}}]&created_at=1594300750683&expired_at=1594301050683&X-MM-NONCE=15aea03df5cb4f1092c6d15ad0460c59&type=FIXED_VALUE&bill_address=test@mimos.io&charge_url=https://w.dev.mimos.io/crypto-checkout/3v9YNZzCpG4ltpwgdFDcTR&order_identifier=3v9YNZzCpG4ltpwgdFDcTR&name=iphone 11&X-MM-APP-ID=6e1dd7ce21874898b0b77b3288f006fa&external_order_id=nk8yl77ffy8m74oxq0f9gi&currency=CNY&state=COMPLETE&recipient_name=test-new-api&payment_method=ethereum&required_info={"bill_address":true,"customer_name":false}'

stringA= 'X-MM-APP-ID=6e1dd7ce21874898b0b77b3288f006fa&X-MM-NONCE=15aea03df5cb4f1092c6d15ad0460c59&addresses={"ethereum":"0x983eB33A8Bf4D17A600dEaC6cb95E94CF1F3D8EB"}&amount=599&bill_address=test@mimos.io&charge_url=https://w.dev.mimos.io/crypto-checkout/3v9YNZzCpG4ltpwgdFDcTR&created_at=1594300750683&crypto_amount=0.352212&crypto_currency=ETH&currency=CNY&expired_at=1594301050683&external_order_id=nk8yl77ffy8m74oxq0f9gi&metadata={"image_url": "https://images-na.ssl-images-amazon.com/images/I/61wjAvw5B2L._AC_SX425_.jpg", "customer_id": "123456", "customer_name": "my-user-name"}&name=iphone 11&order_identifier=3v9YNZzCpG4ltpwgdFDcTR&payment_method=ethereum&payments=[{"network":"ethereum","tx_hash":"0x8d86e3e73aba33806e830a034d1442cd286380c6ff8d989e66d8d3afaaaf35d5","tx_index":"2","amount":"0.352212","currency":"ETH","base_amount":"599","state":"COMPLETE","detected_at":"1594300924112","confirmed_at":"1594300984154","block":{"network_id":"5","height":"3016320","hash":"0xf8933c1cebef545e9a5f8e3eacdd3633fc16d68f8290b0dacf5b1bc4ee0a44be","time":"1594300924112","required_confirmed":"6","accumulated_confirmed":"6","forked":false}}]&recipient_name=test-new-api&required_info={"bill_address":true,"customer_name":false}&state=COMPLETE&sub_state=NONE&type=FIXED_VALUE'

# Assue the API Secret is
'2ywkGuHBZhnVatOrglZyeiBzuOvYvKgNvzZCWlQHqh6m0uHWpE5h95H62BSnymJL'
stringB= stringA + '&key=2ywkGuHBZhnVatOrglZyeiBzuOvYvKgNvzZCWlQHqh6m0uHWpE5h95H62BSnymJL'

# MD5, '14D6A89E4FA1F60B00DB47B379BE3B52'
signatureVal = MD5(stringB).toUpperCase()

# HmacSHA256, '7E758388691B06E1CCFC92F73F934CDEFB71B913434DEF3FB925B2CCDA54D622'
signatureVal = HmacSHA256(stringB, secrect).toUpperCase()

使用Webhook的共享密钥来验证MimosPay发出的请求头里的X-MM-SIGNATURE

  1. 准备签名内容

    • X-MM-APP-ID, 你的API Key
    • X-MM-NONCE, 唯一的随机字符串用于防止重复请求
    • event.data,包含在请求主体中
  2. 将请求头和请求内容以key-value格式按照ASCII码升序排序(value不为空)并以URL键值对(比如:key1=value1&key2=value2…)拼接成字符串stringA
    请留意以下规则:

    • 参数名ASCII码从小到大排序(字典序)
    • 参数的值为空不参与签名
    • 参数名区分大小写
    • 如果参数的值是一个JSON对象或数组,需要将它进行字符串化处理
  3. 再将API Secrect作为key的值拼接到stringA中得到stringB

  4. 最后使用MD5对stringB做摘要并将结果转换成全部大写的signatureVal

资源定义

ApiResponse

Example,

{
  "status":"200",
  "code":"0",
  "message":"success",
  "data":{
    "order_identifier":"3v9YNZzCpG41vgz5kCjwyK",
    "external_order_id":"c3yo4kmimhw0v8924ch36m9",
    "name":"iphone 11",
    "amount":"99",
    "remain_amount":"0.01",
    ...
  }
}
{
  "status":"400",
  "code":"22000004",
  "message":"Invalid X-MM-TIMESTAMP",
  "error":{
    "module":"22",
    "module_name":"CHECKOUT_API",
    "code":"22000004",
    "message":"Invalid X-MM-TIMESTAMP",
    "key":"biz.invalid.request.timestamp"
  }
}
Name Type Description
status number HTTP status code
code number
  • 0 - success
  • Not zero number - error codes
message string success or error message
data object the object defined in resources when response 2xx
error object the error object when response 4xx or 5xx

Charge

Example,

{
  "merchant_id":"117510825734795264",
  "order_id":"37870665871618048",
  "order_identifier":"3v9YNZzCpG41vgz5kCjwyK",
  "external_order_id":"c3yo4kmimhw0v8924ch36m9",
  "name":"iphone 11",
  "amount":"99",
  "remain_amount":"0.01",
  "currency":"CNY",
  "payment_method":"ethereum",
  "type":"FIXED_VALUE",
  "created_at":"1594641884350",
  "expired_at":"1594642184350",
  "state":"CANCEL",
  "sub_state":"UNDERPAID",
  "addresses":{
    "ethereum":"0x0A4C37559feE8EbB30d21242E370e332564d60C1"
  },
  "charge_pricing":{
    "ethereum":{
      "amount":"0.000004",
      "currency":"ETH"
    }
  },
  "payments":[
    {
      "network":"ethereum",
      "tx_hash":"0x7932bc20a7cfe2343e7d8ca08fb613d47465725f11a109a837be16070b89ffb1",
      "tx_index":"0",
      "amount":"0.057911",
      "currency":"ETH",
      "base_amount":"98.99",
      "state":"COMPLETE",
      "detected_at":"1594642153956",
      "confirmed_at":"1594642212623",
      "block":{
        "network_id":"5",
        "height":"3039067",
        "hash":"0x37d5cd540512590692a23a2be0c7a553e328aad3a1835660fe2666a5bdab8dc0",
        "time":"1594642153956",
        "required_confirmed":"6",
        "accumulated_confirmed":"6",
        "forked":false
      }
    }
  ],
  "metadata":"{\"image_url\": \"https://images-na.ssl-images-amazon.com/images/I/61wjAvw5B2L._AC_SX425_.jpg\", \"customer_id\": \"123456\", \"customer_name\": \"my-user-name\"}",
  "charge_url":"https://w.dev.mimos.io/crypto-checkout/3v9YNZzCpG41vgz5kCjwyK",
  "required_info":{
    "bill_address":true,
    "customer_name":false
  },
  "bill_address":"test@aerohive.com",
  "recipient_name":"test-new-api",
  "crypto_amount":"0.057915",
  "crypto_currency":"ETH",
  "refunds":[
    {
      "network":"ethereum",
      "to_address":"0x0Ad3355B3023f73a2C443Fe2C8440735d1589596",
      "amount":"0.057911",
      "currency":"ETH",
      "state":"COMPLETE",
      "detected_at":"1594642448830",
      "confirmed_at":"1594642452707",
      "tx_hash":"0xe7c24562dcefc45c11c2716d88fb1ae52d4971295454a912fb2734711b6420a4",
      "tx_index":"1",
      "block":{
        "network_id":"5",
        "height":"3039087",
        "hash":"0x400a1111fcb8f3eec6c1e222b78260b1bbce8b58df97d8257cd5c53ca41f5564",
        "time":"1594642448742",
        "required_confirmed":"6",
        "accumulated_confirmed":"6",
        "forked":false
      }
    }
  ]
}
Name Type Description
merchant_id number The id of merchant
order_id number The id of charge order
checkout_id string The id of checkout order
order_identifier string The identifier of charge order
external_order_id string The order id of the merchant's own system
name string The product/order name
amount number Price in local fiat currency
remain_amount number The remaining price in local fiat currency
payment_method string Crypto payment methods, see Supported Crypto Currencies
bill_address string The email address from customer
customer_name string The name from customer
currency string Three-letter ISO currency code, in uppercase. Must be a supported currency
created_at number The UTC timestamp in millisecond of charge order creation time
expired_at number The UTC timestamp in millisecond of charge order expiration time
state string The charge state:
  • PRE_ORDER
  • NEW
  • PENDING
  • CONFIRMING
  • COMPLETE
  • CANCEL
sub_state string The charge sub state:
  • NONE
  • EXPIRED
  • UNDERPAID
  • OVERPAID
metadata string Metadata associated with the charge
charge_url string MimosPay Hosted charge URL
success_redirect_url string Merchant Hosted payment success redirect URL
failure_redirect_url string Merchant Hosted payment failure redirect URL
crypto_amount number Price in crypto currency
crypto_currency string The crypto currency code, in uppercase. Must be a supported currency
type string The type of charge,
  • FIXED_VALUE
  • ANY_VALUE
recipient_name string The name of recipient
unresolved_id number The unresolved id associated with the charge, if there exist the unresolved payment in,
  • EXPIRED
  • UNDERPAID
  • OVERPAID
required_info Charge Rquried The charge requirement information
addresses map<string, string> Set of addresses associated with the charge, the key is payment method
» additionalProperties string The associated crypto address
charge_pricing map<string, object> Set of price information associated with the charge, the key is payment method
» additionalProperties Charge Prices The associated price in the specific payment method
payments Charge Payment[] Array of charge payment objects
refunds Charge Refund[] Array of charge refund objects

Charge Price

Example,

{
  "amount": "12.232",
  "currency": "ETH"
}

Name Type Description
amount number Price in crypto currency
currency string The crypto currency code, in uppercase. Must be a supported currency

Charge Payments

Example,

{
  "network":"ethereum",
  "tx_hash":"0x9978bc4c44a9a14151d9cfeed557ab51feb6548b2c8f101b44a67a92091f1df7",
  "tx_index":"1",
  "from_address":"0x0ad3355b3023f73a2c443fe2c8440735d1589596",
  "amount":"0.001876",
  "currency":"ETH",
  "base_amount":"3.01",
  "state":"COMPLETE",
  "detected_at":"1593761577651",
  "confirmed_at":"1593761641110",
  "block":{
    "network_id":"5",
    "height":"2980446",
    "hash":"0xdfca138018a58ef29606084d59ec3d1b48221c71b2c52ae7904617a7c3a77b0b",
    "time":"1593761577651",
    "required_confirmed":"6",
    "accumulated_confirmed":"6",
    "forked":false,
  }
}

Name Type Description
network string Crypto network, see Supported Crypto Currencies
tx_hash string The blockchain transaction hash for the charge payment
tx_index number The blockchain transaction index for the charge payment
from_address string The address of customer which sent the crypto currency
amount number The amount of crypto currency sent to the requested address
currency string Crypto currency, see Supported Crypto Currencies
base_amount number The amount in fiat currency by currency conversion
base_currency string Fiat currency, see Supported Fiat Currencies
state string The payment state:
  • PENDING
  • FORKED
  • COMPLETE
detected_at number The UTC timestamp in millisecond of payment detection time
confirmed_at number The UTC timestamp in millisecond of payment confirmation time
block Block Tx none

Charge Refund

Exmaple,

{
  "network":"ethereum",
  "to_address":"0x0Ad3355B3023f73a2C443Fe2C8440735d1589596",
  "amount":"0.005866",
  "currency":"ETH",
  "state":"PENDING",
  "state_code":"1",
  "detected_at":"1594043557364",
  "confirmed_at":"0",
  "tx_hash":"0x6930b6d590c1468c479bd30dc3bfa1c7170cbc1834c2cfd47ac57ad7aaf82cf1",
  "tx_index":"1",
  "block":{
    "network_id":"5",
    "height":"2999165",
    "hash":"0xc057e1d2fa53b8ff64c272bbd4057bd5778d8b43a4e367839caaded051ddadae",
    "time":"1594043557252",
    "required_confirmed":"6",
    "accumulated_confirmed":"1",
    "forked":false
  }
}
Name Type Description
network string Crypto network, see Supported Crypto Currencies
tx_hash string The blockchain transaction hash for the charge payment
tx_index number The blockchain transaction index for the charge payment
to_address string The address of customer which receive the crypto currency
amount number The amount of crypto currency sent to the requested address
currency string Crypto currency, see Supported Crypto Currencies
state string The payment state:
  • NEW
  • PENDING
  • COMPLETE
  • CANCEL
detected_at number The UTC timestamp in millisecond of payment detection time
confirmed_at number The UTC timestamp in millisecond of payment confirmation time
fee number none
block Block Tx none

Charge Required Informations

Example,

{
  "payment_method":"ethereum",
  "bill_address":"test@test.io",
  "customer_name": "a_customer"
}
Name Type Description
payment_method string Payment method which is listed in Supported Crypto Currencies:
  • ethereum
  • bitcoin
  • tether
bill_address string Customer email address to receive payment or refund notifications
customer_name string Customer name for email content

Block Tx Information

Example,

{
  "network_id":"5",
  "height":"2999165",
  "hash":"0xc057e1d2fa53b8ff64c272bbd4057bd5778d8b43a4e367839caaded051ddadae",
  "time":"1594043557252",
  "required_confirmed":"6",
  "accumulated_confirmed":"1",
  "forked":false
}
Name Type Description
network_id number The id of network
height number The block height associated with the blockchain transaction
hash string The block hash associated with the blockchain transaction
time number The time at the block is mined
required_confirmed number The number of requried blockchain confirmations
accumulated_confirmed number The number of accumulated blockchain confirmations, it will stop giving updates on associated order is terminated
forked boolean The blockchain has a soft fork occurs or not on this block height

Event

Example,

{
  "id": "tpxXfXTxY7",
  "type": "charge:new",
  "create_at": "2020-07-01T01:23:04.632Z",
  "data": {
    ...
  }
}

Name Type Description
id string Delivery event id
type string Delivery event type,
  • charge:new
  • charge:pending
  • charge:confirming
  • charge:complete
  • charge:cancel
create_at string The UTC timestamp, e.g., 2020-07-01T01:23:04.632Z
data object Event payload,
The resouce of the associated object (e.g. charge)

The events types,

Event Description
charge:new A charge is created
charge:pending The Charge has been first detected on blockchain but has not been confrimed yet
charge:confirming The charge has been detected and the payment amount is equal or greater than order price but has not been confrimed yet
charge:complete The charge has be confirmed to completed
charge:cancel The charge failed to complete, for:
  • Payment expired
  • Payment underpaid

支持的货币

以下是和价格相关的货币列表。

法定货币

MimosPay当前支持ISO 4217中定义的货币列表。

Code Currency
AED United Arab Emirates Dirham
AFN Afghan Afghani
ALL Albanian Lek
AMD Armenian Dram
ANG Netherlands Antillean Guilder
AOA Angolan Kwanza
ARS Argentine Peso
AUD Australian Dollar
AWG Aruban Florin
AZN Azerbaijani Manat
BAM Bosnia-Herzegovina Convertible Mark
BBD Barbadian Dollar
BDT Bangladeshi Taka
BGN Bulgarian Lev
BHD Bahraini Dinar
BIF Burundian Franc
BMD Bermudan Dollar
BND Brunei Dollar
BOB Bolivian Boliviano
BRL Brazilian Real
BSD Bahamian Dollar
BTC Bitcoin
BTN Bhutanese Ngultrum
BWP Botswanan Pula
BYN Belarusian Ruble
BZD Belize Dollar
CAD Canadian Dollar
CDF Congolese Franc
CHF Swiss Franc
CLF Chilean Unit of Account (UF)
CLP Chilean Peso
CNH Chinese Yuan (Offshore)
CNY RMB
COP Colombian Peso
CRC Costa Rican Colón
CUC Cuban Convertible Peso
CUP Cuban Peso
CVE Cape Verdean Escudo
CZK Czech Republic Koruna
DJF Djiboutian Franc
DKK Danish Krone
DOP Dominican Peso
DZD Algerian Dinar
EGP Egyptian Pound
ERN Eritrean Nakfa
ETB Ethiopian Birr
EUR Euro
FJD Fijian Dollar
FKP Falkland Islands Pound
GBP British Pound Sterling
GEL Georgian Lari
GGP Guernsey Pound
GHS Ghanaian Cedi
GIP Gibraltar Pound
GMD Gambian Dalasi
GNF Guinean Franc
GTQ Guatemalan Quetzal
GYD Guyanaese Dollar
HKD Hong Kong Dollar
HNL Honduran Lempira
HRK Croatian Kuna
HTG Haitian Gourde
HUF Hungarian Forint
IDR Indonesian Rupiah
ILS Israeli New Sheqel
IMP Manx pound
INR Indian Rupee
IQD Iraqi Dinar
IRR Iranian Rial
ISK Icelandic Króna
JEP Jersey Pound
JMD Jamaican Dollar
JOD Jordanian Dinar
JPY Japanese yen
KES Kenyan Shilling
KGS Kyrgystani Som
KHR Cambodian Riel
KMF Comorian Franc
KPW North Korean Won
KRW South Korean Won
KWD Kuwaiti Dinar
KYD Cayman Islands Dollar
KZT Kazakhstani Tenge
LAK Laotian Kip
LBP Lebanese Pound
LKR Sri Lankan Rupee
LRD Liberian Dollar
LSL Lesotho Loti
LYD Libyan Dinar
MAD Moroccan Dirham
MDL Moldovan Leu
MGA Malagasy Ariary
MKD Macedonian Denar
MMK Myanma Kyat
MNT Mongolian Tugrik
MOP Macanese Pataca
MRO Mauritanian Ouguiya (pre-2018)
MRU Mauritanian Ouguiya
MUR Mauritian Rupee
MVR Maldivian Rufiyaa
MWK Malawian Kwacha
MXN Mexican Peso
MYR Malaysian Ringgit
MZN Mozambican Metical
NAD Namibian Dollar
NGN Nigerian Naira
NIO Nicaraguan Córdoba
NOK Norwegian Krone
NPR Nepalese Rupee
NZD New Zealand Dollar
OMR Omani Rial
PAB Panamanian Balboa
PEN Peruvian Nuevo Sol
PGK Papua New Guinean Kina
PHP Philippine Piso
PKR Pakistani Rupee
PLN Polish Zloty
PYG Paraguayan Guarani
QAR Qatari Rial
RON Romanian Leu
RSD Serbian Dinar
RUB Russian Ruble
RWF Rwandan Franc
SAR Saudi Riyal
SBD Solomon Islands Dollar
SCR Seychellois Rupee
SDG Sudanese Pound
SEK Swedish Krona
SGD Singapore Dollar
SHP Saint Helena Pound
SLL Sierra Leonean Leone
SOS Somali Shilling
SRD Surinamese Dollar
SSP South Sudanese Pound
STD São Tomé and Príncipe Dobra (pre-2018)
STN São Tomé and Príncipe Dobra
SVC Salvadoran Colón
SYP Syrian Pound
SZL Swazi Lilangeni
THB Thai Baht
TJS Tajikistani Somoni
TMT Turkmenistani Manat
TND Tunisian Dinar
TOP Tongan Pa'anga
TRY Turkish Lira
TTD Trinidad and Tobago Dollar
TWD New Taiwan Dollar
TZS Tanzanian Shilling
UAH Ukrainian Hryvnia
UGX Ugandan Shilling
USD United States dollar
UYU Uruguayan Peso
UZS Uzbekistan Som
VEF Venezuelan Bolívar Fuerte (Old)
VES Venezuelan Bolívar Soberano
VND Vietnamese Dong
VUV Vanuatu Vatu
WST Samoan Tala
XAF CFA Franc BEAC
XAG Silver Ounce
XAU Gold Ounce
XCD East Caribbean Dollar
XDR Special Drawing Rights
XOF CFA Franc BCEAO
XPD Palladium Ounce
XPF CFP Franc
XPT Platinum Ounce
YER Yemeni Rial
ZAR South African Rand
ZMW Zambian Kwacha
ZWL Zimbabwean Dollar

加密货币

Code Currency Payment Method/Network
BTC Bitcoin bitcoin
ETH Ethereum ethereum
USDT Tether-ERC20 tether

异常错误

MimosPay API接口使用以下HTTP中定义的错误代码,

Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The requested is hidden for administrators only.
404 Not Found -- The specified could not be found.
405 Method Not Allowed -- You tried to access a with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
410 Gone -- The requested has been removed from our servers.
429 Too Many Requests -- You're requesting too many kittens! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
502 Bad Gateway -- We had a problem with our gateway server and got an invalid response from another upstream server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.