Skip to main content

Generate a payment

POST /payments

There're two functions for this api

  1. Create a multisig payment code:
    a. the api needs authorization token
    b. will response 403, if using an incorrect trace_id
    c. the state will be paid if the payment existing, otherwise pending

  2. Validate the payment parameters
    a. the api is public, without authorization token
    b. the state will be paid if the payment existing, otherwise pending

Endpoint URL

 https://api.mixin.one/payments

Authentication and options

Authorization
Authorized
LimitationNo limitation

Payload

{
"asset_id": "the asset's asset_id which you are transferring",
"amount": "e.g.: "0.01", supports up to 8 digits after the decimal point",
"trace_id": "Used to prevent duplicate payment, optional",
"memo": "Maximally 200 characters, optional",
"opponent_multisig": {
"receivers": "An array of users' id, Maximally 256",
"threshold": "number, must not bigger than the size of receivers",
},
}

Example request

curl -i -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" https://api.mixin.one/payments --data PAYLOAD
{
"data": {
"type": "payment",
"payment_id": "773e5e77-4107-45c2-b648-8fc722ed77f5",
"asset_id": "43d61dcd-e413-450d-80b8-101d5e903357",
"amount": "-10",
"trace_id": "7c67e8e8-b142-488b-80a3-61d4d29c90bf",
"memo": "hello",
"threshold": 2,
"receivers": ["7c67e8e8-b142-488b-80a3-61d4d29c90bf", "7c67e8e8-b142-488b-80a3-61d4d29c90bf", "7c67e8e8-b142-488b-80a3-61d4d29c90bf"],
"created_at": "2017-12-23T18:23:26.996149Z",
}
}

Validate payment parameters

Payload

{
"asset_id": "the asset's asset_id which you are transferring",
"amount": "e.g.: "0.01", supports up to 8 digits after the decimal point",
"trace_id": "Used to prevent duplicate payment, optional",
"opponent_id": "optional,receiver's uuid",
"address_id": "optional,uuid",
"destination": "optional, withdrawal public key",
"tag": "optional, withdrawal memo"
}

Example request

curl -i -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" https://api.mixin.one/payments --data {"asset_id":"c6d0c728-2624-429b-8e0d-d9d19b6592fa","amount":"0.01","trace_id":"c6d0c728-2624-429b-8e0d-d9d19b6592fa","memo":"","opponent_multisig":{"receivers":["c6d0c728-2624-429b-8e0d-d9d19b6592fa","c6d0c728-2624-429b-8e0d-d9d19b6592fa"],"threshold":1}}
{
"data": {
"type": "payment",
"payment_id": "773e5e77-4107-45c2-b648-8fc722ed77f5",
"asset_id": "43d61dcd-e413-450d-80b8-101d5e903357",
"amount": "-10",
"trace_id": "7c67e8e8-b142-488b-80a3-61d4d29c90bf",
"memo": "hello",
"threshold": 2,
"receivers": ["7c67e8e8-b142-488b-80a3-61d4d29c90bf", "7c67e8e8-b142-488b-80a3-61d4d29c90bf", "7c67e8e8-b142-488b-80a3-61d4d29c90bf"],
"created_at": "2017-12-23T18:23:26.996149Z",
}
}

Example request

curl -i -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" https://api.mixin.one/payments --data {"asset_id":"c6d0c728-2624-429b-8e0d-d9d19b6592fa","amount":"0.01","trace_id":"c6d0c728-2624-429b-8e0d-d9d19b6592fa","address_id":"c6d0c728-2624-429b-8e0d-d9d19b6592fa"}

Example request

curl -i -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" https://api.mixin.one/payments --data {"asset_id":"c6d0c728-2624-429b-8e0d-d9d19b6592fa","amount":"0.01","trace_id":"c6d0c728-2624-429b-8e0d-d9d19b6592fa","opponent_id":"c6d0c728-2624-429b-8e0d-d9d19b6592fa"}

Example request

curl -i -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" https://api.mixin.one/payments --data {"asset_id":"c6d0c728-2624-429b-8e0d-d9d19b6592fa","amount":"0.01","trace_id":"c6d0c728-2624-429b-8e0d-d9d19b6592fa","destination":"3GqjTwAwWyJ2YZ3v1vYPCkC4SzwVHLgivj","key":""}