Create Crypto Checkout Order (cloned)
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 openCryptoCheckout()
This api requires access token that can be generated using Access Token API.
Create Crypto Order
Create an order with payin details from application's backend
POST
https://your-hostname.pay3.app/v1/client/crypto-checkout/create-order
curl --location 'https://your-hostname.pay3.app/v1/client/crypto-checkout/create-order' \
--header 'signature': "generated-signature"\
--header 'access-token' : "dynamic-access-token" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"requestId":"input-request-id",
"address":"input-destination-address",
"currency":"currency-id",
"amount":"input-amount-in-eth-or-btc",
"clientId":"your-client-id"
}'
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);