Create Refund
2 min
This API creates a refund order to enable merchants to refund a successfully processed transaction. It accepts amount and the order details.
This api requires access token that can be generated using Access Token API.
Create Refund
Create an order with payout details from application's backend
POST
https://your-hostname.pay3.app/v1/client/fiat-refund
curl --location 'https://your-hostname.pay3.app/v1/client/fiat-refund' \
--header 'signature': "generated-signature"\
--header 'access-token' : "dynamic-access-token" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"fiatAmount": "0.02",
"requestId": "9824649238",
"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.
const crypto = require('crypto');
// Required Parameters
const secretKey="Api-Secret-Provided-By-Pay3";
const fiatAmount = "0.02";
const requestId = "Order-Id-Generated-By-Application";
const clientId = "your-client-id";
const accessToken = "dynamic-access-token";
const getSignature = (secretKey, fiatAmount, requestId) => {
// Prepare the string to sign in same format.
// fiatAmount followed by requestId
const stringToSign = '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, fiatAmount, requestId);