5000Internal Server Error Unexpected server error occurred
Transfer Mode Limits
IMPS ₹1 ₹5,00,000 Instant NEFT ₹1 ₹10,00,000 30 min - 2 hours RTGS ₹2,00,000 ₹10,00,00,000 30 min - 2 hours
Implementation Examples
JavaScript
import crypto from 'crypto' ;
function encryptMerchantData (data, key, iv ) {
if (typeof data === 'object' ) {
data = JSON .stringify (data);
}
const cipher = crypto.createCipheriv ('aes-256-cbc' , key, iv);
const encrypted = Buffer .concat ([cipher.update (data, 'utf8' ), cipher.final ()]);
return encrypted.toString ('base64' );
}
function decryptMerchantData (data, key, iv ) {
const decipher = crypto.createDecipheriv ('aes-256-cbc' , key, iv);
const decrypted = Buffer .concat ([
decipher.update (Buffer .from (data, 'base64' )),
decipher.final ()
]);
return decrypted.toString ('utf8' );
}
async function initiatePayout (token, apiKey, secretKey ) {
const payoutData = {
sender_id : "unique_transaction_id" ,
wallet_id : "PAYWIZE12345679" ,
payment_mode : "IMPS" ,
beneficiary_name : "John Doe" ,
beneficiary_acc_number : "123456789012" ,
beneficiary_ifsc : "HDFC0001234" ,
amount : 1000 ,
remarks : "Payment" ,
callback_url : "https://your-website.com/webhook/payout"
};
const encryptedPayload = encryptMerchantData (payoutData, apiKey, secretKey);
const response = await fetch ('https://merchant.paywize.in/payout/v1/initiate' , {
method : 'POST' ,
headers : {
'Content-Type' : 'application/json' ,
'Authorization' : `Bearer ${token} `
},
body : JSON .stringify ({
payload : encryptedPayload
})
});
const result = await response.json ();
if (result.resp_code === 2000 ) {
const decryptedData = decryptMerchantData (result.data , apiKey, secretKey);
return JSON .parse (decryptedData);
} else {
throw new Error (`API Error ${result.resp_code} : ${result.resp_message} ` );
}
}
try {
const payoutResult = await initiatePayout (jwtToken, apiKey, secretKey);
console .log ('Payout initiated:' , payoutResult);
console .log ('Transaction ID:' , payoutResult.transaction_id );
console .log ('Sender ID:' , payoutResult.sender_id );
} catch (error) {
console .error ('Payout initiation failed:' , error.message );
}
Python
import requests
import json
from encryption_utils import encrypt_merchant_data, decrypt_merchant_data
def initiate_payout (token, api_key, secret_key ):
payout_data = {
"sender_id" : "unique_transaction_id" ,
"wallet_id" : "PAYWIZE12345679" ,
"payment_mode" : "IMPS" ,
"beneficiary" : {
"beneficiary_name" : "Jane Doe" ,
"beneficiary_ifsc" : "HDFC0123456" ,
"beneficiary_acc_number" : "123456789012"
},
"amount" : "1000.00" ,
"remarks" : "Payment" ,
"callback_url" : "https://your-website.com/webhook/payout"
}
encrypted_payload = encrypt_merchant_data(
json.dumps(payout_data),
api_key,
secret_key
)
response = requests.post(
'https://merchant.paywize.in/payout/v1/initiate' ,
headers={
'Content-Type' : 'application/json' ,
'Authorization' : f'Bearer {token} '
},
json={'payload' : encrypted_payload}
)
result = response.json()
if result['resp_code' ] == 2000 :
decrypted_data = decrypt_merchant_data(result['data' ], api_key, secret_key)
return json.loads(decrypted_data)
else :
raise Exception(f"API Error {result['resp_code' ]} : {result['resp_message' ]} " )
try :
payout_result = initiate_payout(jwt_token, api_key, secret_key)
print ('Payout initiated:' , payout_result)
print ('Transaction ID:' , payout_result['transaction_id' ])
print ('Sender ID:' , payout_result['sender_id' ])
except Exception as error:
print ('Payout initiation failed:' , str (error))
PHP
<?php
require_once 'PaywizeEncryption.php' ;
function initiatePayout ($token , $apiKey , $secretKey ) {
$payoutData = [
'sender_id' => 'unique_transaction_id' ,
'wallet_id' => 'PAYWIZE12345679' ,
'payment_mode' => 'IMPS' ,
'beneficiary_name' => 'John Doe' ,
'beneficiary_acc_number' => '123456789012' ,
'beneficiary_ifsc' => 'HDFC0001234' ,
'amount' => 1000 ,
'remarks' => 'Payment' ,
'callback_url' => 'https://your-website.com/webhook/payout'
];
$encryptedPayload = PaywizeEncryption ::encryptMerchantData ($payoutData , $apiKey , $secretKey );
$ch = curl_init ();
curl_setopt ($ch , CURLOPT_URL, 'https://merchant.paywize.in/payout/v1/initiate' );
curl_setopt ($ch , CURLOPT_POST, 1 );
curl_setopt ($ch , CURLOPT_POSTFIELDS, json_encode (['payload' => $encryptedPayload ]));
curl_setopt ($ch , CURLOPT_HTTPHEADER, [
'Content-Type: application/json' ,
'Authorization: Bearer ' . $token
]);
curl_setopt ($ch , CURLOPT_RETURNTRANSFER, true );
$response = curl_exec ($ch );
curl_close ($ch );
$result = json_decode ($response , true );
if ($result ['resp_code' ] == 2000 ) {
$decryptedData = PaywizeEncryption ::decryptMerchantData ($result ['data' ], $apiKey , $secretKey );
return json_decode ($decryptedData , true );
} else {
throw new Exception ("API Error {$result['resp_code']} : {$result['resp_message']} " );
}
}
try {
$payoutResult = initiatePayout ($jwtToken , $apiKey , $secretKey );
echo "Payout initiated: " . json_encode ($payoutResult ) . "\n" ;
echo "Transaction ID: " . $payoutResult ['transaction_id' ] . "\n" ;
echo "Status: " . $payoutResult ['status' ] . "\n" ;
} catch (Exception $error ) {
echo "Payout initiation failed: " . $error ->getMessage () . "\n" ;
}
?>
Best Practices
Unique Reference IDs : Always use unique sender_id to avoid duplicates
Amount Format : Use numeric format for amount field
Beneficiary Verification : Verify beneficiary details before initiating payouts
Transfer Mode Selection : Choose appropriate transfer mode based on amount and urgency
Callback URL : Ensure webhook endpoint is accessible and responds within 30 seconds
Error Handling : Implement proper error handling for all response codes
Balance Check : Check wallet balance before initiating large payouts
Rate Limiting : Respect API rate limits and implement exponential backoff
Next Steps