Order creation

TIP

After the order is created, the interface will return the payment link, and the user will enter the cash register through the link to pay.

Interface address

POST https://api.tokenpay.me/v1/transaction/prepayment

Interface parameters

Name
Location
Type
Required
Description

app_id

header

string

Yes

Application ID, example value:8e4b8c2e7cxxxxxxxx1a1cbd3d59e0bd

mch_id

body

string

Yes

Merchant ID, example value:1234567890

description

body

string

No

Order description, example value:recharge

out_trade_no

body

string

Yes

Merchant order number, the merchant generates its own unique order number

expire_second

body

integer

Yes

Expiry date(second), example value:3600

amount

body

number

Yes

Order amount, example value:15000000

chain

body

string

Yes

Owned public chain, example value:TRON

currency

body

string

Yes

Currency, example value:TRX. View supported currencies

to_address

body

string

No

Collection wallet( Notes: payment wallet is required for the application of monitor order)

attach

body

string

No

Custom parameter. It returns as-is in the query API and payment notifications and can be used as a custom parameter. In practice, this field is returned only when the payment is complete.

locale

body

string

No

Language: zh_cn Chinese、 en English.Using cash register will display the default language based on this setting.

notify_url

body

string

No

Callback url, example value:https://xxx/xxx. Suggest using https

return_url

body

string

No

Return address, when payment is complete or fails, click the return button on the address. And it can be the https or the route of the app.

order_type

body

string

Yes

Payment method, example value: platform_order platform collection

Parameters example

{
  "app_id": "d549a3ac0e4641f998c6675fc539ba21",
  "mch_id": "1234567890",
  "description": "recharge",
  "out_trade_no": "fb72xxxx-xxxx-xxxx-xxxx-xxxx8a7b52cb",
  "expire_second": 600,
  "amount": 9,
  "chain": "TRON",
  "currency": "USDT",
  "to_address": "TQjxEW2Z3p9wjoxxxxxxxxgJUrWXBun91w",
  "attach": "anim dolore",
  "locale": "zh_cn",
  "notify_url": "https://xxx/xxx",
  "return_url": "https://xxxx/xxx?id=xxxx",
  "order_type": "platform_order"
}

TIP

app_id through the merchant backstage creating an application to obtain.

Interface return

Name
Type
Description
Description

code

integer

msg

string

Status description

request_id

string

Request ID

data

object

Data object

prepay_id

string

Prepayment ID

Prepayment transaction session ID. It is used for subsequent interface calls, and its value is valid for the expire_second parameter set when the order is created, or you can access the payment_url directly to complete the payment.

payment_url

string

Paymwnt cash register URL

payment_url is to pull up the middle page of the payment cash register, you can complete the payment by visiting this url. You can pay by visiting the url. payment_url is valid for the expire_second parameter set when the order is created.

Return example

{
    "code": 0,
    "msg": "ok",
    "request_id": "9b9e08ab-48e5-4efa-83e7-97e5e3fe3d0c",
    "data": {
        "prepay_id": "15809074c5bbc36bce27exxxxxxxxxxxxxxxxxxxxa4ca0a281d7e1260624a1c2",
        "payment_url": "/pay/order?prepay_id=15809074c5bbc36bce27exxxxxxxxxxxxxxxxxxxxa4ca0a281d7e1260624a1c2"
    }
}

Example code

curl --location --request POST 'https://api.tokenpay.me/v1/transaction/prepayment' \
--header 'Authorization: <Authorization>' \
--header 'User-Agent: tokenpay API (https://tokenpay.me)' \
--header 'Content-Type: application/json' \
--data-raw '<body data here>'

Last updated