Skip to main content

Payout Corporate

Api Endpoint:

This API for Corporate Payout will be a POST request.

{BaseUrl}/payouts/batchPayout

Description

The corporate Payout on Bank API enables users to initiate multiple payouts to customer bank accounts in a single request. This is particularly useful for automating bulk disbursements such as payroll, vendor payments, cashback rewards, or affiliate commissions. Instead of sending individual payout requests one by one, users can package multiple transactions into a single batch, improving performance and reducing API overhead.

Each payout entry includes key details like the recipient’s bank account number, IFSC code, payout amount, customer information, and payment mode (e.g., NEFT or RTGS).

Request

Request Header

Request Header
{
"apiKey": "your api key",
"token": "your token",
"content-type": "application/json"
}
  • apiKey: Your unique API key provided by PayHub.
  • token: A token that validates your session or request.
  • content-type: Specifies that the request body is in JSON format.

Request Body (Before Encryption)

The body of the request should include the following parameters before encryption: Note: There will be an array of multiple payout objects, before encryption.

Request Body (Before Encryption)
[{
"amount": 100,
"customer_name": "customer's name",
"customer_email": "customer's email",
"customer_phone": "customer's phone",
"account_number": "customer's account number",
"bank_ifsc": "customer's bank IFSC code",
"account_name": "customer's Account Holder name",
"bank_name": "customer's bank name",
"orderId": "merchant order id",
"method":"bank",
"payment_mode":"mode of transfer", (Allowed modes: "NEFT", "IMPS", "RTGS")
"beneficiary_account_type": "type of bank account" (Allowed values: "savings", "current")
},
{
"amount": 100,
"customer_name": "customer's name",
"customer_email": "customer's email",
"customer_phone": "customer's phone",
"account_number": "customer's account number",
"bank_ifsc": "customer's bank IFSC code",
"account_name": "customer's Account Holder name",
"bank_name": "customer's bank name",
"orderId": "merchant order id",
"method":"bank",
"payment_mode":"mode of transfer", (Allowed modes: "NEFT", "IMPS", "RTGS")
"beneficiary_account_type": "type of bank account" (Allowed values: "savings", "current")
},
{
"amount": 100,
"customer_name": "customer's name",
"customer_email": "customer's email",
"customer_phone": "customer's phone",
"account_number": "customer's account number",
"bank_ifsc": "customer's bank IFSC code",
"account_name": "customer's Account Holder name",
"bank_name": "customer's bank name",
"orderId": "merchant order id",
"method":"bank",
"payment_mode":"mode of transfer", (Allowed modes: "NEFT", "IMPS", "RTGS")
"beneficiary_account_type": "type of bank account" (Allowed values: "savings", "current")
}]

Encryption Process

To enhance security, the request payload must be encrypted using AES-256-CBC before sending the request.

Step 1: Get Your Encryption Key

You need to get your encryption key from the PayHub Dashboard.

Step 2: Encrypt the Request Data

Use the following JavaScript (Node.js) code to encrypt your request data:

const CryptoJS = require('crypto-js');

const ENCRYPTION_KEY = 'your-encryption-key'; // Get from the dashboard
const IV_LENGTH = 16; // AES block size for CBC mode

// Function to derive a 32-byte key
function deriveKey(secret) {
return CryptoJS.SHA256(secret).toString(CryptoJS.enc.Hex).substring(0, 32);
}

// Generate a random IV
function generateIV() {
return CryptoJS.lib.WordArray.random(16).toString(CryptoJS.enc.Hex);
}

// Encrypt function
function encrypt(data, key) {
const iv = generateIV();
const cipherKey = CryptoJS.enc.Utf8.parse(deriveKey(key));
const ivHex = CryptoJS.enc.Hex.parse(iv);

const encrypted = CryptoJS.AES.encrypt(JSON.stringify(data), cipherKey, {
iv: ivHex,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
});

return iv + ':' + encrypted.ciphertext.toString(CryptoJS.enc.Hex);
}

