Payment Methods - Example Code🔗
You can accept payments from your customers using any available payment methods. Use the Fetch Supported Methods API to fetch the payment methods available for your account.
Below are the sample payloads for each payment method.
Bank Transfer🔗
This payment method allows you to display your virtual account details on the checkout. Your customers can make online bank transfers to this account.
Feature Request
This is an on-demand feature. Please raise a request with our Support team to get this feature activated on your Razorpay account.
There are no specific request parameters to be passed. Instead, you must pass the fetchVirtualAccount
method for your virtual account to get created and the details to appear on the checkout. Know more about integrating bank transfer with Custom Checkout.
Debit and Credit Card🔗
In this case, data.method
should be specified as card
. Other required fields:
card[name]
card[number]
card[cvv]
card[expiry_month]
card[expiry_year]
Copyrazorpay.createPayment({
amount: 5000,
email: 'gaurav.kumar@example.com',
contact: '9123456780',
order_id: 'order_9A33XWu170gUtm',
method: 'card',
'card[name]': 'Gaurav Kumar',
'card[number]': '4111111111111111',
'card[cvv]': '566',
'card[expiry_month]': '10',
'card[expiry_year]': '20'
});
If you want to save the card details entered by the customer, know about Saved Cards feature.
EMI on Credit and Debit Cards🔗
For EMIs, data is the same as the card, with the following differences:
method
should beemi
- An additional field,
emi_duration
corresponding to the number of months for EMI, should be included. After the customer selects the desired plan, pass the corresponding value in theemi_duration
field.
Copyrazorpay.createPayment({
amount: 300000,
email: 'gaurav.kumar@example.com',
contact: '9123456780',
order_id: 'order_9A33XWu170gUtm',
method: 'emi',
emi_duration: 9,
'card[name]': 'Gaurav Kumar',
'card[number]': '5241810000000000',
'card[cvv]': '566',
'card[expiry_month]': '10',
'card[expiry_year]': '20'
});
Know more about Fetch EMI Plans.
Cardless EMI🔗
Cardless EMI is a checkout payment method that allows customers to convert their payment amount to EMIs. The user does not require a debit or credit card. Make payments via credits approved by the supported Cardless EMI payment partner.
Feature Request
This is an on-demand feature. Please raise a request with our Support team to get this feature activated on your Razorpay account.
Watch Out!
The customer should be registered with the cardless EMI payment partner before making the payment.
Copyrazorpay.createPayment({
amount: 5000,
email: 'gaurav.kumar@example.com',
contact: '9123456780',
order_id: 'order_9A33XWu170gUtm',
method: 'cardless_emi',
provider: '<provider_name>'
});
Possible values for <provider_name>
:
zestmoney
earlysalary
hdfc
kkbk
icic
idfb
fdrl
hcin
Netbanking🔗
When method
is netbanking
, you need to pass an additional field bank
as shown below:
Copyrazorpay.createPayment({
amount: 5000,
email: 'gaurav.kumar@example.com',
contact: '9123456780',
order_id: 'order_9A33XWu170gUtm',
method: 'netbanking',
bank: 'SBIN'
})
You can list the available banks using a drop-down for customers. You can obtain a list of banks using the Fetch Supported Methods API.
Wallet🔗
When method
is wallet
, you need to pass an additional field wallet
as shown below:
Copyrazorpay.createPayment({
amount: 5000,
email: 'gaurav.kumar@example.com',
contact: '9123456780',
order_id: 'order_9A33XWu170gUtm',
method: 'wallet',
wallet: 'mobikwik'
});
Possible values for wallet
:
PhonePe Switch🔗
You can accept in-app payments from your customers transacting in PhonePe Switch. Know more about PhonePe Switch Integration.
UPI🔗
You can accept UPI payments using the collect flow. Know more about Validate VPA and Saved VPA.
Handy Tips
You can avail the UPI Intent flow by integrating with the Google Pay SDK.
Collect flow🔗
Customers enter the vpa
on your UI and complete the payments on their respective UPI apps in collect flow. You can now pass the vpa
parameter in the upi
array as shown below:
Copyrazorpay.createPayment({
amount: 5000,
email: 'gaurav.kumar@example.com',
contact: '9123456780',
order_id: 'order_9A33XWu170gUtm',
method: 'upi',
upi:
{
vpa: 'gauravkumar@somebank',
flow: 'collect'
}
});
You will need to ask VPA from the user, which can be a text field with a regex of ^.+@.+$
.
PayLater🔗
You can enable your customers to make payments using the PayLater service offered by various third-party providers such as:
Provider | Provider Code | Availability | Minimum Transaction | Maximum Transaction |
---|---|---|---|---|
ICICI Bank PayLater |
| Default | ₹1 | ₹30,000 |
GetSimpl |
| Requires Approval | ₹1 | ₹25,000 |
FlexiPay by HDFC Bank |
| Requires Approval | ₹1,000 | ₹20,000 |
LazyPay |
| Requires Approval | ₹1 | ₹10,000 |
Prerequisites🔗
- Contact our Support Team to get this payment method enabled for your account.
- Customers should be registered account holders of the Pay Later service providers.
Sample Code🔗
After creating an order and obtaining the customer's payment details, send the information to Razorpay to complete the payment. You can do this by invoking createPayment
and passing method=paylater
and provider=<provider_name>
.
Available providers with provider code:
- GetSimpl:
getsimpl
- ICICI Bank PayLater:
icic
- FlexiPay by HDFC Bank:
hdfc
- LazyPay:
lazypay
Copyrazorpay.createPayment({
amount: 200000,
currency: 'INR',
email: 'gaurav.kumar@example.com',
contact: '9111145678',
order_id: 'order_DPzFe1Q1dEObDv',
method: 'paylater',
provider: <provider_code>
});
Emandate🔗
You can accept recurring payments from your customers using emandate
, card
or upi
as the method. For more information about authorization and subsequent payments, refer to the Recurring Payments documentation.
Feature Request
This is an on-demand feature. Please raise a request with our Support team to get this feature activated on your Razorpay account.
Workflow🔗
- Create a customer.
- Create an Order with method as
emandate
,nach
orupi
. - Collect authorization transaction.
- Using custom checkout.
- Using an authorization link.
- Verify Tokens.
- Charge subsequent payments.
Know more about Recurring Payments APIs.
Sample Checkout Code to Collect Authorization Transaction🔗
Copyrazorpay.createPayment({
amount: 0,
currency: 'INR',
email: 'gaurav.kumar@example.com',
contact: '9111145678',
order_id: 'order_EAbtuXPh24LrEc',
customer_id: 'cust_E9penp7VGhT5yt',
recurring: '1',
method: 'emandate',
bank: 'HDFC',
auth_type: 'netbanking',
'bank_account[name]': 'Gaurav Kumar',
'bank_account[account_number]': '1121431121541121',
'bank_account[account_type]': 'savings',
'bank_account[ifsc]': 'HDFC0000001'
});
Copyrazorpay.createPayment({
amount: 0,
currency: 'INR',
email: 'gaurav.kumar@example.com',
contact: '9111145678',
order_id: 'order_EAbtuXPh24LrEc',
customer_id: 'cust_E9penp7VGhT5yt',
recurring: '1',
method: 'emandate',
bank: 'HDFC',
auth_type: 'debitcard',
'bank_account[name]': 'Gaurav Kumar',
'bank_account[account_number]': '1121431121541121',
'bank_account[account_type]': 'savings',
'bank_account[ifsc]': 'HDFC0000001'
});
Copyrazorpay.createPayment({
amount: 0,
currency: 'INR',
email: 'gaurav.kumar@example.com',
contact: '9111145678',
order_id: 'order_EAbtuXPh24LrEc',
customer_id: 'cust_E9penp7VGhT5yt',
recurring: '1',
method: 'emandate',
bank: 'HDFC',
auth_type: 'aadhaar',
'bank_account[name]': 'Gaurav Kumar',
'bank_account[account_number]': '1121431121541121',
'bank_account[account_type]': 'savings',
'bank_account[ifsc]': 'HDFC0000001'
});
Copyrazorpay.createPayment({
amount: 100,
currency: 'INR',
email: 'gaurav.kumar@example.com',
contact: '9111145678',
order_id: 'order_EAbtuXPh24LrE0',
customer_id: 'cust_E9penp7VGhTkeD',
recurring: '1',
method: 'card',
'card[number]': '4047458064111111',
'card[cvv]': '123',
'card[expiry_month]': '01',
'card[expiry_year]': '22',
'card[name]': 'Gaurav Kumar'
});
Copyrazorpay.createPayment({
"amount": 100,
"currency": "INR",
"email": "gaurav.kumar@example.com",
"contact": "9111145678",
"order_id": "order_IxWD8iKBkMLwUu",
"customer_id": "cust_H0Hs5VmLjN0ir7",
"recurring": 1,
"method": "upi",
"upi" : {
"flow": "collect",
"vpa": "9876543211@ybl"//Payer VPA in case of collect request
}
CRED🔗
To add CRED as a payment method, you need to:
- Pass the
app_offer
parameter in Orders API. - Pass the
method
andprovider
parameters in Create Payments API.
Pass app_offer Parameter in Order🔗
You must create an order using Orders API. In the response, you obtain an order_id
which you must pass to Checkout.
Copycurl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
-X POST https://api.razorpay.com/v1/orders \
-H "content-type: application/json" \
-d '{
"amount": 1000,
"currency": "INR",
"receipt": "receipt#1",
"app_offer": true
}'
Copyimport razorpay
client = razorpay.Client(auth=("YOUR_ID", "YOUR_SECRET"))
client.order.create({
"amount": 1000,
"currency": "INR",
"receipt": "receipt#1",
"app_offer": true
})
Copy$api = new Api($key_id, $secret);
$api->order->create(array('receipt' => 'receipt#1', 'amount' => 1000, 'currency' => 'INR', 'app_offer'=> true));
CopyRazorpayClient client = new RazorpayClient(your_key_id, your_secret);
Dictionary<string, object> options = new Dictionary<string,object>();
options.Add("amount", 1000); // amount in the smallest currency unit
options.Add("receipt", "receipt#1");
options.Add("currency", "INR");
options.Add("app_offer", true);
Order order = client.Order.Create(options);
Copyvar instance = new Razorpay({ key_id: 'YOUR_KEY_ID', key_secret: 'YOUR_SECRET' })
instance.orders.create({
amount: 1000,
currency: "INR",
receipt: "receipt#1",
app_offer: true
})
Copyimport ( razorpay "github.com/razorpay/razorpay-go" )
client := razorpay.NewClient("YOUR_KEY_ID", "YOUR_SECRET")
data := map[string]interface{}{
"amount": 1000,
"currency": "INR",
"receipt": "receipt#1",
"app_offer": true
}
body, err := client.Order.Create(data, nil)
Copyrequire "razorpay"
Razorpay.setup('YOUR_KEY_ID', 'YOUR_SECRET')
order = Razorpay::Order.create amount: 1000, currency: 'INR', receipt: 'receipt#1', app_offer: true
CopyRazorpayClient razorpay = new RazorpayClient("[YOUR_KEY_ID]", "[YOUR_KEY_SECRET]");
JSONObject orderRequest = new JSONObject();
orderRequest.put("amount", 1000); // amount in the smallest currency unit
orderRequest.put("currency", "INR");
orderRequest.put("receipt", "receipt#1");
orderRequest.put("app_offer", true);
Order order = razorpay.orders.create(orderRequest);
Copy{
"id": "order_FNPoKwCtPyhJOt",
"entity": "order",
"amount": 1000,
"amount_paid": 0,
"amount_due": 1000,
"currency": "INR",
"receipt": null,
"status": "created",
"attempts": 0,
"notes": [],
"created_at": 1596703420
}
Request Parameters🔗
amount
mandatoryinteger
The transaction amount, expressed in the currency subunit, such as paise (in case of INR). For example, for an actual amount of ₹299.35, the value of this field should be29935
.currency
mandatorystring
The currency in which the transaction should be made. See the list of supported currencies. Default isINR
.app_offer
optionalboolean
Allow/do not allow customers to use CRED coins to make payments. This is used to prevent double discounting scenarios where customers have already availed discounts using voucher/coupon,and you do not want them to redeem Coins as well. Possible values:true
- Customer not allowed to use CRED coins to make payment.false
(default) - Customer can use CRED coins to make payment.
receipt
optionalstring
Your receipt id for this order should be passed here. Maximum length 40 characters.notes
optionalobject
Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example,"note_key": "Beam me up Scotty”
.
Pass method
and provider
Parameters During Payment Creation🔗
Copyrazorpay.createPayment({
amount: 12340,
currency: 'INR',
email: 'gaurav.kumar@example.com',
contact: '9111145678',
order_id: 'order_EAbtuXPh24LrEc',
method: 'app',
provider: 'cred'
});
Request Parameters🔗
Along with the other checkout options, you must pass:
method
mandatorystring
The method used to make the payment. Here, it must beapp
.provider
mandatory if method=appstring
Name of the PSP app. Here, it must becred
.