-
Notifications
You must be signed in to change notification settings - Fork 111
Home
Instantiate the razorpay instance with key_id
& key_secret
. You can obtain the keys from the dashboard app (https://dashboard.razorpay.com/#/app/keys)
var instance = new Razorpay({
key_id: 'YOUR_KEY_ID',
key_secret: 'YOUR_KEY_SECRET'
})
The resources can be accessed via the instance. All the methods invocations follows the namespaced signature
// API signature
// {razorpayInstance}.{resourceName}.{methodName}(resourceId [, params])
// example
instance.payments.fetch(paymentId)
Every resource method returns a promise.
instance.payments.all({
from: '2016-08-01',
to: '2016-08-20'
}).then((response) => {
// handle success
}).catch((error) => {
// handle error
})
If you want to use callbacks instead of promises, every resource method will accept a callback function as a last parameter. The callback functions will behave as Error First Callbacks
instance.payments.all({
from: '2016-08-01',
to: '2016-08-20'
}, function(error, response) => {
if (error) {
// handle error
} else {
// handle success
}
})
*
indicates mandatory field
Fetches payments list.
Name | Type | Description |
---|---|---|
from | timestamp | timestamp after which the payments were created |
to | timestamp | timestamp before which the payments were created |
count | integer | number of payments to fetch (default: 10) |
skip | integer | number of payments to be skipped (default: 0) |
Retrieves a particular payment.
Parameters:
Name | Type | Description |
---|---|---|
payment_id* | string | Id of the payment to be retrieved |
Capture a payment.
Parameters:
Name | Type | Description |
---|---|---|
paymentId* | string | Id of the payment to capture |
amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) |
Refund a payment.
Parameters:
Name | Type | Description |
---|---|---|
payment_id* | string | Id of the payment to refund |
amount | integer | The amount to be refunded (in paise) |
notes | object | A key-value pair |
--
Fetches refunds list. If
payment_id
is passed, refunds of that particular payment is fetched
Parameters:
Name | Type | Description |
---|---|---|
payment_id | string | The payment id whose refunds are to be fetched |
from | timestamp | timestamp after which the payments were created |
to | timestamp | timestamp before which the payments were created |
count | integer | number of payments to fetch (default: 10) |
skip | boolean | number of payments to be skipped (default: 0) |
Fetches a refund.
Parameters:
Name | Type | Description |
---|---|---|
refund_id* | string | ID of the refund to be retrieved |
payment_id | string | The id of the payment whose refund is to be retrieved |
--
Create an order in razorpay
Parameters:
Name | Type | Description |
---|---|---|
amount* | integer | Amount of the order to be paid |
currency | string | Currency of the order. Currently only INR is supported. |
receipt* | string | Your system order reference id. |
payment_capture | boolean | Whether the payment should be captured automatically or not. Default false
|
notes | object | A key-value pair |
Fetches orders list
Parameters
Name | Type | Description |
---|---|---|
from | timestamp | timestamp after which the payments were created |
to | timestamp | timestamp before which the payments were created |
count | integer | number of payments to fetch (default: 10) |
skip | integer | number of payments to be skipped (default: 0) |
authorized | boolean | Orders for which payments are currently in authorized state. |
receipt | string | Orders with the provided value for receipt. |
Fetches a particular order
Parameters
Name | Type | Description |
---|---|---|
order_id* | string | The id of the order to be retrieved |
Fetches an order's payments
Parameters
Name | Type | Description |
---|---|---|
order_id* | string | The id of the order to be retrieved |
--
Create a customer
Parameters:
Name | Type | Description |
---|---|---|
name | string | Name of the customer |
email* | string | Email of the customer |
contact* | string | Contact number of the customer |
notes | object | A key-value pair |
Edit a customer
Parameters
Name | Type | Description |
---|---|---|
customer_id* | string | The id of the customer to be edited |
name | string | Name of the customer |
string | Email of the customer | |
contact | string | Contact number of the customer |
notes | object | A key-value pair |
Fetches a customer
Parameters
Name | Type | Description |
---|---|---|
customer_id* | string | The id of the customer to be retrieved |
Fetches all card tokens of a customer
Parameters
Name | Type | Description |
---|---|---|
customer_id* | string | The id of the customer whose card tokens has to be retrieved |
Fetches a particular card token of a customer
Parameters
Name | Type | Description |
---|---|---|
customer_id* | string | The id of the customer whose card token has to be retrieved |
token_id* | string | The id of the token to be retrieved |
Deletes the card token
Parameters
Name | Type | Description |
---|---|---|
customer_id* | string | The id of the customer whose card token has to be deleted |
token_id* | string | The id of the token to be deleted |
--
Fetch all transfers
Parameters
Name | Type | Description |
---|---|---|
payment_id | string | If sent in params, fetches all transfers created on the payment |
Fetch transfer by ID
Parameters
Name | Type | Description |
---|---|---|
transfer_id* | string | The id of the transfer to be fetched |
Edit transfer attributes
Parameters
Name | Type | Description |
---|---|---|
transfer_id* | string | The id of the transfer to be edited |
on_hold | boolean | Transfer on hold status |
on_hold_until | integer | Transfer settlement on hold until time |
notes | object | A key-value pair |
Create a new direct transfer
Create a transfer from a payment
Parameters
Name | Type | Description |
---|---|---|
payment_id* | string | The id of the payment to be transferred |
Reverse a transfer
Parameters
Name | Type | Description |
---|---|---|
transfer_id* | string | The id of the transfer to be reversed |
amount* | integer | Amount to reverse |
currency* | string | Currency code |
notes | object | A key-value pair |