I am trying to integrate payment gateway to my application. Their docs (https://razorpay.com/docs/route/api-reference/#funds-movement-in-linked-accounts) say I have to send request like this:
curl https://api.razorpay.com/v1/payments/pay_AlSXPEsTyXyxYx/transfers \
-u <YOUR_API_KEY>:<YOUR_SECRET_KEY> \
-d 'transfers[0][account]=acc_BYYYYJRfs1234S' \
-d 'transfers[0][amount]=1000' \
-d 'transfers[0][currency]=INR' \
-d 'transfers[0][notes][roll_no]=IEC2011025' \
-d 'transfers[0][notes][name]=Gaurav Kumar' \
-d 'transfers[0][linked_account_notes][0]=roll_no' \
-d 'transfers[1][account]=acc_BYYYYJRfs1234S' \
-d 'transfers[1][amount]=1000' \
-d 'transfers[1][currency]=INR' \
-d 'transfers[1][notes][roll_no]=IEC2011026' \
-d 'transfers[1][notes][name]=Saurav Kumar'
I send the data as an object and doing angular.toJson()
on it. I get 400 bad request
let payData =
{
account: 'anccount',
rzp_test_abcd: 'tyaef', //key
amount: parseInt($scope.amountPayingNow*100),
}
Calling their API:
$http({
method: "POST",
url: 'https://api.razorpay.com/v1/payments/'+ transaction.razorpay_payment_id + '/transfers',
data: angular.toJson(payData),
});