Reputation: 1
I would like to have the ability to designate a specific account for each payment transaction. For instance, if I choose the first account during the payment process, I would like the corresponding amount to be credited to that particular account. Similarly, if I opt for the second account, the amount should be credited to the second account.
Can anyone help me with that?
I tried Route in Razorpay, but i didn't understood.
Upvotes: 0
Views: 313
Reputation: 2055
Either you should create separate Razorpay accounts for each accounts and use those api key and secret as per based on the payment selection or else link all the multiple accounts in your single Razorpay account using 'Route' facility in Razorpay dashboard which will return an accountId for each of the linked account and then use 'transfers' when you create an order and specify the amount & and razorypay_accountId of relevant bank account as below.
import * as Razorpay from 'razorpay';
const razorpay = new Razorpay({
key_id: <YOUR_KEY_ID>,
key_secret: <YOUR_KEY_SECRET>,
})
const order = {
amount: 2500,
currency: "INR",
payment_capture: 1,
transfers: [
{
account: "acc_NpFg8YLkFcclOK", // Razorpay accountId of Linked account
amount: 1500,
currency: "INR",
notes: {
branch: "DCB Mumbai East",
name: "Rupesh Dubey"
},
linked_account_notes: [
branch
],
on_hold: 1,
on_hold_until: 1671324870
},
{
account: acc_Npo6tHI26kFHJK,
amount: 1000,
currency: "INR",
notes: {
branch: "DCB Mumbai-Bangalore North",
name: "Akhilesh Yadav"
},
linked_account_notes: [
branch
],
"on_hold": 0
}
]
};
const razorpayResponse = await razorpay.orders.create(order)
Upvotes: 0