API Documentation
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 docid\ lq v6ff 2i h1o3xd5kka api { "name" "create crypto payout order", "method" "post", "url" "https //your hostname pay3 app/v1/client/crypto payout/create order", "description" "create an order with payout details from application's backend", "tab" "examples", "examples" { "languages" \[ { "id" "nyfshp7j nrsuqth3fw7t", "language" "curl", "code" "curl location 'https //api dev pay3 app/v1/client/crypto payout/create order' \\\\\n header 'signature {{signature}}' \\\\\n header 'access token {dynamic access toke}' \\\\\n header 'content type application/json' \\\\\n data '{\n \\"clientid\\" \\" \\",\n \\"requestid\\" \\"a1d4a50e 5577 4581 a980 98b03bc76260\\",\n \\"amount\\" \\"0 0001\\",\n \\"currency\\" \\"btc bitcointestnet\\",\n \\"address\\" \\"0x5fc0d01a67e756a15b8eb56937fcb382637e8d2\\",\n \\"mode\\" \\"returnurl\\"\n }", "customlabel" "" } ], "selectedlanguageid" "nyfshp7j nrsuqth3fw7t" }, "results" { "languages" \[ { "id" "vqyrchsr38ubbehatupjh", "language" "200", "code" "mode=returnurl\n{\n \\"token\\" \\"b5ed337a e299 4f2b aa76 50c68097d9c1\\",\n \\"requestid\\" \\"a1d4a50e 5577 4581 a980 98b03bc76260\\",\n \\"url\\" \\"https //host pay3 app/pay3 sdk ui path\\"\n}\n\nmode=createestimate\n{\n \\"token\\" \\"a003d60c d0ae 40e5 a7cb 2634ab607253\\",\n \\"requestid\\" \\"a1d4a50e 5577 4581 a980 98b03bc76260\\",\n \\"currency\\" \\"btc bitcointestnet\\",\n \\"address\\" \\"tb1q7sqtxktz3jle8evmfnnhv45s0maudwdtknmdqu\\",\n \\"warning\\" \\"the btc bitcointestnet balance (0 0031) is below the configured threshold (100 0000) \\",\n \\"estimatedfees\\" \\"0 000066\\",\n \\"estimatednetamount\\" \\"0 000034\\"\n}", "customlabel" "" }, { "id" "tivoqbuskgnrqallvndvq", "language" "401", "code" "{\n error {\n code '7001',\n message 'order already exists for given requestid'\n }\n}", "customlabel" "" } ], "selectedlanguageid" "vqyrchsr38ubbehatupjh" }, "request" { "pathparameters" \[], "queryparameters" \[], "headerparameters" \[ { "name" "signature", "kind" "required", "type" "string", "description" "signature generated with sha256 followed by base64 encoding check below section for more details", "children" \[] }, { "name" "access token", "kind" "required", "type" "string", "description" "access token received from access token api you can reuse the access token across multiple api calls till it is expired", "children" \[] } ], "bodydataparameters" \[ { "name" "requestid", "kind" "required", "type" "string", "description" "identifier that is created by client application's backend this will be passed in relevant events and webhooks from pay3 to application", "children" \[] }, { "name" "address", "kind" "required", "type" "string", "description" "the address is the destination wallet address where the crypto token currency will be deposited after the payout is processed (user's wallet address should be passed in this)", "" "the address is the destination wallet address where the crypto token currency will be deposited after the payout is processed (user's wallet address should be passed in this)" }, { "name" "currency", "kind" "required", "type" "string", "description" "the currency is pay3's unique string id denoting the token that needs to be purchased example value are btc bitcoin, usdt polygon, uni eth " }, { "name" "amount", "kind" "required", "type" "string", "description" "the amount in ethereum / btc user needs to pay ", "" "the amount in ethereum / btc user needs to pay " }, { "name" "clientid", "kind" "required", "type" "string", "description" "client id application's identifier", "children" \[] }, { "name" "mode", "kind" "optional", "type" "string", "description" "the supported values for mode are returnurl, createestimate, and default \n\nreturnurl api response includes an additional field token, requestid and url \nthis url provides a direct checkout page link where users can complete their crypto payment through a hosted frontend flow \n\ncreateestimate api returns a token and requestid \nthese values must be passed to the execute crypto payout order api to complete the payout this flow is fully backend driven and does not involve any frontend or ui ", "" "the supported values for mode are returnurl, createestimate, and default \n\nreturnurl api response includes an additional field token, requestid and url \nthis url provides a direct checkout page link where users can complete their crypto payment through a hosted frontend flow \n\ncreateestimate api returns a token and requestid \nthese values must be passed to the execute crypto payout order api to complete the payout this flow is fully backend driven and does not involve any frontend or ui " }, { "name" "callbackurl", "kind" "optional", "type" "string", "description" "application can provide a url in this parameter after completion of the transaction, user will be redirected to this url an additional parameter data query parameter will be added to the url ", "" "callbackurl" }, { "name" "sponsorfee", "kind" "optional", "type" "boolean", "description" "when sponsorfee is set to true, the exact amount is sent to the destination address (user's address) without deducting fees ", "" "when sponsorfee is set to true, the exact amount is sent to the destination address (user's address) without deducting fees " } ], "formdataparameters" \[] }, "currentnewparameter" { "label" "body parameter", "value" "bodydataparameters" }, "response" \[ { "name" "token", "kind" "optional", "type" "string", "description" "returned as part of the payout order creation this value authorizes and links the execution request to the original payout order \n\nfor mode = createestimate\nthis token must be passed to the execute crypto payout order api to finalize and trigger the payout " }, { "name" "requestid", "kind" "optional", "type" "string", "description" "this is the same value of requestid passed while calling this api", "children" \[] }, { "name" "url", "kind" "optional", "type" "string", "description" "(returned only when mode = returnurl)\na direct checkout page link where users can complete their crypto payment through a hosted frontend page ", "children" \[] }, { "name" "currency", "kind" "optional", "type" "string", "description" "(returned for mode = createestimate)\nthe currency string representing the token selected for payout example values include btc bitcoin, usdt polygon etc same as passed in the request ", "children" \[] }, { "name" "address", "kind" "optional", "type" "string", "description" "(returned for mode = createestimate)\nthe destination wallet address where the payout is intended to be processed same as passed in the request ", "children" \[] }, { "name" "warning", "kind" "optional", "type" "string", "description" "may provide additional information or caution related to the payout session, eg payout wallet balance is lesser than threshold \n", "children" \[] }, { "name" "estimatedfees", "kind" "optional", "type" "string", "description" "(returned for mode = createestimate)\nthe estimated gas/network fees in \\"currency\\" value, required to complete the payout ", "children" \[] }, { "name" "estimatednetamount", "kind" "optional", "type" "string", "description" "(returned for mode = createestimate)\nthe estimated net amount in \\"currency\\" value, the user will receive after deducting gas fees and any applicable charges ", "children" \[] } ] } 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);