Create Crypto Refund with UI
4 min
This API creates a crypto refund order to enable merchants to refund a successfully processed crypto transaction. It accepts amount, orderId and the other order details.
This API requires access token that can be generated using Access TokenAccess Token API.
Create Refund
Create an order with refund details from your application's backend
POST
https://your-hostname.pay3.app/v1/client/crypto-refund/create-order
curl --location 'https://api.pprod.pay3.app/v1/client/crypto-refund/create-order' \
--header 'signature: {{signature}}' \
--header 'Access-token: {{access-token}}' \
--header 'Content-Type: application/json' \
--data '{
"clientId":"",
"requestId":"",
"orderId":"",
"amount": "1.0",
"currency": "usdc_sepolia",
"mode":"returnUrl",
"sponsorFee":false
}'Signature Generation
The request for creating payout order requires a header signature. This can be generated using following javascript code snippet.
Case 1: With fiatAmount & fiatCurrency parameter
const crypto = require('crypto');
// Required Parameters
const secretKey="Api-Secret-Provided-By-Pay3";
const fiatAmount = "0.02";
const fiatCurrency = "aed_ae";
const orderId = "Order_ID_Of_the_Pay-in_Order";
const requestId = "Order-Id-Generated-By-Application";
const getSignature = (secretKey, fiatAmount, fiatCurrency , orderId ,requestId) => {
// Prepare the string to sign in same format.
const stringToSign = 'fiatAmount=' + fiatAmount + '&fiatCurrency=' + fiatCurrency + '&orderId=' + orderId + '&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, fiatAmount, fiatCurrency , orderId ,requestId);
Case 2: With amount parameter
const crypto = require('crypto');
// Required Parameters
const secretKey="Api-Secret-Provided-By-Pay3";
const amount = "0.02";
const currency = "usdc_ethereum";
const orderId = "Order_ID_Of_the_Pay-in_Order";
const requestId = "Order-Id-Generated-By-Application";
const getSignature = (secretKey, amount, currency , orderId ,requestId) => {
// Prepare the string to sign in same format.
const stringToSign = 'amount=' + amount + '¤cy=' + currency + '&orderId=' + orderId + '&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, amount, currency , orderId ,requestId);