// Original request payload
const requestData = [ {
"amount": 100,
"customer_name": "customer's name",
"customer_email": "customer's email"(Optional),
"customer_phone": "customer's phone",(Optional)
"account_number": "customer's account number",
"bank_ifsc": "customer's bank IFSC code",
"account_name": "customer's Account Holder name",
"bank_name": "customer's bank name",
"orderId": "merchant order id"(Optional)
"method": "bank",(Optional)
"payment_mode":"mode of transfer", (Allowed modes: "NEFT", "IMPS", "RTGS")
"beneficiary_account_type": "type of bank account" (Allowed values: "savings", "current")
},
{
"amount": 100,
"customer_name": "customer's name",
"customer_email": "customer's email",
"customer_phone": "customer's phone",
"account_number": "customer's account number",
"bank_ifsc": "customer's bank IFSC code",
"account_name": "customer's Account Holder name",
"bank_name": "customer's bank name",
"orderId": "merchant order id"
"method": "bank",
"payment_mode":"mode of transfer", (Allowed modes: "NEFT", "IMPS", "RTGS")
"beneficiary_account_type": "type of bank account" (Allowed values: "savings", "current")
},
{
"amount": 100,
"customer_name": "customer's name",
"customer_email": "customer's email",
"customer_phone": "customer's phone",
"account_number": "customer's account number",
"bank_ifsc": "customer's bank IFSC code",
"account_name": "customer's Account Holder name",
"bank_name": "customer's bank name",
"orderId": "merchant order id"
"method": "bank",
"payment_mode":"mode of transfer", (Allowed modes: "NEFT", "IMPS", "RTGS")
"beneficiary_account_type": "type of bank account" (Allowed values: "savings", "current")
}];



// Encrypt the data
const encryptedData = encrypt(requestData, ENCRYPTION_KEY);
console.log("Encrypted Data:", encryptedData);

Step 3: Send Encrypted Data in Request

After encryption, send the request body as follows:

Encrypted Request Body
{
"encryptedData": "your-encrypted-string"
}

Body schema

Request body schema
 {
"amount": {
"type": "number",
"format": "float(10,2)", // up to 2 decimals
"min": 1,
"max": 50000
},
"customer_name": {
"type": "string",
"maxLength": 100,
"optional": true

},
"customer_email": {
"type": "string",
"maxLength": 254,
"optional": true
},
"customer_phone": {
"type": "string",
"maxLength": 13,
"pattern": "^(\\+91)?[6-9]\\d{9}$", // +91XXXXXXXXXX or 10-digit starting with 6–9
"optional": true
},
"account_number": {
"type": "string",
"maxLength": 18,
"pattern": "^[0-9]{9,18}$"
},
"bank_ifsc": {
"type": "string",
"maxLength": 11,
"pattern": "^[A-Z]{4}0[A-Z0-9]{6}$"
},
"account_name": {
"type": "string",
"maxLength": 100,
"optional": true

},
"bank_name": {
"type": "string",
"maxLength": 50,
"optional": true

},
"orderId": {
"type": "string",
"maxLength": 20,
"optional": true
},
"method": {
"type": "string",
"enum": ["bank"],
"optional": true
},
"payment_mode": {
"type": "string",
"enum": ["NEFT", "IMPS", "RTGS"]
},
"beneficiary_account_type": {
"type": "string",
"enum": ["savings", "current"]
}
};

Success Response

Success Response
{
"responseCode": 200,
"responseMessage": "Success",
"responseData": {
"data": [
{
"transaction_id": "ESOjaxarv87X",
"order_id": "447237885571"
},
{
"transaction_id": "rQrPZqFA4PKQ",
"order_id": "447237885572"
},
{
"transaction_id": "3Go96IjUVLoz",
"order_id": "447237885585"
},
{
"transaction_id": "KOdZ7fhoLsnp",
"order_id": "447237885587"
},
{
"transaction_id": "NQf2x3dCIluS",
"order_id": "44723115588"
},
{
"transaction_id": "vdI091TgZU9K",
"order_id": "447237885589"
}
],
"transaction_status": "success",
"errors": [

]
}
}

