Skip to main content

Create an On-chain Payment

MixPay API for creating an on-chain payment.

POST /payments

MixPay also supports on-chain wallet payments.

Endpoint URL

https://api.mixpay.me/v1/payments

Parameters

ParamOptionalTypeDescription
payeeId*requiredStringAccount ID for receiving crypto, pls see Five types of account and How to get payeeId.
orderId*required if no traceIdStringUnique in your system. String lengths between 6-36 must be letters, numbers, dashes and underscores and NOT space. orderId and payeeId make a payment unique.
paymentAssetId*requiredStringassetId of payment cryptocurrency. You can see the supported asset id in Payment Assets.
settlementAssetId*requiredStringassetId of settlement cryptocurrency. Settlement assets you prefer. But you need to pay attention to the strictMode field. For more options, see here.
strictModeoptionalBooleanDefault false. true means that the payment must be settled strictly according to the currency set by settlementAssetId. See here for more details.
quoteAmount*requiredNumericCorresponding to the amount of quoteAssetId. For example, the current commodity value is 10 USDT
quoteAssetId*requiredStringassetId of quote cryptocurrency. You can see the supported asset id in Quote Assets.
isChain*requiredBooleanWhether is an on-chain payment or not. true is using on-chain payment, false means pay using Mixin App.
traceIdoptionalStringUUID, used to prevent double payment and checking the payment result. You should use orderId instead.
clientIdoptionalStringUUID of client of the payment.
paymentAmountoptionalStringThe quoteAmount parameter is invalid when paymentAmount is not null.
remarkoptionalStringmaximum 50. Payment remark viewable by the payer.
noteoptionalStringmaximum 50. Payment note viewable by the payer.
settlementMemooptionalStringmaximum 200. A memo is similar to Mixin Snapshots, this parameter you can customize.
returnTooptionalStringAfter successful payment, the URL page will want to redirect to. Useful when you are in a browser JavaScript environment.
failedReturnTooptionalStringAfter payment failure, the URL page will want to redirect to. Useful when you are in a browser JavaScript environment.
callbackUrloptionalStringAfter payment successfully, MixPay will issue a POST request to this URL on our server-side. For security reasons, URLs only support HTTPS and has to be URL encoded. Please refer to Payment Callback.
callbackEventoptionalStringSend settle or pending to subscribe more callback event. Please refer to Payment Callback.
expiredTimestampoptionalintSet a expired timestamp. This value must be greater than 10s and less than 2880min. After this period, the payment result status field will be marked as failed, and the failureReason will be Payment overtime. If you are not setting this value, the payer can have unlimited time to complete this payment.
INFO

settlementMemo parameter explanations: If you use Mixin API like GET /snapshots, you can find the memo in this response. This memo is the settlementMemo set by you. If you don't use this parameter, the specification of the memo can be found here.

Example request - Create On-chain Payment

curl -i -X POST https://api.mixpay.me/v1/payments \
-d "payeeId"="a0d7791408776b47eb1dd3f94ed15d6a" \
-d "paymentAssetId"="c6d0c728-2624-429b-8e0d-d9d19b6592fa" \
-d "settlementAssetId"="c6d0c728-2624-429b-8e0d-d9d19b6592fa" \
-d "quoteAssetId"="usd" \
-d "quoteAmount"="10" \
-d "isChain"=1
// title: Response
{
"code":0,
"success":true,
"message":"",
"data":{
"isChain":true,
// Payment expiration time
"expire":1647179141,
"seconds":600,
"payeeId":"834c17e1-1427-434a-a280-1b3cfee05111",
// The trace id when the user pays, to get the result of payment
"traceId":"1b638d3f-e156-4621-87fd-778a410f4884",
"clientId":"8f263764-3103-4be2-aff1-0530d6976e86",
"paymentAssetId":"c6d0c728-2624-429b-8e0d-d9d19b6592fa",
"settlementAssetId":"eea900a8-b327-488c-8d8d-1428702fe240",
"quoteAssetId":"4d8c508b-91c5-375b-92b0-ee702ed2dac5",
// The amount of assets to be paid by payer
"paymentAmount":"0.00025836",
"quoteAmount":"10",
"estimatedSettlementAmount":"2.06515747",
"memo":"",
"recipient":"",
"settlementAssetSymbol":"MOB",
"paymentAssetSymbol":"BTC",
"quoteAssetSymbol":"USDT",
// Wallet Address for recive money
"destination":"1NohyFdBUZ4g3ZNBoe9FL16poBUveXXf3e",
// tag,
"tag":""
},
"timestampMs":1648190663161
}

Collect the money

Please refer to Pay using an on-chain Wallet.

Expiration

When is a MixPay payment expired? Please refer to Expiration.