Payments API's

The Razorpay Payments API enables you to retrieve, manage, and update payment transactions made by your customers. A payment in Razorpay is the result of a successful attempt to pay against an order or directly through the checkout process.

This API is essential for tracking payment statuses, fetching transaction details, and performing post-payment operations like adding notes or custom metadata. You can use the Payments API to retrieve all payments, get a specific payment by ID, or update an existing payment as part of your reconciliation or reporting workflows.

End Points

Method Endpoint
POST /payment/create
GET /payment/get
GET /payment/get?id=
PUT /payment/update?id=

Create a Payment

The Create Payment endpoint (POST /payment/create/<id>) is used to capture a previously authorized payment using its unique identifier. Once a payment is authorized, it must be captured to complete the transaction and transfer funds. This endpoint requires the payment_id as a path parameter and expects fields like amount (in the smallest currency unit) and currency (ISO format) in the request body. The amount should match the order amount stored in your database. This API ensures that the authorized payment is successfully finalized and recorded in your system.

Arguments
id string (Required)

Unique identifier of the payment to be captured.

amount integer (Required)

Payment amount in the smallest currency sub-unit. For example, if the amount to be charged is ₹299.00, then pass 29900 in this field. In the case of three decimal currencies, such as KWD, BHD and OMR, to accept a payment of 295.991, pass the value as 295990. And in the case of zero decimal currencies such as JPY, to accept a payment of 295, pass the value as 295.

currency string (Required)

ISO code for the currency in which you want to accept the payment. The default length is 3 characters.

Request Example

const cloudlesspay = new CloudlessPayment({ key: "Your-API-key" });
const response = await cloudlesspay.payment.create(paymentId, data);

curl --request POST \
  --url https://www.cloudlesspayment.com/api/payment/create?id=paymentId \
  --header 'x-api-key: Your-API-key' \ 
  --header 'Content-Type: application/json' \
  --data '{
    "amount" : 1000,
    "currency" : "INR"
  }'
Body Parameters

{
  "amount" : 1000,
  "currency" : "INR"
}
                                        
Response Example

{
  "id": "pay_G3P9vcIhRs3NV4",
  "entity": "payment",
  "amount": 1000,
  "currency": "INR",
  "status": "captured",
  "order_id": "order_GjCr5oKh4AVC51",
  "invoice_id": null,
  "international": false,
  "method": "card",
  "amount_refunded": 0,
  "refund_status": null,
  "captured": true,
  "description": "Payment for Adidas shoes",
  "card_id": "card_KOdY30ajbuyOYN",
  "bank": null,
  "wallet": null,
  "vpa": null,
  "email": "gaurav.kumar@example.com",
  "contact": "9000090000",
  "customer_id": "cust_K6fNE0WJZWGqtN",
  "token_id": "token_KOdY$DBYQOv08n",
  "notes": [],
  "fee": 1,
  "tax": 0,
  "error_code": null,
  "error_description": null,
  "error_source": null,
  "error_step": null,
  "error_reason": null,
  "acquirer_data": {
    "authentication_reference_number": "100222021120200000000742753928"
  },
  "created_at": 1605871409,
  "provider": null,
  "upi": {
      "payer_account_type": "credit_card",
      "vpa": "gaurav.kumar@examplebank",
      "flow": "intent"
  },
  "reward": null
}
                                        

Get All Payment(s)

The Get All Payments endpoint (GET /payment/get) is used to retrieve a list of all payments processed through the system. This is useful for displaying transaction history, reconciling financial records, or tracking the status of multiple payments in one place. The API typically returns payment details such as payment ID, amount, currency, status, method, and timestamps. It can be extended to support filters like date range, payment status, or customer reference, and may include pagination to handle large volumes of data efficiently.

Request Example

const cloudlesspay = new CloudlessPayment({ key: "Your-API-key" });
const response = await cloudlesspay.payment.fetchAll();

curl --request GET \
  --url https://www.cloudlesspayment.com/api/payment/get \
  --header 'x-api-key: Your-API-key'
Response Example