Partial Success Response

Partial Success Response
{
"responseCode": 200,
"responseMessage": "Success",
"responseData": {
"data": [
{
"transaction_id": "ESOjaxarv87X",
"order_id": "447237885571"
},
{
"transaction_id": "rQrPZqFA4PKQ",
"order_id": "447237885572"
},
{
"transaction_id": "3Go96IjUVLoz",
"order_id": "447237885585"
},
{
"transaction_id": "KOdZ7fhoLsnp",
"order_id": "447237885587"
},
{
"transaction_id": "NQf2x3dCIluS",
"order_id": "44723115588"
},
{
"transaction_id": "vdI091TgZU9K",
"order_id": "447237885589"
}
],
"transaction_status": "partial_success",
"errors": [
{
"amount": 100,
"customer_name": "customer's name",
"customer_email": "customer's email",
"customer_phone": "customer's phone",
"account_number": "customer's account number",
"bank_ifsc": "customer's bank IFSC code",
"account_name": "customer's Account Holder name",
"method": "bank",
"payment_mode": "IMPS",
"beneficiary_account_type": "savings",
"orderId": "order ID",
"error": "Duplicate order ID"
},
{
"amount": 100,
"customer_name": "customer's name",
"customer_email": "customer's email",
"customer_phone": "customer's phone",
"account_number": "customer's account number",
"bank_ifsc": "customer's bank IFSC code",
"account_name": "customer's Account Holder name",
"method": "bank",
"payment_mode": "IMPS",
"beneficiary_account_type": "savings",
"orderId": "order ID",
"error": "Duplicate order ID"
},
{
"amount": 100,
"customer_name": "customer's name",
"customer_email": "customer's email",
"customer_phone": "customer's phone",
"account_number": "customer's account number",
"bank_ifsc": "customer's bank IFSC code",
"account_name": "customer's Account Holder name",
"method": "bank",
"payment_mode": "IMPS",
"beneficiary_account_type": "savings",
"orderId": "order ID",
"error": "Duplicate order ID"
}
]
}
}

Error Response

Error Response
{
"responseCode": 400,
"responseMessage": "Invalid transaction details",
"responseData": {
"transaction_status": "failed",
"errors": [
{
"amount": 100,
"customer_name": "customer's name",
"customer_email": "customer's email",
"customer_phone": "customer's phone",
"account_number": "customer's account number",
"bank_ifsc": "customer's bank IFSC code",
"account_name": "customer's Account Holder name",
"method": "bank",
"payment_mode": "IMPS",
"beneficiary_account_type": "savings",
"error": "Order id is required"
},
{
"amount": 100,
"customer_name": "customer's name",
"customer_email": "customer's email",
"customer_phone": "customer's phone",
"account_number": "customer's account number",
"bank_ifsc": "customer's bank IFSC code",
"account_name": "customer's Account Holder name",
"method": "bank",
"payment_mode": "IMPS",
"beneficiary_account_type": "savings",
"orderId": "998922378886",
"error": "Duplicate order id"
},
{
"amount": 100,
"customer_name": "customer's name",
"customer_email": "customer's email",
"customer_phone": "customer's phone",
"account_number": "customer's account number",
"bank_ifsc": "customer's bank IFSC code",
"account_name": "customer's Account Holder name",
"method": "bank",
"payment_mode": "IMPS",
"beneficiary_account_type": "savings",
"error": "Invalid account number"
}
]
}
}

Invalid API Key Response

Invalid API Key
{
"responseCode": 401,
"responseMessage": "Invalid apiKey"
}

Notes

  • You must use AES-256-CBC encryption before sending the request.
  • Always retrieve your encryption key from the PayHub Dashboard.
  • Ensure the encryptedData field is sent correctly in the request body.