Create Payout Order
2 min
This API creates a payout order to enable users to withdraw funds. It accepts amount and currency details. On creating an order a dynamic token is returned from this api which is required to be passed to pay3Pay.openPayout()
This api requires access token that can be generated using Access Token API.
Create Payout Order
Create an order with payout details from application's backend
POST
https://your-hostname.pay3.app/v1/client/payout/create-order
curl --location 'https://your-hostname.pay3.app/v1/client/payout/create-order' \
--header 'signature': "generated-signature"\
--header 'access-token' : "dynamic-access-token" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"currencyId": "currency-id",
"fiatAmount": "0.02",
"requestId": "9824649238",
"paymentMethodId": "payment-method-id",
"email": "[email protected]",
"clientId": "your-client-id",
"firstName": "John",
"lastName": "Doe",
"taxId": "tax-id"
}'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 currencyId = "currency-id";
const fiatAmount = "0.02";
const requestId = "Order-Id-Generated-By-Application";
const clientId = "your-client-id";
const accessToken = "dynamic-access-token";
const getSignature = (secretKey, currencyId, fiatAmount, requestId) => {
// Prepare the string to sign in same format.
// currencyId followed by fiatAmount followed by requestId
const stringToSign = 'currencyId=' + currencyId + '&fiatAmount=' + fiatAmount + '&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, currencyId, fiatAmount, requestId);