{
    "data": {
        "message": "Razorpay GET logic executed successfully",
        "result": {
            "action": "fetch",
            "data": {
                "count": 10,
                "entity": "collection",
                "items": [
                    {
                        "acquirer_data": {
                            "auth_code": null
                        },
                        "amount": 150000,
                        "amount_refunded": 0,
                        "bank": null,
                        "captured": true,
                        "card": {
                            "emi": false,
                            "entity": "card",
                            "id": "card_Qtc48h7FxFVod0",
                            "international": false,
                            "issuer": "UTIB",
                            "last4": "5449",
                            "name": "",
                            "network": "MasterCard",
                            "sub_type": "consumer",
                            "token_iin": null,
                            "type": "credit"
                        },
                        "card_id": "card_Qtc48h7FxFVod0",
                        "contact": "+919999999999",
                        "created_at": 1752647841,
                        "currency": "INR",
                        "description": "Payment for Updating Subscription",
                        "email": "void@razorpay.com",
                        "entity": "payment",
                        "error_code": null,
                        "error_description": null,
                        "error_reason": null,
                        "error_source": null,
                        "error_step": null,
                        "fee": 4350,
                        "id": "pay_QtdtJOAgSOM1ox",
                        "international": false,
                        "invoice_id": "inv_QtdtGhWl4ojTXp",
                        "method": "card",
                        "notes": [],
                        "order_id": "order_QtdtIcntZyCOXE",
                        "refund_status": null,
                        "status": "captured",
                        "tax": 0,
                        "token_id": "token_Qtc499viVQonvm",
                        "vpa": null,
                        "wallet": null
                    },
                    {
                        "acquirer_data": {
                            "auth_code": "539260"
                        },
                        "amount": 1350000,
                        "amount_refunded": 0,
                        "bank": null,
                        "captured": true,
                        "card": {
                            "emi": false,
                            "entity": "card",
                            "id": "card_QnNEcBlHOSBMwA",
                            "international": false,
                            "issuer": "UTIB",
                            "last4": "5449",
                            "name": "",
                            "network": "MasterCard",
                            "sub_type": "consumer",
                            "token_iin": null,
                            "type": "credit"
                        },
                        "card_id": "card_QnNEcBlHOSBMwA",
                        "contact": "+917695978704",
                        "created_at": 1751279143,
                        "currency": "INR",
                        "description": "Start Subscription",
                        "email": "akashceo@mcubeinfotech.com",
                        "entity": "payment",
                        "error_code": null,
                        "error_description": null,
                        "error_reason": null,
                        "error_source": null,
                        "error_step": null,
                        "fee": 46198,
                        "id": "pay_QnNEbiY99dNR3M",
                        "international": false,
                        "invoice_id": "inv_QnL02uBg7gfLtF",
                        "method": "card",
                        "notes": {
                            "dashboard": "true"
                        },
                        "order_id": "order_QnL047S2jBc5SF",
                        "refund_status": null,
                        "status": "captured",
                        "tax": 7048,
                        "token_id": "token_QnNEcQBWRaZ2K3",
                        "vpa": null,
                        "wallet": null
                    },
                    {
                        "acquirer_data": {
                            "auth_code": "840593"
                        },
                        "amount": 90000,
                        "amount_refunded": 0,
                        "bank": null,
                        "captured": true,
                        "card": {
                            "emi": false,
                            "entity": "card",
                            "id": "card_QnNDHCu9V4aTsQ",
                            "international": false,
                            "issuer": "UTIB",
                            "last4": "5449",
                            "name": "",
                            "network": "MasterCard",
                            "sub_type": "consumer",
                            "token_iin": null,
                            "type": "credit"
                        },
                        "card_id": "card_QnNDHCu9V4aTsQ",
                        "contact": "+917695978704",
                        "created_at": 1751279068,
                        "currency": "INR",
                        "description": "Start Subscription",
                        "email": "akashceo@mcubeinfotech.com",
                        "entity": "payment",
                        "error_code": null,
                        "error_description": null,
                        "error_reason": null,
                        "error_source": null,
                        "error_step": null,
                        "fee": 2610,
                        "id": "pay_QnNDFok43fqNFk",
                        "international": false,
                        "invoice_id": "inv_QnM0hoJH8wxgcz",
                        "method": "card",
                        "notes": {
                            "dashboard": "true"
                        },
                        "order_id": "order_QnM0j2uh8m2jVx",
                        "refund_status": null,
                        "status": "captured",
                        "tax": 0,
                        "token_id": "token_QnNDHTeQYVfniE",
                        "vpa": null,
                        "wallet": null
                    }
                ]
            },
            "vendor": "razorpay"
        },
        "vendor": "razorpay"
    },
    "status": "success"
}
                                        

Get Specific Payments

The Get Payment by ID endpoint (GET /payment/get/<id>) retrieves the details of a specific payment using its unique identifier. This is useful when you need to verify the status, amount, currency, payment method, or metadata associated with a particular transaction. It is typically used in post-payment workflows, reconciliation processes, or whenever detailed insight into an individual payment is required.

Arguments
id string (Required)

Unique identifier of the payment to retrieve. Must match an existing payment created earlier.

Request Example

