Payments

Capture and fetch Payments using Razorpay APIs.


You can accept

from your customers by integrating your website or app with . You can also use Razorpay products such as , , , and to accept Payments.

Handy Tips

If you want to integrate with our APIs directly, reach out to our

with your requirements.

Payments APIs are used to capture and fetch payments. You can also fetch payments based on orders and card details of payment.

You can try out our APIs on the Razorpay Postman Public Workspace.

Watch Out!

You can use Payments API only to retrieve payment details or change the status from authorized to captured and not to collect payments. You can use one of the

to accept payments.

The Payments entity has the following fields:

id

string Unique identifier of the payment.

entity

string Indicates the type of entity.

amount

integer The payment amount in currency subunits. For example, for an amount of ₹1.00 enter 100.

currency

string The currency in which the payment is made. Refer to the list of

that we support.

status

string The status of the payment. Possible values:

  • created
  • authorized
  • captured
  • refunded
  • failed

method

string The payment method used for making the payment. Possible values:

  • card
  • netbanking
  • wallet
  • emi
  • upi

order_id

string Order id, if provided. Know more about

.

description

string Description of the payment, if any.

international

boolean Indicates whether the payment is done via an international card or a domestic one.

refund_status

string The refund status of the payment. Possible values:

  • null
  • partial
  • full

amount_refunded

integer The amount refunded in currency subunits. For example, if amount_refunded = 100, it is equal to ₹1.00.

captured

boolean Indicates if the payment is captured.

email

string Customer email address used for the payment.

contact

string Customer contact number used for the payment.

fee

integer Fee (including GST) charged by Razorpay.

tax

integer GST charged for the payment.

error_code

string Error that occurred during payment. For example, BAD_REQUEST_ERROR.

error_description

string Description of the error that occurred during payment. For example, Payment processing failed because of incorrect OTP.

error_source

string The point of failure. For example, customer.

error_step

string The stage where the transaction failure occurred. The stages can vary depending on the payment method used to complete the transaction. For example, payment_authentication.

error_reason

string The exact error reason. For example, incorrect_otp.

notes

json object Contains user-defined fields, stored for reference purposes.

created_at

integer Timestamp, in UNIX format, on which the payment was created.

card_id

string The unique identifier of the card used by the customer to make the payment.

card

object Details of the card used to make the payment.

id

string The unique identifier of the card used by the customer to make the payment.

entity

string The name of the entity. Here, it is card.

name

string Name of the cardholder.

last4

integer The last 4 digits of the card number.

network

string The card network. Possible values:

  • American Express
  • Diners Club
  • Maestro
  • MasterCard
  • RuPay
  • Unknown
  • Visa

type

string The card type. Possible values:

  • credit
  • debit
  • prepaid
  • unknown

issuer

string The card issuer. The 4-character code denotes the issuing bank.

Handy Tips

This attribute will not be set for the card issued by a foreign bank.

emi

boolean This attribute is set to true if the card can be used for EMI payment method.

sub_type

string The sub-type of the customer's card. Possible values:

  • customer

  • business

    Handy Tips

    Know how to accept payments made by customers using

    .

bank

string The 4-character bank code which the customer's account is associated with. For example, UTIB for Axis Bank.

vpa

string The customer's VPA (Virtual Payment Address) or UPI id used to make the payment. For example, gauravkumar@exampleupi.

wallet

string The name of the wallet used by the customer to make the payment. For example, payzapp.

acquirer_data

array A dynamic array consisting of a unique reference numbers.

rrn

string A unique bank reference number provided by the banking partner when a refund is processed. This reference number can be used by the customer to track the status of the refund with the bank.

authentication_reference_number

string A unique reference number generated for RuPay card payments.

bank_transaction_id

string A unique reference number provided by the banking partner in case of netbanking payments.

You can perform the following actions on payments from the

:

The following endpoint helps you capture a payment.

POST
/payments/:id/capture
  • After the customer's bank authorises the payment, you must verify if the authorised amount deducted from the customer's account is the same as the amount paid by the customer on your website or app.
  • You can of payments on the Razorpay Dashboard.
  • Use the above endpoint to change the payment status from authorized to captured.

Watch Out!

Attempting to capture a payment whose status is not authorized will produce an error.

Handy Tips

  • While creating a capture request, in the amount field, enter only the amount associated with the order that is stored in your database.
  • After the payment capture, the funds are transferred to your account in T+2 days in case of a domestic transaction. For international transactions, the time taken is T+7 business days. The amount sent in the capture request must come from a verified source and be the amount you expect to receive.

id

mandatory

string Unique identifier of the payment to be captured.

amount

mandatory

integer The amount to be captured (should be equal to the authorised amount, in the smallest unit of the currency).

currency

mandatory

string ISO code of the currency in which the payment was made. Refer to the

.

Descriptions for the response parameters are present in the

parameters table.

Given below is a list of possible errors you may face while capturing a payment.

ErrorCauseSolution
The API {key/secret} provided is invalid.The API credentials passed in the API call differ from the ones generated on the Dashboard.The API keys must be active and entered correctly with no whitespace before or after.
Capture amount must be equal to the amount authorized
  • The capture amount is incorrect.
  • The amount you are trying to capture differs from the authorised amount .
  • Enter the correct capture amount.
  • Ensure that the amount to be captured is equal to the authorised amount.
This payment has already been capturedYou are trying to capture an already captured payment.Ensure that the payment is in the authorized state to capture it successfully.
The id provided does not existThe payment_id provided is incorrect.Enter the correct payment_id .
The requested URL was not found on the server.The URL is incorrect.Use the correct URL.
The amount must be an integerThe amount specified is incorrect.Enter the correct amount without any decimal points.

The following endpoint retrieves details of a specific payment using its id.

