API Documentation
Create Crypto Checkout Order
4 min
this api creates a payin order where user can deposit digital assets to wallet address provided by the application it accepts address , currency and amount on creating an order a dynamic token is returned from this api which is required to be passed transactions docid\ wr9g8 0vvao95lsm3g1ye this api requires access token that can be generated using access token docid\ lq v6ff 2i h1o3xd5kka api { "name" "create crypto order", "method" "post", "url" "https //your hostname pay3 app/v1/client/crypto checkout/create order", "description" "create an order with payin details from application's backend", "tab" "examples", "examples" { "languages" \[ { "id" "nyfshp7j nrsuqth3fw7t", "language" "curl", "code" "curl location 'https //your hostname pay3 app/v1/client/crypto checkout/create order' \\\\\n header 'signature' \\"generated signature\\"\\\\\n header 'access token' \\"dynamic access token\\" \\\\\n header 'accept application/json' \\\\\n header 'content type application/json' \\\\\n data '{\n \\"requestid\\" \\"input request id\\",\n \\"address\\" \\"input destination address\\",\n \\"currency\\" \\"currency id\\",\n \\"amount\\" \\"input amount in eth or btc\\",\n \\"clientid\\" \\"your client id\\"\n}'", "customlabel" "" } ], "selectedlanguageid" "nyfshp7j nrsuqth3fw7t" }, "results" { "languages" \[ { "id" "vqyrchsr38ubbehatupjh", "language" "200", "customlabel" "", "code" "{\n \\"token\\" \\"generated token id\\",\n \\"requestid\\" \\"input request id\\",\n \\"requestinfodata\\" {\n \\"amount\\" \\"crypto amount in eth\\",\n \\"address\\" \\"input destination address\\",\n \\"clientid\\" \\"your client id\\",\n \\"signature\\" \\"generated signature\\",\n \\"currency\\" \\"currency id\\",\n \\"type\\" \\"crypto checkout\\"\n }\n}" }, { "id" "tivoqbuskgnrqallvndvq", "language" "401", "customlabel" "", "code" "{\n error {\n code '7001',\n message 'order already exists for given requestid'\n }\n}" } ], "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 purchased currency will be deposited during the purchase ", "children" \[] }, { "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" "optional", "type" "string", "description" "the amount in ethereum / btc user needs to pay the api expects either this parameter or fiatamount & fiatcurrency parameter ", "children" \[] }, { "name" "clientid", "kind" "required", "type" "string", "description" "client id application's identifier", "children" \[] }, { "name" "fiatamount", "kind" "optional", "type" "string", "description" "amount in fiat say usd (eg 10 50) this parameter is required when amount is not passed example values for ten dollar fifty cents is 10 50 ", "children" \[] }, { "name" "fiatcurrency", "kind" "optional", "type" "string", "description" "fiat currency code is pay3's unique string id denoting the fiat currency this parameter is required along with fiatamount when amount is not passed pay3 uses current exchange rate to translate fiatamount to amount \nsupported fiat currencies are usd usa, gbp gb and eur eu ", "children" \[] }, { "name" "mode", "kind" "optional", "type" "string", "description" "when the mode is set to returnurl, the api response includes an additional field url, which provides a direct checkout page link for accepting crypto payments the supported values for mode are returnurl and default \n", "" "when the mode is set to returnurl, the api response includes an additional field url, which provides a direct checkout page link for accepting crypto payments the supported values for mode are returnurl and default \n" }, { "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" "lang", "kind" "optional", "type" "string", "description" "this parameter specifies the language preference for the pay3 sdk the strings used follow two letter language code as in iso 639 1 example pt for portuguese, en for english ", "" "lang" } ], "formdataparameters" \[] }, "currentnewparameter" { "label" "body parameter", "value" "bodydataparameters" } } signature generation the request for creating payout order requires a header signature this can be generated using following javascript code snippet case 1 with amount parameter 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); case 2 with fiatamount & fiatcurrency parameter const crypto = require('crypto'); // required parameters const secretkey="api secret provided by pay3"; const address = "destination wallet address"; const currency = "currency id"; const fiatamount = "10 50"; // $10 50 const fiatcurrency = "usd usa"; // example for usd const requestid = "order id generated by application"; const getsignature = (secretkey, address, currency, fiatamount, fiatcurrency, requestid) => { // prepare the string to sign in same format const stringtosign = 'address=' + address + '\¤cy=' + currency + '\&fiatamount=' + fiatamount + '\&fiatcurrency=' + fiatcurrency + '\&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, fiatamount, fiatcurrency, requestid);