Create Crypto Payout Order
2 min
This API creates a payout order to enable users to withdraw funds. It accepts address, currency ,clientId and amount.
This api requires access token that can be generated using Access TokenAccess Token API.
Create Crypto Payout Order
Create an order with payout details from application's backend
POST
https://your-hostname.pay3.app/v1/client/crypto-payout/create-order
curl --location 'https://api.dev.pay3.app/v1/client/crypto-payout/create-order' \
--header 'signature: {{signature}}' \
--header 'access-token: {dynamic-access-toke}' \
--header 'Content-Type: application/json' \
--data '{
"clientId": "....",
"requestId": "a1d4a50e-5577-4581-a980-98b03bc76260",
"amount": "0.0001",
"currency": "btc_bitcointestnet",
"address": "0x5Fc0D01A67E756a15B8eb56937Fcb382637E8D2",
"mode":"returnUrl"
}Signature Generation
The request for creating payout order requires a header signature. This can be generated using following javascript code snippet.
const crypto = require('crypto');
// Required Parameters
const secretKey="Api-Secret-Provided-By-Pay3";
const address = "destination-wallet-address";
const currency = "currency-id";
const amount = "0.02";
const requestId = "Order-Id-Generated-By-Application";
const getSignature = (secretKey, address, currency, amount, requestId) => {
// Prepare the string to sign in same format.
const stringToSign = 'address=' + address + '¤cy=' + currency + '&amount=' + amount + '&requestId=' + requestId;
// Generating signature using SHA256 and provided secret and
// base64 encode the result
const mac = crypto.createHmac('sha256', secretKey);
return mac.update(stringToSign).digest('base64');
}
// Generate Signature
const signature = getSignature(secretKey, address, currency, amount, requestId);