GET
/payments/:id

id

mandatory

string Unique identifier of the payment to be retrieved.

expand[]

optional

array Used to retrieve additional information about the payment and the method used to make the payment. The response will include a sub-entity if this parameter is used. Supported values:

  • card : Expanded card details, applicable for card and EMI payments.
  • emi : Expanded EMI plan details, applicable for EMI payments.
  • offers : Expanded Offer details, applicable when an offer was applied to the payment.

Descriptions for the response parameters are present in the

parameters table.

Given below is a list of possible errors you may face while fetching a payment.

ErrorCauseSolution
The API {key/secret} provided is invalid.The API credentials passed in the API call differ from the ones generated on the Dashboard.The API keys must be active and entered correctly with no whitespace before or after.
The id provided does not existThe payment_id provided is incorrect.Use the correct payment_id .

The expand[] parameter on the Payments endpoint returns expandable fields in the response.

expand[]=card

Used to expand the card details when the payment method is card.

expand[]=emi

Used to expand the EMI plan details when the payment method is emi.

expand[]=offers

Used to expand the offers applied to a payment, wherever applicable.

The following endpoint retrieves details of all the payments.

GET
/payments

Handy Tips

By default, only the last 10 records are displayed. You can use the count and skip parameters to retrieve the specific number of records that you need.

from

optional

integer UNIX timestamp, in seconds, from when payments are to be fetched.

to

optional

integer UNIX timestamp, in seconds, till when payments are to be fetched.

count

optional

integer Number of payments to be fetched.
Default value is 10. Maximum value is 100. This can be used for pagination, in combination with the skip parameter.

skip

optional

integer Number of records to be skipped while fetching the payments.

expand[]

optional

array Used to retrieve additional information about the payment, the method used to make the payment. The response will include a sub-entity if this parameter is used.
Possible values:

  • card: Expanded card details, usable for card and EMI payments.
  • emi: Expanded EMI plan details, usable for EMI payments.

Descriptions for the response parameters are present in the

parameters table.

Given below is a list of possible errors you may face while fetching multiple payments.

ErrorCauseSolution
The API {key/secret} provided is invalid.The API credentials passed in the API call differ from the ones generated on the Dashboard.The API keys must be active and entered correctly with no whitespace before or after.
from must be between 946684800 and 4765046400The time range entered is invalid.Enter a valid time range between 946684800 and 4765046400 .

The following endpoint retrieves the expanded card details of the payments, in which the payment method is card.

GET
/payments/?expand[]=card

Given below is a list of possible errors you may face while fetching expanded card details for payments.

ErrorCauseSolution
The API {key/secret} provided is invalid.The API credentials passed in the API call differ from the ones generated on the Dashboard.The API keys must be active and entered correctly with no whitespace before or after.
Value of each expand must be one of following types: card, emi, transaction, transaction.settlement, refunds, offers, tokenThe value for the expand parameter is incorrect.Enter the correct value for the expand parameter. Here it is card .

The following endpoint retrieves the expanded EMI plan details of the payments, in which the payment method is emi.

GET
/payments/?expand[]=emi

Given below is a list of possible errors you may face while fetching expanded EMI details for payments.

ErrorCauseSolution
The API {key/secret} provided is invalid.The API credentials passed in the API call differ from the ones generated on the Dashboard.The API keys must be active and entered correctly with no whitespace before or after.
Value of each expand must be one of following types: card, emi, transaction, transaction.settlement, refunds, offers, tokenThe value for the expand parameter is incorrect.Enter the correct value for the expand parameter. Here it is emi .

The following endpoint retrieves payments corresponding to an order.

GET
/orders/:id/payments

id

mandatory

string Unique identifier of the order for which you want to fetch payment details.

Descriptions for the response parameters are present in the

parameters table.

Given below is a list of possible errors you may face while fetching payments based on orders.

ErrorCauseSolution
The API {key/secret} provided is invalid.The API credentials passed in the API call differ from the ones generated on the Dashboard.The API keys must be active and entered correctly with no whitespace before or after.
The id provided does not existThe order_id is missing.Ensure that you pass the order_id in the URL.
_id is not a valid idThe order_id provided is incorrect.Enter the correct order_id .

The following endpoint retrieves the details of the card used to make a payment.

GET
/payments/:id/card

id

mandatory

string Unique identifier of the payment for which you want to retrieve card details.

Descriptions for the response parameters are present in the

parameters table.

Given below is a list of possible errors you may face while fetching card details of a payment.

ErrorCauseSolution
The API {key/secret} provided is invalid.The API credentials passed in the API call differ from the ones generated on the Dashboard.The API keys must be active and entered correctly with no whitespace before or after.
The id provided does not existThe payment_id provided is incorrect.Enter the correct payment_id .
Payment was not done using cardThe payment for the payment_id entered was not completed using a card.Use a payment_id which was completed using a card.

The following endpoint helps you modify the notes field for a particular payment.

PATCH
/payments/:id/

You can modify an existing payment to update the Notes field only. Notes can be used to record additional information about the payment. You can add up to 15 key-value pairs with each value of the key not exceeding 256 characters.

id

mandatory

string Unique identifier of the payment for which the Notes field should be updated.

notes

mandatory

json object Contains user-defined fields and is stored for reference purposes. Know more about

.

Descriptions for the response parameters are present in the

parameters table.

Given below is a possible error you may face while updating a payment.

ErrorCauseSolution
The API {key/secret} provided is invalid.The API credentials passed in the API call differ from the ones generated on the Dashboard.The API keys must be active and entered correctly with no whitespace before or after.

to configure and receive notifications when a specific occurs. When one of these events is triggered, we send an HTTP POST in JSON to the webhook's configured URL.


Was this page helpful?