const cloudlesspay = new CloudlessPayment({ key: "Your-API-key" });
const response = await cloudlesspay.payment.fetchById(paymentId);

curl --request GET \
  --url https://www.cloudlesspayment.com/api/payment/get?id=paymentId \
  --header 'x-api-key: Your-API-key'
Response Example

{
    "data": {
        "message": "Razorpay GET logic executed successfully",
        "result": {
            "action": "fetch",
            "data": {
                "acquirer_data": {
                    "auth_code": "205951"
                },
                "amount": 23200,
                "amount_refunded": 0,
                "bank": null,
                "captured": true,
                "card": {
                    "emi": false,
                    "entity": "card",
                    "id": "card_QhnNmAyf4gPINN",
                    "international": false,
                    "issuer": "UTIB",
                    "last4": "5449",
                    "name": "",
                    "network": "MasterCard",
                    "sub_type": "consumer",
                    "token_iin": null,
                    "type": "credit"
                },
                "card_id": "card_QhnNmAyf4gPINN",
                "contact": "+919500556677",
                "created_at": 1750061185,
                "currency": "INR",
                "description": "Add Credits to Your Wallet",
                "email": "shrithissurya@mcubeinfotech.com",
                "entity": "payment",
                "error_code": null,
                "error_description": null,
                "error_reason": null,
                "error_source": null,
                "error_step": null,
                "fee": 464,
                "id": "pay_QhnNlgaSCw8hgJ",
                "international": false,
                "invoice_id": null,
                "method": "card",
                "notes": {
                    "customer_name": "Victu Bhaai",
                    "order_purpose": "Subscription for June"
                },
                "order_id": "order_QhnNWt07zHZ436",
                "refund_status": null,
                "status": "captured",
                "tax": 0,
                "vpa": null,
                "wallet": null
            },
            "vendor": "razorpay"
        },
        "vendor": "razorpay"
    },
    "status": "success"
}
                                        

Update a Payments

The Update Payment endpoint (PUT /payment/update/<id>) is used to modify the details of an existing payment by providing its unique payment ID. This API is typically used to update optional fields such as notes, metadata, or customer-related information associated with a payment record. It helps in enriching the payment data for reporting, reconciliation, or reference purposes. The payment_id must be passed as a path parameter, and the updated values should be included in the request body.

Arguments
id string (Required)

Unique ID of the payment to update. Must reference an existing payment in the system.

notes object (Required)

A key-value pair object to store additional information or custom data for the payment.

Request Example

const cloudlesspay = new CloudlessPayment({ key: "Your-API-key" });
const response = await cloudlesspay.payment.fetchById(paymentId, data);

curl --request PUT \
  --url https://www.cloudlesspayment.com/api/payment/update?id=paymentId \
  --header 'x-api-key: Your-API-key' \
  --header 'Content-Type: application/json' \
  --data '{
    "notes": {
      "order_purpose": "Subscription for June",
      "customer_name": "Jai Surya"
    }
  }'
Body Parameters

{
  "notes": {
    "order_purpose": "Subscription for June",
    "customer_name": "Jai Surya"
  }
}
                                        
Response Example

{
    "data": {
        "message": "Razorpay logic executed successfully",
        "result": {
            "action": "edit",
            "data": {
                "acquirer_data": {
                    "auth_code": "205951"
                },
                "amount": 23200,
                "amount_refunded": 0,
                "bank": null,
                "captured": true,
                "card": {
                    "emi": false,
                    "entity": "card",
                    "id": "card_QhnNmAyf4gPINN",
                    "international": false,
                    "issuer": "UTIB",
                    "last4": "5449",
                    "name": "",
                    "network": "MasterCard",
                    "sub_type": "consumer",
                    "token_iin": null,
                    "type": "credit"
                },
                "card_id": "card_QhnNmAyf4gPINN",
                "contact": "+919500556677",
                "created_at": 1750061185,
                "currency": "INR",
                "description": "Add Credits to Your Wallet",
                "email": "shrithissurya@mcubeinfotech.com",
                "entity": "payment",
                "error_code": null,
                "error_description": null,
                "error_reason": null,
                "error_source": null,
                "error_step": null,
                "fee": 464,
                "id": "pay_QhnNlgaSCw8hgJ",
                "international": false,
                "invoice_id": null,
                "method": "card",
                "notes": {
                    "customer_name": "Jai Surya",
                    "order_purpose": "Subscription for June"
                },
                "order_id": "order_QhnNWt07zHZ436",
                "refund_status": null,
                "status": "captured",
                "tax": 0,
                "vpa": null,
                "wallet": null
            },
            "vendor": "razorpay"
        },
        "vendor": "razorpay"
    },
    "status": "success"
}