Order is an important step in the payment process.
- An order should be created for every payment.
- You can create an order using the Orders API. It is a server-side API call. Know how to authenticate Orders API.
- The order_id received in the response should be passed to the checkout. This ties the Order with the payment and secures the request from being tampered.
You can capture payments automatically with one-time Payment Capture setting configuration on the Razorpay Dashboard.
In the sample app, the rubysample.rb file contains the code for order creation using Orders API.
require "razorpay" Razorpay.setup('YOUR_KEY_ID', 'YOUR_SECRET') order = Razorpay::Order.create amount: 50000, currency: 'INR', receipt: 'TEST'
Here is the list of parameters for creating the order:
integerThe 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 be
stringThe currency in which the transaction should be made. See the list of supported currencies. Length must be of 3 characters.
stringPass the receipt id created for this order. Maximum length 40 characters.
json objectOptional notes for order. Key-value pair 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”.
booleanIndicates whether the customer can make a partial payment. Possible values:
true: The customer can make partial payments.
false(default): The customer cannot make partial payments.
Know more about Orders API.
The error response parameters are available in the API Reference Guide.