{"_id":"54dec8b7c2b4b70d009c3f12","__v":19,"hidden":false,"slug":"getting-started","title":"Getting Started with Razorpay","version":"54dec8b6c2b4b70d009c3f0f","api":{"auth":"required","params":[],"results":{"codes":[]},"settings":"","url":""},"createdAt":"2015-01-28T01:29:00.047Z","excerpt":"This page will help you get started with Razorpay. You'll be up and running in a jiffy!","sync_unique":"","type":"basic","body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Introduction to Razorpay\"\n}\n[/block]\nWelcome to the Razorpay API! You can use our API for authorizing, capturing, refunding a payment as well as getting information of previous payments.\n\nWe have language bindings in cURL, Java, .NET, PHP, Python, Ruby and Node for now. cURL examples are provided and can be used in other languages as well. Code examples are viewable in the dark panel to the right. Programming language of the examples can be switched via links placed on top of the examples snippets.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Overview of the Payments Flow\"\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/63ea6c7-payment-flow-final-image.png\",\n        \"payment-flow-final-image.png\",\n        928,\n        230,\n        \"#dae4ef\"\n      ]\n    }\n  ]\n}\n[/block]\n1. Customer selects an item and places an **Order** on your website/app.\n2. Customer enters the payment details and clicks the  **Pay** button in the Checkout form.\n3. Merchant  verifies the  purchase as complete for the payment made by the customer.\n4. Merchant receives the payment in his account as per the settlement schedule of the bank.\n\n\n[block:api-header]\n{\n  \"title\": \"Understanding the Payment Flow\"\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/8ca0400-orders_flow.png\",\n        \"orders_flow.png\",\n        1536,\n        514,\n        \"#7a91d0\"\n      ]\n    }\n  ]\n}\n[/block]\n**Stage 1** -  Create an Order \n                     The customer selects an item on the merchant's website/app. An order is created and is \n                     sent to the merchant's server. An Order ID is created in the application's database at \n                     the merchant's side. \n\n**Stage 2 ** -  Collection of the Payment details\n                       On the Checkout form, the customer enters the payment details, clicks the **Pay** \n                       button and completes the payment. The payment details thus obtained from the \n                       customer are securely submitted to the merchant's server.   \n \n**Stage 3** -  Authentication and Authorization of the Payment\n                      The merchant's payment server sends the payment details to the merchant's bank. The \n                      merchant's bank (acquirer bank) sends an authentication request to the customer's \n                      bank (issuing bank). After a successful authentication, the merchant's bank is now \n                      authorized to deduct the amount from the customer's bank account.\n                      \n **Stage 4** - Capture the Payment \n                       The authorized amount will not be automatically transferred to the merchant’s account \n                       until captured by merchant.In this stage, the merchant validates that the authorized \n                       amount deducted from the customer's  account is the same as the expected amount \n                       for the order placed by the customer.\n\n **Stage 5** - Settlement of the Payment\n                      After capture, the amount is transferred to the merchant's account within T+3 days \n                      where 'T' is the day on which payment is captured. Any authorization not followed by \n                      a capture within 5 days is automatically deemed void and a refund is initiated.\n[block:api-header]\n{\n  \"title\": \"Capturing Payments\"\n}\n[/block]\nWhen a customer makes a payment on the Checkout, the payment information is sent for processing to the customer's bank. The authorization process checks the validity of the payment method and the availability of sufficient funds for the transaction. Once the payment is authorized by the customer's bank, the payment is captured and settled to your bank account. \n\nAfter a successful authorization of the payment, Razorpay enables you to capture the payment in two ways:\n\n  * **Automatic Capture** \n     An automatic capture is an authorization followed by an 'immediate' capture of the payments. This \n    allows the merchants to automatically capture payments from  customers before the authorization \n    period ends, which saves time when processing orders.\n\n  * **Standard Capture**\n    A standard capture or 'authorization and capture' is an authorization followed by a 'delayed' \n    capture of the  payment, until a later time. This allows the merchants to delay order fulfilment \n    process and make adjustments in the authorization amount due to order changes occurring after \n    the initial order is placed.\n\n**Enabling Auto Capture of Payments**\n    In order to setup automatic capture of payments, you must implement Orders API in your \n    integration. Learn about auto capturing payments, go to [Orders](page:orders)\n\n**Enabling Manual capture of Payments**\n  The payments can be captured manually as follows:\n  *   Dashboard\n      1. Login into your dashboard [Razorpay Dashboard] \n           (https://dashboard.razorpay.com) with the merchant credentials\n      2.  Go to **Transactions**\n      3.  Click the payment in authorized state, which opens a panel to the right of the screen\n      4.  Select **Capture Payment** present at the top of the panel in order to capture the payment\n  \n  * API\n       Construct the API request  [/payments/:id/capture](doc:v1paymentsidcapture) ]\n        \n\n[block:api-header]\n{\n  \"title\": \"Creating Orders\"\n}\n[/block]\nBy default, for each order placed by the customer on your website/app, a corresponding Order ID is created in the database running in your application's backend.  Integrating with Razorpay's Order API, an 'order_ID' is now passed to the Checkout form and the payment made is now associated with an Order. For each Order created in your application's database, a corresponding 'razorpay_id' should be created too.\n\nIf you want to auto capture your payments, go to the section, [Orders](page:orders) \n[block:api-header]\n{\n  \"title\": \"Implementing Checkout\"\n}\n[/block]\nThe payment details entered in the Checkout are securely sent to the application's servers. Checkout securely accepts your customer's payment details and directly passes them to Razorpay's servers. Razorpay returns a token representation of those payment details, which can then be submitted to your server for use.\n\n**Integrating Checkout**\nYou can integrate the [Checkout Form](doc:checkout-form) in your website or app \nFor mobile devices, read the section, [Android and iOS SDK](doc:mobile-payments).","isReference":false,"order":0,"parentDoc":null,"user":"54c83ac1ab706219009e067a","category":"54dec8b7c2b4b70d009c3f10","githubsync":"","link_external":false,"link_url":"","next":{"description":"","pages":[]},"project":"54c83b5aab706219009e067b","updates":["5a0bf37580a35b0012c35d02","5b980be1f807610003ff90b4","5bb7134f29a7fb0003a067d7","5c00e22d07955b02f0b7cd0a"],"childrenPages":[]}

Getting Started with Razorpay

This page will help you get started with Razorpay. You'll be up and running in a jiffy!

[block:api-header] { "type": "basic", "title": "Introduction to Razorpay" } [/block] Welcome to the Razorpay API! You can use our API for authorizing, capturing, refunding a payment as well as getting information of previous payments. We have language bindings in cURL, Java, .NET, PHP, Python, Ruby and Node for now. cURL examples are provided and can be used in other languages as well. Code examples are viewable in the dark panel to the right. Programming language of the examples can be switched via links placed on top of the examples snippets. [block:api-header] { "type": "basic", "title": "Overview of the Payments Flow" } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/63ea6c7-payment-flow-final-image.png", "payment-flow-final-image.png", 928, 230, "#dae4ef" ] } ] } [/block] 1. Customer selects an item and places an **Order** on your website/app. 2. Customer enters the payment details and clicks the **Pay** button in the Checkout form. 3. Merchant verifies the purchase as complete for the payment made by the customer. 4. Merchant receives the payment in his account as per the settlement schedule of the bank. [block:api-header] { "title": "Understanding the Payment Flow" } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/8ca0400-orders_flow.png", "orders_flow.png", 1536, 514, "#7a91d0" ] } ] } [/block] **Stage 1** - Create an Order The customer selects an item on the merchant's website/app. An order is created and is sent to the merchant's server. An Order ID is created in the application's database at the merchant's side. **Stage 2 ** - Collection of the Payment details On the Checkout form, the customer enters the payment details, clicks the **Pay** button and completes the payment. The payment details thus obtained from the customer are securely submitted to the merchant's server. **Stage 3** - Authentication and Authorization of the Payment The merchant's payment server sends the payment details to the merchant's bank. The merchant's bank (acquirer bank) sends an authentication request to the customer's bank (issuing bank). After a successful authentication, the merchant's bank is now authorized to deduct the amount from the customer's bank account. **Stage 4** - Capture the Payment The authorized amount will not be automatically transferred to the merchant’s account until captured by merchant.In this stage, the merchant validates that the authorized amount deducted from the customer's account is the same as the expected amount for the order placed by the customer. **Stage 5** - Settlement of the Payment After capture, the amount is transferred to the merchant's account within T+3 days where 'T' is the day on which payment is captured. Any authorization not followed by a capture within 5 days is automatically deemed void and a refund is initiated. [block:api-header] { "title": "Capturing Payments" } [/block] When a customer makes a payment on the Checkout, the payment information is sent for processing to the customer's bank. The authorization process checks the validity of the payment method and the availability of sufficient funds for the transaction. Once the payment is authorized by the customer's bank, the payment is captured and settled to your bank account. After a successful authorization of the payment, Razorpay enables you to capture the payment in two ways: * **Automatic Capture** An automatic capture is an authorization followed by an 'immediate' capture of the payments. This allows the merchants to automatically capture payments from customers before the authorization period ends, which saves time when processing orders. * **Standard Capture** A standard capture or 'authorization and capture' is an authorization followed by a 'delayed' capture of the payment, until a later time. This allows the merchants to delay order fulfilment process and make adjustments in the authorization amount due to order changes occurring after the initial order is placed. **Enabling Auto Capture of Payments** In order to setup automatic capture of payments, you must implement Orders API in your integration. Learn about auto capturing payments, go to [Orders](page:orders) **Enabling Manual capture of Payments** The payments can be captured manually as follows: * Dashboard 1. Login into your dashboard [Razorpay Dashboard] (https://dashboard.razorpay.com) with the merchant credentials 2. Go to **Transactions** 3. Click the payment in authorized state, which opens a panel to the right of the screen 4. Select **Capture Payment** present at the top of the panel in order to capture the payment * API Construct the API request [/payments/:id/capture](doc:v1paymentsidcapture) ] [block:api-header] { "title": "Creating Orders" } [/block] By default, for each order placed by the customer on your website/app, a corresponding Order ID is created in the database running in your application's backend. Integrating with Razorpay's Order API, an 'order_ID' is now passed to the Checkout form and the payment made is now associated with an Order. For each Order created in your application's database, a corresponding 'razorpay_id' should be created too. If you want to auto capture your payments, go to the section, [Orders](page:orders) [block:api-header] { "title": "Implementing Checkout" } [/block] The payment details entered in the Checkout are securely sent to the application's servers. Checkout securely accepts your customer's payment details and directly passes them to Razorpay's servers. Razorpay returns a token representation of those payment details, which can then be submitted to your server for use. **Integrating Checkout** You can integrate the [Checkout Form](doc:checkout-form) in your website or app For mobile devices, read the section, [Android and iOS SDK](doc:mobile-payments).
[block:api-header] { "type": "basic", "title": "Introduction to Razorpay" } [/block] Welcome to the Razorpay API! You can use our API for authorizing, capturing, refunding a payment as well as getting information of previous payments. We have language bindings in cURL, Java, .NET, PHP, Python, Ruby and Node for now. cURL examples are provided and can be used in other languages as well. Code examples are viewable in the dark panel to the right. Programming language of the examples can be switched via links placed on top of the examples snippets. [block:api-header] { "type": "basic", "title": "Overview of the Payments Flow" } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/63ea6c7-payment-flow-final-image.png", "payment-flow-final-image.png", 928, 230, "#dae4ef" ] } ] } [/block] 1. Customer selects an item and places an **Order** on your website/app. 2. Customer enters the payment details and clicks the **Pay** button in the Checkout form. 3. Merchant verifies the purchase as complete for the payment made by the customer. 4. Merchant receives the payment in his account as per the settlement schedule of the bank. [block:api-header] { "title": "Understanding the Payment Flow" } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/8ca0400-orders_flow.png", "orders_flow.png", 1536, 514, "#7a91d0" ] } ] } [/block] **Stage 1** - Create an Order The customer selects an item on the merchant's website/app. An order is created and is sent to the merchant's server. An Order ID is created in the application's database at the merchant's side. **Stage 2 ** - Collection of the Payment details On the Checkout form, the customer enters the payment details, clicks the **Pay** button and completes the payment. The payment details thus obtained from the customer are securely submitted to the merchant's server. **Stage 3** - Authentication and Authorization of the Payment The merchant's payment server sends the payment details to the merchant's bank. The merchant's bank (acquirer bank) sends an authentication request to the customer's bank (issuing bank). After a successful authentication, the merchant's bank is now authorized to deduct the amount from the customer's bank account. **Stage 4** - Capture the Payment The authorized amount will not be automatically transferred to the merchant’s account until captured by merchant.In this stage, the merchant validates that the authorized amount deducted from the customer's account is the same as the expected amount for the order placed by the customer. **Stage 5** - Settlement of the Payment After capture, the amount is transferred to the merchant's account within T+3 days where 'T' is the day on which payment is captured. Any authorization not followed by a capture within 5 days is automatically deemed void and a refund is initiated. [block:api-header] { "title": "Capturing Payments" } [/block] When a customer makes a payment on the Checkout, the payment information is sent for processing to the customer's bank. The authorization process checks the validity of the payment method and the availability of sufficient funds for the transaction. Once the payment is authorized by the customer's bank, the payment is captured and settled to your bank account. After a successful authorization of the payment, Razorpay enables you to capture the payment in two ways: * **Automatic Capture** An automatic capture is an authorization followed by an 'immediate' capture of the payments. This allows the merchants to automatically capture payments from customers before the authorization period ends, which saves time when processing orders. * **Standard Capture** A standard capture or 'authorization and capture' is an authorization followed by a 'delayed' capture of the payment, until a later time. This allows the merchants to delay order fulfilment process and make adjustments in the authorization amount due to order changes occurring after the initial order is placed. **Enabling Auto Capture of Payments** In order to setup automatic capture of payments, you must implement Orders API in your integration. Learn about auto capturing payments, go to [Orders](page:orders) **Enabling Manual capture of Payments** The payments can be captured manually as follows: * Dashboard 1. Login into your dashboard [Razorpay Dashboard] (https://dashboard.razorpay.com) with the merchant credentials 2. Go to **Transactions** 3. Click the payment in authorized state, which opens a panel to the right of the screen 4. Select **Capture Payment** present at the top of the panel in order to capture the payment * API Construct the API request [/payments/:id/capture](doc:v1paymentsidcapture) ] [block:api-header] { "title": "Creating Orders" } [/block] By default, for each order placed by the customer on your website/app, a corresponding Order ID is created in the database running in your application's backend. Integrating with Razorpay's Order API, an 'order_ID' is now passed to the Checkout form and the payment made is now associated with an Order. For each Order created in your application's database, a corresponding 'razorpay_id' should be created too. If you want to auto capture your payments, go to the section, [Orders](page:orders) [block:api-header] { "title": "Implementing Checkout" } [/block] The payment details entered in the Checkout are securely sent to the application's servers. Checkout securely accepts your customer's payment details and directly passes them to Razorpay's servers. Razorpay returns a token representation of those payment details, which can then be submitted to your server for use. **Integrating Checkout** You can integrate the [Checkout Form](doc:checkout-form) in your website or app For mobile devices, read the section, [Android and iOS SDK](doc:mobile-payments).
{"_id":"54dec8b7c2b4b70d009c3f15","next":{"description":"","pages":[]},"parentDoc":null,"body":"* PHP: [Razorpay PHP API](https://github.com/razorpay/razorpay-php) \n* Ruby: [Razorpay Ruby API](https://github.com/razorpay/razorpay-ruby)\n* Python: [Razorpay Python API](https://github.com/razorpay/razorpay-python)\n* .NET: [Razorpay .NET API](https://github.com/razorpay/razorpay-dot-net)\n* Node.js: [Razorpay Node.js API](https://github.com/razorpay/razorpay-node)\n* Java: [Razorpay Java API](https://github.com/razorpay/razorpay-java)\n\n\nWe have plugins available for multiple carts.\nPlease check out this page to download the relevant one - [https://razorpay.com/integrations/](https://razorpay.com/integrations/)\n\nYou can get in touch with us at [razorpay.com/support](razorpay.com/support) for any integration related queries.","category":"54dec8b7c2b4b70d009c3f10","hidden":false,"title":"Libraries & Integrations","user":"54c83ac1ab706219009e067a","__v":11,"excerpt":"","isReference":false,"order":2,"project":"54c83b5aab706219009e067b","slug":"libraries","sync_unique":"","version":"54dec8b6c2b4b70d009c3f0f","api":{"settings":"","url":"","auth":"required","params":[],"results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"status":400,"language":"json","code":"{}","name":""}]}},"link_url":"","type":"basic","updates":["5c6434eb95c8eb02d44775cb"],"createdAt":"2015-02-13T14:37:10.938Z","githubsync":"","link_external":false,"childrenPages":[]}

Libraries & Integrations


* PHP: [Razorpay PHP API](https://github.com/razorpay/razorpay-php) * Ruby: [Razorpay Ruby API](https://github.com/razorpay/razorpay-ruby) * Python: [Razorpay Python API](https://github.com/razorpay/razorpay-python) * .NET: [Razorpay .NET API](https://github.com/razorpay/razorpay-dot-net) * Node.js: [Razorpay Node.js API](https://github.com/razorpay/razorpay-node) * Java: [Razorpay Java API](https://github.com/razorpay/razorpay-java) We have plugins available for multiple carts. Please check out this page to download the relevant one - [https://razorpay.com/integrations/](https://razorpay.com/integrations/) You can get in touch with us at [razorpay.com/support](razorpay.com/support) for any integration related queries.
* PHP: [Razorpay PHP API](https://github.com/razorpay/razorpay-php) * Ruby: [Razorpay Ruby API](https://github.com/razorpay/razorpay-ruby) * Python: [Razorpay Python API](https://github.com/razorpay/razorpay-python) * .NET: [Razorpay .NET API](https://github.com/razorpay/razorpay-dot-net) * Node.js: [Razorpay Node.js API](https://github.com/razorpay/razorpay-node) * Java: [Razorpay Java API](https://github.com/razorpay/razorpay-java) We have plugins available for multiple carts. Please check out this page to download the relevant one - [https://razorpay.com/integrations/](https://razorpay.com/integrations/) You can get in touch with us at [razorpay.com/support](razorpay.com/support) for any integration related queries.
{"_id":"54dec8b7c2b4b70d009c3f16","__v":2,"category":"54dec8b7c2b4b70d009c3f10","sync_unique":"","type":"basic","version":"54dec8b6c2b4b70d009c3f0f","api":{"params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"url":"","auth":"required"},"createdAt":"2015-02-13T14:40:27.959Z","excerpt":"","isReference":false,"link_external":false,"link_url":"","project":"54c83b5aab706219009e067b","slug":"authentication","user":"54c83ac1ab706219009e067a","body":"All server side requests like capture, refund, getting details of previous payment must be authenticated with basic auth using the `key-id` as username and `key-secret` as password.\n\nSend the requests to https://<key-id>:<key-secret>@api.razorpay.com\n\ne.g. `https://rzp_test_Ad93zqidD9eZwy:69b2e24411e384f91213f22a@api.razorpay.com/v1/payments`\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Your Key-Secret is like your password. Never use it for client side requests and never share it with anyone.\"\n}\n[/block]","githubsync":"","hidden":false,"title":"Authentication","updates":["5a0d2bfedd740f0012180b08"],"order":3,"parentDoc":null,"next":{"pages":[]},"childrenPages":[]}

Authentication


All server side requests like capture, refund, getting details of previous payment must be authenticated with basic auth using the `key-id` as username and `key-secret` as password. Send the requests to https://<key-id>:<key-secret>@api.razorpay.com e.g. `https://rzp_test_Ad93zqidD9eZwy:69b2e24411e384f91213f22a@api.razorpay.com/v1/payments` [block:callout] { "type": "danger", "title": "Your Key-Secret is like your password. Never use it for client side requests and never share it with anyone." } [/block]
All server side requests like capture, refund, getting details of previous payment must be authenticated with basic auth using the `key-id` as username and `key-secret` as password. Send the requests to https://<key-id>:<key-secret>@api.razorpay.com e.g. `https://rzp_test_Ad93zqidD9eZwy:69b2e24411e384f91213f22a@api.razorpay.com/v1/payments` [block:callout] { "type": "danger", "title": "Your Key-Secret is like your password. Never use it for client side requests and never share it with anyone." } [/block]
{"_id":"574a8cd0d9ec5b0e002053a2","api":{"params":[],"url":"","results":{"codes":[{"code":"{}","name":"","status":200,"language":"json"},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required"},"createdAt":"2016-05-29T06:31:44.439Z","slug":"notes","version":"54dec8b6c2b4b70d009c3f0f","parentDoc":null,"project":"54c83b5aab706219009e067b","sync_unique":"","title":"Notes","type":"basic","__v":1,"excerpt":"","githubsync":"","link_url":"","order":4,"updates":["5b6bf39abba1100003ff4ceb"],"user":"54f6ab9009da88170095c103","body":"`notes` is a key-value store present with every Razorpay entity like Payment, Refund, etc.\nYou can use this for storing additional data relating to the entity in structured format. \n\nFor example, for payments, you can store the billing or shipping address.\n`notes` is not used by Razorpay for any operational purpose.\nIt can have a maximum of 15 keys with values up to maximum 256 characters long.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\\"notes\\\": {\\n    \\\"random_key_1\\\": \\\"A random note.\\\",\\n    \\\"random_key_2\\\": \\\"A random note.\\\"\\n  }\",\n      \"language\": \"json\",\n      \"name\": \"notes object\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","category":"54dec8b7c2b4b70d009c3f10","hidden":false,"isReference":false,"link_external":false,"next":{"pages":[],"description":""},"childrenPages":[]}

Notes


`notes` is a key-value store present with every Razorpay entity like Payment, Refund, etc. You can use this for storing additional data relating to the entity in structured format. For example, for payments, you can store the billing or shipping address. `notes` is not used by Razorpay for any operational purpose. It can have a maximum of 15 keys with values up to maximum 256 characters long. [block:code] { "codes": [ { "code": "\"notes\": {\n \"random_key_1\": \"A random note.\",\n \"random_key_2\": \"A random note.\"\n }", "language": "json", "name": "notes object" } ], "sidebar": true } [/block]
`notes` is a key-value store present with every Razorpay entity like Payment, Refund, etc. You can use this for storing additional data relating to the entity in structured format. For example, for payments, you can store the billing or shipping address. `notes` is not used by Razorpay for any operational purpose. It can have a maximum of 15 keys with values up to maximum 256 characters long. [block:code] { "codes": [ { "code": "\"notes\": {\n \"random_key_1\": \"A random note.\",\n \"random_key_2\": \"A random note.\"\n }", "language": "json", "name": "notes object" } ], "sidebar": true } [/block]
{"_id":"54dec8b7c2b4b70d009c3f1f","category":"54dec8b7c2b4b70d009c3f10","githubsync":"","link_external":false,"project":"54c83b5aab706219009e067b","slug":"errors","user":"54c83ac1ab706219009e067a","__v":0,"api":{"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"auth":"required","params":[]},"version":"54dec8b6c2b4b70d009c3f0f","isReference":false,"order":5,"sync_unique":"","updates":[],"hidden":false,"excerpt":"","link_url":"","parentDoc":null,"title":"Errors","type":"basic","body":"The Razorpay API returns json with an error code and description in case of any error during the request as shown. In case the error is in a specific field, it also returns the field name in error object.\n\nAll successful responses are returned with HTTP Status code 200.\n\nIn case you are using the Razorpay SDKs (for e.g. the PHP SDK), it will throw an exception with the error which you need to catch.\n\n**HTTP STATUS CODE REFERENCE** \n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"HTTP Status Code\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"200 OK\",\n    \"0-1\": \"Worked as expected\",\n    \"1-1\": \"Bad request to API. Missing a field or an invalid field.\",\n    \"2-1\": \"Authentication Error. Key-ID or Key-Secret invalid.\",\n    \"3-1\": \"Gateway Error. Internal Razorpay Error\",\n    \"1-0\": \"400 Bad Request\",\n    \"2-0\": \"401 Not Authorized\",\n    \"3-0\": \"500, 502, 504\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"You should check the HTTP Status code of the response for every request to API.\"\n}\n[/block]\n**ERROR CODES** \n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Error Code\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"GATEWAY_ERROR\",\n    \"0-1\": \"Error in Gateway Communication. See description for more details.\",\n    \"1-1\": \"Error in merchant request. Check the description and correct the request accordingly.\",\n    \"2-1\": \"There is some problem with the server\",\n    \"1-0\": \"BAD_REQUEST_ERROR\",\n    \"2-0\": \"SERVER_ERROR\"\n  },\n  \"cols\": 2,\n  \"rows\": 3\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"NORMAL ERROR RESPONSE\\n{\\n   \\\"error\\\": {\\n      \\\"code\\\": \\\"GATEWAY_ERROR\\\",\\n      \\\"description\\\": \\\"The gateway request timed out\\\",\\n      \\\"field\\\": null\\n   }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Normal Error Response\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"ERROR RESPONSE DUE TO FIELD ERROR\\n{\\n   \\\"error\\\": {\\n      \\\"code\\\": \\\"BAD_REQUEST_ERROR\\\",\\n      \\\"description\\\": \\\"The amount is invalid\\\",\\n      \\\"field\\\": \\\"amount\\\"\\n   }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Error Response due to Field Error\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","createdAt":"2015-02-14T02:12:22.402Z","childrenPages":[]}

Errors


The Razorpay API returns json with an error code and description in case of any error during the request as shown. In case the error is in a specific field, it also returns the field name in error object. All successful responses are returned with HTTP Status code 200. In case you are using the Razorpay SDKs (for e.g. the PHP SDK), it will throw an exception with the error which you need to catch. **HTTP STATUS CODE REFERENCE** [block:parameters] { "data": { "h-0": "HTTP Status Code", "h-1": "Description", "0-0": "200 OK", "0-1": "Worked as expected", "1-1": "Bad request to API. Missing a field or an invalid field.", "2-1": "Authentication Error. Key-ID or Key-Secret invalid.", "3-1": "Gateway Error. Internal Razorpay Error", "1-0": "400 Bad Request", "2-0": "401 Not Authorized", "3-0": "500, 502, 504" }, "cols": 2, "rows": 4 } [/block] [block:callout] { "type": "info", "title": "You should check the HTTP Status code of the response for every request to API." } [/block] **ERROR CODES** [block:parameters] { "data": { "h-0": "Error Code", "h-1": "Description", "0-0": "GATEWAY_ERROR", "0-1": "Error in Gateway Communication. See description for more details.", "1-1": "Error in merchant request. Check the description and correct the request accordingly.", "2-1": "There is some problem with the server", "1-0": "BAD_REQUEST_ERROR", "2-0": "SERVER_ERROR" }, "cols": 2, "rows": 3 } [/block] [block:code] { "codes": [ { "code": "NORMAL ERROR RESPONSE\n{\n \"error\": {\n \"code\": \"GATEWAY_ERROR\",\n \"description\": \"The gateway request timed out\",\n \"field\": null\n }\n}", "language": "json", "name": "Normal Error Response" } ], "sidebar": true } [/block] [block:code] { "codes": [ { "code": "ERROR RESPONSE DUE TO FIELD ERROR\n{\n \"error\": {\n \"code\": \"BAD_REQUEST_ERROR\",\n \"description\": \"The amount is invalid\",\n \"field\": \"amount\"\n }\n}", "language": "json", "name": "Error Response due to Field Error" } ], "sidebar": true } [/block]
The Razorpay API returns json with an error code and description in case of any error during the request as shown. In case the error is in a specific field, it also returns the field name in error object. All successful responses are returned with HTTP Status code 200. In case you are using the Razorpay SDKs (for e.g. the PHP SDK), it will throw an exception with the error which you need to catch. **HTTP STATUS CODE REFERENCE** [block:parameters] { "data": { "h-0": "HTTP Status Code", "h-1": "Description", "0-0": "200 OK", "0-1": "Worked as expected", "1-1": "Bad request to API. Missing a field or an invalid field.", "2-1": "Authentication Error. Key-ID or Key-Secret invalid.", "3-1": "Gateway Error. Internal Razorpay Error", "1-0": "400 Bad Request", "2-0": "401 Not Authorized", "3-0": "500, 502, 504" }, "cols": 2, "rows": 4 } [/block] [block:callout] { "type": "info", "title": "You should check the HTTP Status code of the response for every request to API." } [/block] **ERROR CODES** [block:parameters] { "data": { "h-0": "Error Code", "h-1": "Description", "0-0": "GATEWAY_ERROR", "0-1": "Error in Gateway Communication. See description for more details.", "1-1": "Error in merchant request. Check the description and correct the request accordingly.", "2-1": "There is some problem with the server", "1-0": "BAD_REQUEST_ERROR", "2-0": "SERVER_ERROR" }, "cols": 2, "rows": 3 } [/block] [block:code] { "codes": [ { "code": "NORMAL ERROR RESPONSE\n{\n \"error\": {\n \"code\": \"GATEWAY_ERROR\",\n \"description\": \"The gateway request timed out\",\n \"field\": null\n }\n}", "language": "json", "name": "Normal Error Response" } ], "sidebar": true } [/block] [block:code] { "codes": [ { "code": "ERROR RESPONSE DUE TO FIELD ERROR\n{\n \"error\": {\n \"code\": \"BAD_REQUEST_ERROR\",\n \"description\": \"The amount is invalid\",\n \"field\": \"amount\"\n }\n}", "language": "json", "name": "Error Response due to Field Error" } ], "sidebar": true } [/block]
{"_id":"54dec8b7c2b4b70d009c3f18","link_url":"","project":"54c83b5aab706219009e067b","title":"Entities","link_external":false,"excerpt":"","githubsync":"","hidden":false,"sync_unique":"","body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Payment Entity\"\n}\n[/block]\nThe payment entity returned by Razorpay is as shown on the right. It will be returned in JSON form by the API (or in the object form if using language SDKs).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"id\\\": \\\"pay_29QQoUBi66xm2f\\\",\\n  \\\"entity\\\": \\\"payment\\\",\\n  \\\"amount\\\": 5000,\\n  \\\"currency\\\": \\\"INR\\\",\\n  \\\"status\\\": \\\"captured\\\",\\n  \\\"method\\\": \\\"card\\\",\\n  \\\"description\\\": \\\"Payment for adidas shoes\\\",\\n  \\\"amount_refunded\\\": 0,\\n  \\\"refund_status\\\": null,\\n  \\\"email\\\": \\\"test@razorpay.com\\\",\\n  \\\"contact\\\": \\\"9364591752\\\",\\n  \\\"notes\\\": {},\\n  \\\"fee\\\": 1145,\\n  \\\"tax\\\": 145,\\n  \\\"error_code\\\": null,\\n  \\\"error_description\\\": null,\\n  \\\"created_at\\\": 1400826750\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Sample Payment Object\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\nThe various parameters are explained below:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Attribute\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"string\",\n    \"0-2\": \"Unique ID that identifies your payment on the gateway.\",\n    \"1-0\": \"entity\",\n    \"1-1\": \"string\",\n    \"1-2\": \"Indicates type of entity.\",\n    \"2-0\": \"amount\",\n    \"2-1\": \"integer\",\n    \"2-2\": \"The amount of payment in paisa. e.g. If amount = 100, it means Rs 1.\",\n    \"3-0\": \"currency\",\n    \"3-1\": \"string\",\n    \"3-2\": \"The currency of payment, currently only INR is supported.\",\n    \"4-0\": \"status\",\n    \"4-1\": \"string\",\n    \"4-2\": \"The status of payment. It can be `created`, `authorized`, `captured`, `refunded`, `failed`.\",\n    \"9-0\": \"refund_status\",\n    \"9-1\": \"string\",\n    \"9-2\": \"The refund status of payment. Can be `null`, `partial` or `full`.\",\n    \"10-0\": \"amount_refunded\",\n    \"10-1\": \"integer\",\n    \"10-2\": \"The amount refunded in paisa. e.g. If amount = 100, it means Re 1.\",\n    \"7-0\": \"description\",\n    \"7-1\": \"string\",\n    \"7-2\": \"Description, if any as provided.\",\n    \"16-0\": \"error_code\",\n    \"16-1\": \"string\",\n    \"16-2\": \"Error code in case of an error during payment.\",\n    \"17-0\": \"error_description\",\n    \"17-1\": \"string\",\n    \"17-2\": \"Error description of an error during payment.\",\n    \"18-0\": \"notes\",\n    \"18-1\": \"json object\",\n    \"18-2\": \"Contains user defined fields, stored for reference purposes.\",\n    \"19-0\": \"created_at\",\n    \"19-1\": \"timestamp\",\n    \"19-2\": \"Timestamp of payment creation.\",\n    \"12-0\": \"email\",\n    \"12-1\": \"string\",\n    \"12-2\": \"Customer email address used for the payment.\",\n    \"13-0\": \"contact\",\n    \"13-1\": \"string\",\n    \"13-2\": \"Customer contact number for the payment.\",\n    \"14-0\": \"fee\",\n    \"14-1\": \"integer\",\n    \"14-2\": \"Fee charged by us including GST.\",\n    \"15-0\": \"tax\",\n    \"15-1\": \"integer\",\n    \"15-2\": \"GST charged.\",\n    \"5-0\": \"method\",\n    \"5-1\": \"string\",\n    \"5-2\": \"Method used during payment, Can be `card`,`netbanking`, `wallet` or `emi`.\",\n    \"6-0\": \"order_id\",\n    \"6-1\": \"string\",\n    \"6-2\": \"Order ID if provided. Read more - [Orders API](https://docs.razorpay.com/v1/page/orders).\",\n    \"8-0\": \"international\",\n    \"8-1\": \"bool\",\n    \"8-2\": \"Whether the payment is done via an international card.\",\n    \"11-0\": \"captured\",\n    \"11-1\": \"bool\",\n    \"11-2\": \"The payment has been captured or not.\"\n  },\n  \"cols\": 3,\n  \"rows\": 20\n}\n[/block]\nThe payment `status` attribute values are explained below. Please read about Payment Flow before this.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Status\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"created\",\n    \"0-1\": \"The default status of payment when its request is first recieved by Razorpay. No processing has been done at this status\",\n    \"1-1\": \"Set after successful authorization of payment. The money has been deducted from customer account but not yet transferred from his bank.\",\n    \"2-1\": \"Set after successful capture of payment. After this, you will receive the money within T+3 day of the capture.\",\n    \"4-1\": \"Set if the payment failed due to some error. Check the error field for actual cause.\",\n    \"1-0\": \"authorized\",\n    \"2-0\": \"captured\",\n    \"4-0\": \"failed\",\n    \"3-0\": \"refunded\",\n    \"3-1\": \"Set after a captured payment has been fully refunded. It's not set for partially refunded payments.\"\n  },\n  \"cols\": 2,\n  \"rows\": 5\n}\n[/block]\nFollowing are various values of `refund_status` in payment object\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Refund Status\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"null\",\n    \"0-1\": \"Default refund status of payment, when no refund has been initiated on it.\",\n    \"1-1\": \"Set after successfully refunding part of the captured amount. Further refunds can still be issued on the payment.\",\n    \"2-1\": \"Set after succesfully refunding the full captured amount. No more refunds can be issued on the payment after this is set.\",\n    \"1-0\": \"partial\",\n    \"2-0\": \"full\"\n  },\n  \"cols\": 2,\n  \"rows\": 3\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Refund Entity\"\n}\n[/block]\nThe refund entity returned by Razorpay is as shown below. It will be returned in JSON form by the API (or in the object form if using language SDKs).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"id\\\": \\\"rfnd_5UXHCzSiC02RBz\\\",\\n  \\\"entity\\\": \\\"refund\\\",\\n  \\\"amount\\\": 100,\\n  \\\"currency\\\": \\\"INR\\\",\\n  \\\"payment_id\\\": \\\"pay_5UWttxtCjkrldV\\\",\\n  \\\"notes\\\": {},\\n  \\\"created_at\\\": 1462887226\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Sample Refund Object\"\n    }\n  ]\n}\n[/block]\nThe various attributes are explained below:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Attribute\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-2\": \"Unique id that identifies the refund on the Razorpay\",\n    \"1-2\": \"Indicates type of entity\",\n    \"2-2\": \"The amount of refund in paisa. e.g. If amount = 100, it means Re 1. Min amount = 100 (Re 1)\",\n    \"3-2\": \"The currency of refund, Currently only INR is supported\",\n    \"4-2\": \"Payment id to for which this refund has been made.\",\n    \"5-2\": \"Timestamp of refund creation\",\n    \"0-1\": \"string\",\n    \"1-0\": \"entity\",\n    \"1-1\": \"string\",\n    \"2-0\": \"amount\",\n    \"2-1\": \"integer\",\n    \"3-0\": \"currency\",\n    \"3-1\": \"string\",\n    \"4-0\": \"payment_id\",\n    \"4-1\": \"string\",\n    \"5-0\": \"created_at\",\n    \"5-1\": \"timestamp\",\n    \"6-0\": \"notes\",\n    \"6-1\": \"dictionary\",\n    \"6-2\": \"Key-value store for storing your reference data\"\n  },\n  \"cols\": 3,\n  \"rows\": 7\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Order Entity\"\n}\n[/block]\nFull Orders API docs are available here - [https://docs.razorpay.com/v1/page/orders](https://docs.razorpay.com/v1/page/orders) \nThe `order` entity returned by Razorpay is as show below. \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"id\\\": \\\"order_6JUYuvmgCLfgjY\\\",\\n    \\\"entity\\\": \\\"order\\\",\\n    \\\"amount\\\": 50000,\\n    \\\"currency\\\": \\\"INR\\\",\\n    \\\"attempts\\\": 0,\\n    \\\"status\\\": \\\"created\\\",\\n    \\\"receipt\\\": \\\"receipt#42\\\",\\n    \\\"notes\\\": [],\\n    \\\"created_at\\\": 1474013013\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Sample order entity\"\n    }\n  ]\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Attribute\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"string\",\n    \"0-2\": \"Unique id that identifies the order on Razorpay\",\n    \"1-0\": \"entity\",\n    \"1-1\": \"string\",\n    \"1-2\": \"Indicates type of entity\",\n    \"2-0\": \"amount\",\n    \"2-1\": \"integer\",\n    \"2-2\": \"The amount of order in paisa.\",\n    \"3-0\": \"currency\",\n    \"3-1\": \"string\",\n    \"3-2\": \"The currency of order. Currently only INR is supported.\",\n    \"4-0\": \"receipt\",\n    \"4-1\": \"string\",\n    \"4-2\": \"Your system order number\",\n    \"5-0\": \"status\",\n    \"5-1\": \"string\",\n    \"5-2\": \"Status of the order. Can have one of following values `created`, `attempted`, `paid`. Each status explanation is given in a later table.\",\n    \"6-0\": \"attempts\",\n    \"6-1\": \"integer\",\n    \"6-2\": \"Number of attempts made for the order\",\n    \"7-0\": \"notes\",\n    \"7-1\": \"dictionary\",\n    \"7-2\": \"Key-value store for storing your reference data\",\n    \"8-0\": \"created_at\",\n    \"8-1\": \"timestamp\",\n    \"8-2\": \"Timestamp of order creation\"\n  },\n  \"cols\": 3,\n  \"rows\": 9\n}\n[/block]\nThe order `status` attribute values are explained below.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Status\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"created\",\n    \"0-1\": \"The default status of order when it's created\",\n    \"1-0\": \"attempted\",\n    \"1-1\": \"Once payment attempt has been made for the order, the status for the order becomes attempted.\",\n    \"2-0\": \"paid\",\n    \"2-1\": \"Once payment is successful for an order, then the status becomes paid.\"\n  },\n  \"cols\": 2,\n  \"rows\": 3\n}\n[/block]","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"name":"","status":400,"language":"json","code":"{}"}]},"settings":"","url":"","auth":"required","params":[]},"createdAt":"2015-02-14T02:03:37.492Z","isReference":false,"next":{"pages":[],"description":""},"order":7,"parentDoc":null,"__v":27,"updates":["56f7bb29d31f6a0e003223b3","56f8b0c60968110e001f84ec","5a3b951f0ec22a0012d83b72"],"user":"54c83ac1ab706219009e067a","slug":"return-objects","type":"basic","version":"54dec8b6c2b4b70d009c3f0f","category":"54dec8b7c2b4b70d009c3f10","childrenPages":[]}

Entities


[block:api-header] { "type": "basic", "title": "Payment Entity" } [/block] The payment entity returned by Razorpay is as shown on the right. It will be returned in JSON form by the API (or in the object form if using language SDKs). [block:code] { "codes": [ { "code": "{\n \"id\": \"pay_29QQoUBi66xm2f\",\n \"entity\": \"payment\",\n \"amount\": 5000,\n \"currency\": \"INR\",\n \"status\": \"captured\",\n \"method\": \"card\",\n \"description\": \"Payment for adidas shoes\",\n \"amount_refunded\": 0,\n \"refund_status\": null,\n \"email\": \"test@razorpay.com\",\n \"contact\": \"9364591752\",\n \"notes\": {},\n \"fee\": 1145,\n \"tax\": 145,\n \"error_code\": null,\n \"error_description\": null,\n \"created_at\": 1400826750\n}", "language": "json", "name": "Sample Payment Object" } ], "sidebar": true } [/block] The various parameters are explained below: [block:parameters] { "data": { "h-0": "Attribute", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "string", "0-2": "Unique ID that identifies your payment on the gateway.", "1-0": "entity", "1-1": "string", "1-2": "Indicates type of entity.", "2-0": "amount", "2-1": "integer", "2-2": "The amount of payment in paisa. e.g. If amount = 100, it means Rs 1.", "3-0": "currency", "3-1": "string", "3-2": "The currency of payment, currently only INR is supported.", "4-0": "status", "4-1": "string", "4-2": "The status of payment. It can be `created`, `authorized`, `captured`, `refunded`, `failed`.", "9-0": "refund_status", "9-1": "string", "9-2": "The refund status of payment. Can be `null`, `partial` or `full`.", "10-0": "amount_refunded", "10-1": "integer", "10-2": "The amount refunded in paisa. e.g. If amount = 100, it means Re 1.", "7-0": "description", "7-1": "string", "7-2": "Description, if any as provided.", "16-0": "error_code", "16-1": "string", "16-2": "Error code in case of an error during payment.", "17-0": "error_description", "17-1": "string", "17-2": "Error description of an error during payment.", "18-0": "notes", "18-1": "json object", "18-2": "Contains user defined fields, stored for reference purposes.", "19-0": "created_at", "19-1": "timestamp", "19-2": "Timestamp of payment creation.", "12-0": "email", "12-1": "string", "12-2": "Customer email address used for the payment.", "13-0": "contact", "13-1": "string", "13-2": "Customer contact number for the payment.", "14-0": "fee", "14-1": "integer", "14-2": "Fee charged by us including GST.", "15-0": "tax", "15-1": "integer", "15-2": "GST charged.", "5-0": "method", "5-1": "string", "5-2": "Method used during payment, Can be `card`,`netbanking`, `wallet` or `emi`.", "6-0": "order_id", "6-1": "string", "6-2": "Order ID if provided. Read more - [Orders API](https://docs.razorpay.com/v1/page/orders).", "8-0": "international", "8-1": "bool", "8-2": "Whether the payment is done via an international card.", "11-0": "captured", "11-1": "bool", "11-2": "The payment has been captured or not." }, "cols": 3, "rows": 20 } [/block] The payment `status` attribute values are explained below. Please read about Payment Flow before this. [block:parameters] { "data": { "h-0": "Status", "h-1": "Description", "0-0": "created", "0-1": "The default status of payment when its request is first recieved by Razorpay. No processing has been done at this status", "1-1": "Set after successful authorization of payment. The money has been deducted from customer account but not yet transferred from his bank.", "2-1": "Set after successful capture of payment. After this, you will receive the money within T+3 day of the capture.", "4-1": "Set if the payment failed due to some error. Check the error field for actual cause.", "1-0": "authorized", "2-0": "captured", "4-0": "failed", "3-0": "refunded", "3-1": "Set after a captured payment has been fully refunded. It's not set for partially refunded payments." }, "cols": 2, "rows": 5 } [/block] Following are various values of `refund_status` in payment object [block:parameters] { "data": { "h-0": "Refund Status", "h-1": "Description", "0-0": "null", "0-1": "Default refund status of payment, when no refund has been initiated on it.", "1-1": "Set after successfully refunding part of the captured amount. Further refunds can still be issued on the payment.", "2-1": "Set after succesfully refunding the full captured amount. No more refunds can be issued on the payment after this is set.", "1-0": "partial", "2-0": "full" }, "cols": 2, "rows": 3 } [/block] [block:api-header] { "type": "basic", "title": "Refund Entity" } [/block] The refund entity returned by Razorpay is as shown below. It will be returned in JSON form by the API (or in the object form if using language SDKs). [block:code] { "codes": [ { "code": "{\n \"id\": \"rfnd_5UXHCzSiC02RBz\",\n \"entity\": \"refund\",\n \"amount\": 100,\n \"currency\": \"INR\",\n \"payment_id\": \"pay_5UWttxtCjkrldV\",\n \"notes\": {},\n \"created_at\": 1462887226\n}", "language": "json", "name": "Sample Refund Object" } ] } [/block] The various attributes are explained below: [block:parameters] { "data": { "h-0": "Attribute", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-2": "Unique id that identifies the refund on the Razorpay", "1-2": "Indicates type of entity", "2-2": "The amount of refund in paisa. e.g. If amount = 100, it means Re 1. Min amount = 100 (Re 1)", "3-2": "The currency of refund, Currently only INR is supported", "4-2": "Payment id to for which this refund has been made.", "5-2": "Timestamp of refund creation", "0-1": "string", "1-0": "entity", "1-1": "string", "2-0": "amount", "2-1": "integer", "3-0": "currency", "3-1": "string", "4-0": "payment_id", "4-1": "string", "5-0": "created_at", "5-1": "timestamp", "6-0": "notes", "6-1": "dictionary", "6-2": "Key-value store for storing your reference data" }, "cols": 3, "rows": 7 } [/block] [block:api-header] { "type": "basic", "title": "Order Entity" } [/block] Full Orders API docs are available here - [https://docs.razorpay.com/v1/page/orders](https://docs.razorpay.com/v1/page/orders) The `order` entity returned by Razorpay is as show below. [block:code] { "codes": [ { "code": "{\n \"id\": \"order_6JUYuvmgCLfgjY\",\n \"entity\": \"order\",\n \"amount\": 50000,\n \"currency\": \"INR\",\n \"attempts\": 0,\n \"status\": \"created\",\n \"receipt\": \"receipt#42\",\n \"notes\": [],\n \"created_at\": 1474013013\n}", "language": "json", "name": "Sample order entity" } ] } [/block] [block:parameters] { "data": { "h-0": "Attribute", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "string", "0-2": "Unique id that identifies the order on Razorpay", "1-0": "entity", "1-1": "string", "1-2": "Indicates type of entity", "2-0": "amount", "2-1": "integer", "2-2": "The amount of order in paisa.", "3-0": "currency", "3-1": "string", "3-2": "The currency of order. Currently only INR is supported.", "4-0": "receipt", "4-1": "string", "4-2": "Your system order number", "5-0": "status", "5-1": "string", "5-2": "Status of the order. Can have one of following values `created`, `attempted`, `paid`. Each status explanation is given in a later table.", "6-0": "attempts", "6-1": "integer", "6-2": "Number of attempts made for the order", "7-0": "notes", "7-1": "dictionary", "7-2": "Key-value store for storing your reference data", "8-0": "created_at", "8-1": "timestamp", "8-2": "Timestamp of order creation" }, "cols": 3, "rows": 9 } [/block] The order `status` attribute values are explained below. [block:parameters] { "data": { "h-0": "Status", "h-1": "Description", "0-0": "created", "0-1": "The default status of order when it's created", "1-0": "attempted", "1-1": "Once payment attempt has been made for the order, the status for the order becomes attempted.", "2-0": "paid", "2-1": "Once payment is successful for an order, then the status becomes paid." }, "cols": 2, "rows": 3 } [/block]
[block:api-header] { "type": "basic", "title": "Payment Entity" } [/block] The payment entity returned by Razorpay is as shown on the right. It will be returned in JSON form by the API (or in the object form if using language SDKs). [block:code] { "codes": [ { "code": "{\n \"id\": \"pay_29QQoUBi66xm2f\",\n \"entity\": \"payment\",\n \"amount\": 5000,\n \"currency\": \"INR\",\n \"status\": \"captured\",\n \"method\": \"card\",\n \"description\": \"Payment for adidas shoes\",\n \"amount_refunded\": 0,\n \"refund_status\": null,\n \"email\": \"test@razorpay.com\",\n \"contact\": \"9364591752\",\n \"notes\": {},\n \"fee\": 1145,\n \"tax\": 145,\n \"error_code\": null,\n \"error_description\": null,\n \"created_at\": 1400826750\n}", "language": "json", "name": "Sample Payment Object" } ], "sidebar": true } [/block] The various parameters are explained below: [block:parameters] { "data": { "h-0": "Attribute", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "string", "0-2": "Unique ID that identifies your payment on the gateway.", "1-0": "entity", "1-1": "string", "1-2": "Indicates type of entity.", "2-0": "amount", "2-1": "integer", "2-2": "The amount of payment in paisa. e.g. If amount = 100, it means Rs 1.", "3-0": "currency", "3-1": "string", "3-2": "The currency of payment, currently only INR is supported.", "4-0": "status", "4-1": "string", "4-2": "The status of payment. It can be `created`, `authorized`, `captured`, `refunded`, `failed`.", "9-0": "refund_status", "9-1": "string", "9-2": "The refund status of payment. Can be `null`, `partial` or `full`.", "10-0": "amount_refunded", "10-1": "integer", "10-2": "The amount refunded in paisa. e.g. If amount = 100, it means Re 1.", "7-0": "description", "7-1": "string", "7-2": "Description, if any as provided.", "16-0": "error_code", "16-1": "string", "16-2": "Error code in case of an error during payment.", "17-0": "error_description", "17-1": "string", "17-2": "Error description of an error during payment.", "18-0": "notes", "18-1": "json object", "18-2": "Contains user defined fields, stored for reference purposes.", "19-0": "created_at", "19-1": "timestamp", "19-2": "Timestamp of payment creation.", "12-0": "email", "12-1": "string", "12-2": "Customer email address used for the payment.", "13-0": "contact", "13-1": "string", "13-2": "Customer contact number for the payment.", "14-0": "fee", "14-1": "integer", "14-2": "Fee charged by us including GST.", "15-0": "tax", "15-1": "integer", "15-2": "GST charged.", "5-0": "method", "5-1": "string", "5-2": "Method used during payment, Can be `card`,`netbanking`, `wallet` or `emi`.", "6-0": "order_id", "6-1": "string", "6-2": "Order ID if provided. Read more - [Orders API](https://docs.razorpay.com/v1/page/orders).", "8-0": "international", "8-1": "bool", "8-2": "Whether the payment is done via an international card.", "11-0": "captured", "11-1": "bool", "11-2": "The payment has been captured or not." }, "cols": 3, "rows": 20 } [/block] The payment `status` attribute values are explained below. Please read about Payment Flow before this. [block:parameters] { "data": { "h-0": "Status", "h-1": "Description", "0-0": "created", "0-1": "The default status of payment when its request is first recieved by Razorpay. No processing has been done at this status", "1-1": "Set after successful authorization of payment. The money has been deducted from customer account but not yet transferred from his bank.", "2-1": "Set after successful capture of payment. After this, you will receive the money within T+3 day of the capture.", "4-1": "Set if the payment failed due to some error. Check the error field for actual cause.", "1-0": "authorized", "2-0": "captured", "4-0": "failed", "3-0": "refunded", "3-1": "Set after a captured payment has been fully refunded. It's not set for partially refunded payments." }, "cols": 2, "rows": 5 } [/block] Following are various values of `refund_status` in payment object [block:parameters] { "data": { "h-0": "Refund Status", "h-1": "Description", "0-0": "null", "0-1": "Default refund status of payment, when no refund has been initiated on it.", "1-1": "Set after successfully refunding part of the captured amount. Further refunds can still be issued on the payment.", "2-1": "Set after succesfully refunding the full captured amount. No more refunds can be issued on the payment after this is set.", "1-0": "partial", "2-0": "full" }, "cols": 2, "rows": 3 } [/block] [block:api-header] { "type": "basic", "title": "Refund Entity" } [/block] The refund entity returned by Razorpay is as shown below. It will be returned in JSON form by the API (or in the object form if using language SDKs). [block:code] { "codes": [ { "code": "{\n \"id\": \"rfnd_5UXHCzSiC02RBz\",\n \"entity\": \"refund\",\n \"amount\": 100,\n \"currency\": \"INR\",\n \"payment_id\": \"pay_5UWttxtCjkrldV\",\n \"notes\": {},\n \"created_at\": 1462887226\n}", "language": "json", "name": "Sample Refund Object" } ] } [/block] The various attributes are explained below: [block:parameters] { "data": { "h-0": "Attribute", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-2": "Unique id that identifies the refund on the Razorpay", "1-2": "Indicates type of entity", "2-2": "The amount of refund in paisa. e.g. If amount = 100, it means Re 1. Min amount = 100 (Re 1)", "3-2": "The currency of refund, Currently only INR is supported", "4-2": "Payment id to for which this refund has been made.", "5-2": "Timestamp of refund creation", "0-1": "string", "1-0": "entity", "1-1": "string", "2-0": "amount", "2-1": "integer", "3-0": "currency", "3-1": "string", "4-0": "payment_id", "4-1": "string", "5-0": "created_at", "5-1": "timestamp", "6-0": "notes", "6-1": "dictionary", "6-2": "Key-value store for storing your reference data" }, "cols": 3, "rows": 7 } [/block] [block:api-header] { "type": "basic", "title": "Order Entity" } [/block] Full Orders API docs are available here - [https://docs.razorpay.com/v1/page/orders](https://docs.razorpay.com/v1/page/orders) The `order` entity returned by Razorpay is as show below. [block:code] { "codes": [ { "code": "{\n \"id\": \"order_6JUYuvmgCLfgjY\",\n \"entity\": \"order\",\n \"amount\": 50000,\n \"currency\": \"INR\",\n \"attempts\": 0,\n \"status\": \"created\",\n \"receipt\": \"receipt#42\",\n \"notes\": [],\n \"created_at\": 1474013013\n}", "language": "json", "name": "Sample order entity" } ] } [/block] [block:parameters] { "data": { "h-0": "Attribute", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "string", "0-2": "Unique id that identifies the order on Razorpay", "1-0": "entity", "1-1": "string", "1-2": "Indicates type of entity", "2-0": "amount", "2-1": "integer", "2-2": "The amount of order in paisa.", "3-0": "currency", "3-1": "string", "3-2": "The currency of order. Currently only INR is supported.", "4-0": "receipt", "4-1": "string", "4-2": "Your system order number", "5-0": "status", "5-1": "string", "5-2": "Status of the order. Can have one of following values `created`, `attempted`, `paid`. Each status explanation is given in a later table.", "6-0": "attempts", "6-1": "integer", "6-2": "Number of attempts made for the order", "7-0": "notes", "7-1": "dictionary", "7-2": "Key-value store for storing your reference data", "8-0": "created_at", "8-1": "timestamp", "8-2": "Timestamp of order creation" }, "cols": 3, "rows": 9 } [/block] The order `status` attribute values are explained below. [block:parameters] { "data": { "h-0": "Status", "h-1": "Description", "0-0": "created", "0-1": "The default status of order when it's created", "1-0": "attempted", "1-1": "Once payment attempt has been made for the order, the status for the order becomes attempted.", "2-0": "paid", "2-1": "Once payment is successful for an order, then the status becomes paid." }, "cols": 2, "rows": 3 } [/block]
{"_id":"574aeb342c552f0e00c6a279","api":{"auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"name":"","status":400,"language":"json","code":"{}"}]},"settings":"","url":""},"parentDoc":null,"title":"Collection","type":"basic","updates":[],"category":"54dec8b7c2b4b70d009c3f10","createdAt":"2016-05-29T13:14:28.163Z","githubsync":"","link_external":false,"link_url":"","project":"54c83b5aab706219009e067b","slug":"collection","user":"54f6ab9009da88170095c103","__v":2,"body":"Razorpay API supports returning multiple entities like payments, refunds in a single request like [fetching payments](https://docs.razorpay.com/docs/payments), [fetching refunds](https://docs.razorpay.com/docs/refunds), etc. These API calls have a similar structure as described below:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Attribute\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"entity\",\n    \"0-1\": \"string\",\n    \"0-2\": \"Indicates type of entity, in this case, the value is `collection`\",\n    \"1-0\": \"count\",\n    \"1-1\": \"numeric\",\n    \"1-2\": \"Number of entities in the collection\",\n    \"2-0\": \"items\",\n    \"2-1\": \"Array\",\n    \"2-2\": \"Collection of `entities`.\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\nSample collection response:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"count\\\": 2,\\n  \\\"entity\\\": \\\"collection\\\",\\n  \\\"items\\\": [\\n    {\\n      \\\"id\\\": \\\"pay_29QQoUBi66xm2f\\\",\\n      \\\"entity\\\": \\\"payment\\\",\\n      \\\"amount\\\": 500,\\n      \\\"currency\\\": \\\"INR\\\",\\n      \\\"status\\\": \\\"created\\\",\\n      \\\"amount_refunded\\\": 0,\\n      \\\"refund_status\\\": null,\\n      \\\"email\\\": \\\"test@razorpay.com\\\",\\n      \\\"contact\\\": \\\"9364591752\\\",\\n      \\\"error_code\\\": null,\\n      \\\"error_description\\\": null,\\n      \\\"notes\\\": {},\\n      \\\"created_at\\\": 1400826750\\n    },\\n    {\\n      \\\"id\\\": \\\"pay_19btGlBig6xZ2f\\\",\\n      \\\"entity\\\": \\\"payment\\\",\\n      \\\"amount\\\": 500,\\n      \\\"currency\\\": \\\"INR\\\",\\n      \\\"status\\\": \\\"created\\\",\\n      \\\"amount_refunded\\\": 0,\\n      \\\"refund_status\\\": null,\\n      \\\"email\\\": \\\"test@razorpay.com\\\",\\n      \\\"contact\\\": \\\"9364591752\\\",\\n      \\\"error_code\\\": null,\\n      \\\"error_description\\\": null,\\n      \\\"notes\\\": {},\\n      \\\"created_at\\\": 1400826750\\n    }\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","isReference":false,"order":8,"version":"54dec8b6c2b4b70d009c3f0f","excerpt":"","hidden":false,"sync_unique":"","childrenPages":[]}

Collection


Razorpay API supports returning multiple entities like payments, refunds in a single request like [fetching payments](https://docs.razorpay.com/docs/payments), [fetching refunds](https://docs.razorpay.com/docs/refunds), etc. These API calls have a similar structure as described below: [block:parameters] { "data": { "h-0": "Attribute", "h-1": "Type", "h-2": "Description", "0-0": "entity", "0-1": "string", "0-2": "Indicates type of entity, in this case, the value is `collection`", "1-0": "count", "1-1": "numeric", "1-2": "Number of entities in the collection", "2-0": "items", "2-1": "Array", "2-2": "Collection of `entities`." }, "cols": 3, "rows": 3 } [/block] Sample collection response: [block:code] { "codes": [ { "code": "{\n \"count\": 2,\n \"entity\": \"collection\",\n \"items\": [\n {\n \"id\": \"pay_29QQoUBi66xm2f\",\n \"entity\": \"payment\",\n \"amount\": 500,\n \"currency\": \"INR\",\n \"status\": \"created\",\n \"amount_refunded\": 0,\n \"refund_status\": null,\n \"email\": \"test@razorpay.com\",\n \"contact\": \"9364591752\",\n \"error_code\": null,\n \"error_description\": null,\n \"notes\": {},\n \"created_at\": 1400826750\n },\n {\n \"id\": \"pay_19btGlBig6xZ2f\",\n \"entity\": \"payment\",\n \"amount\": 500,\n \"currency\": \"INR\",\n \"status\": \"created\",\n \"amount_refunded\": 0,\n \"refund_status\": null,\n \"email\": \"test@razorpay.com\",\n \"contact\": \"9364591752\",\n \"error_code\": null,\n \"error_description\": null,\n \"notes\": {},\n \"created_at\": 1400826750\n }\n ]\n}", "language": "json" } ] } [/block]
Razorpay API supports returning multiple entities like payments, refunds in a single request like [fetching payments](https://docs.razorpay.com/docs/payments), [fetching refunds](https://docs.razorpay.com/docs/refunds), etc. These API calls have a similar structure as described below: [block:parameters] { "data": { "h-0": "Attribute", "h-1": "Type", "h-2": "Description", "0-0": "entity", "0-1": "string", "0-2": "Indicates type of entity, in this case, the value is `collection`", "1-0": "count", "1-1": "numeric", "1-2": "Number of entities in the collection", "2-0": "items", "2-1": "Array", "2-2": "Collection of `entities`." }, "cols": 3, "rows": 3 } [/block] Sample collection response: [block:code] { "codes": [ { "code": "{\n \"count\": 2,\n \"entity\": \"collection\",\n \"items\": [\n {\n \"id\": \"pay_29QQoUBi66xm2f\",\n \"entity\": \"payment\",\n \"amount\": 500,\n \"currency\": \"INR\",\n \"status\": \"created\",\n \"amount_refunded\": 0,\n \"refund_status\": null,\n \"email\": \"test@razorpay.com\",\n \"contact\": \"9364591752\",\n \"error_code\": null,\n \"error_description\": null,\n \"notes\": {},\n \"created_at\": 1400826750\n },\n {\n \"id\": \"pay_19btGlBig6xZ2f\",\n \"entity\": \"payment\",\n \"amount\": 500,\n \"currency\": \"INR\",\n \"status\": \"created\",\n \"amount_refunded\": 0,\n \"refund_status\": null,\n \"email\": \"test@razorpay.com\",\n \"contact\": \"9364591752\",\n \"error_code\": null,\n \"error_description\": null,\n \"notes\": {},\n \"created_at\": 1400826750\n }\n ]\n}", "language": "json" } ] } [/block]
{"_id":"5832d31d0752650f00eb5380","excerpt":"","link_url":"","__v":1,"category":"54dec8b7c2b4b70d009c3f10","createdAt":"2016-11-21T10:57:33.250Z","sync_unique":"","updates":["5c2cc26be1d25f0063e3b84a"],"hidden":false,"isReference":false,"link_external":false,"next":{"pages":[],"description":""},"order":10,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"body":"Webhooks allow you to build or set up integrations which subscribe to certain events on Razorpay api. When one of those events is triggered, we'll send a HTTP POST payload in JSON to the webhook's configured URL. You can read more about webhooks [here.](https://razorpay.com/docs/webhooks/)","githubsync":"","parentDoc":null,"type":"basic","title":"Webhooks","user":"54f6ab9009da88170095c103","version":"54dec8b6c2b4b70d009c3f0f","project":"54c83b5aab706219009e067b","slug":"webhooks-1","childrenPages":[]}

Webhooks


Webhooks allow you to build or set up integrations which subscribe to certain events on Razorpay api. When one of those events is triggered, we'll send a HTTP POST payload in JSON to the webhook's configured URL. You can read more about webhooks [here.](https://razorpay.com/docs/webhooks/)
Webhooks allow you to build or set up integrations which subscribe to certain events on Razorpay api. When one of those events is triggered, we'll send a HTTP POST payload in JSON to the webhook's configured URL. You can read more about webhooks [here.](https://razorpay.com/docs/webhooks/)
{"_id":"54dec8b7c2b4b70d009c3f17","body":"Checkout Form is the primary way to integrate Razorpay with your front end and accept payments online. It provides you with a well designed and tested checkout form for your end customers. This form handles all types of payment methods - cards, netbanking, or wallets.\n\nCheckout integration takes care of only the Authorization step in the payment process flow.\n\nBy default, the standard checkout form is displayed in your customer's browser. However, you can customize to suit your needs.\n[block:api-header]\n{\n  \"title\": \"Prerequisites\"\n}\n[/block]\nBefore integrating the checkout form, add the following line to your `<head>` tag, if not already there:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<meta name=\\\"viewport\\\" content=\\\"width=device-width\\\">\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Standard Vs Custom Checkout\"\n}\n[/block]\nStandard checkout is usually very easy to integrate into your own product. However, when you have multiple products, or a complex way to pre-calculate amount for a payment (in javascript), you can switch to the manual checkout method for greater control.\n\nTo decide which method the script must follow, it checks for an attribute called `data-key` on the `<script>` tag invocation. If found, the script goes into automatic mode, and will create a button alongside the script tag, and attach its onclick event handler to the `.open` method of the Razorpay object it internally creates.\n[block:api-header]\n{\n  \"title\": \"Standard Checkout\"\n}\n[/block]\nFor standard checkout, you pass the options to `checkout.js` via data attributes in the script tag. The script tag is enclosed within a form tag. Once the payment has been `authorized`, the form is auto-submitted to the URL set in `action` by you in the form tag.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<form action=\\\"/purchase\\\" method=\\\"POST\\\">\\n<!-- Note that the amount is in paise = 50 INR -->\\n<script\\n    src=\\\"https://checkout.razorpay.com/v1/checkout.js\\\"\\n    data-key=\\\"<YOUR_KEY_ID>\\\"\\n    data-amount=\\\"5000\\\"\\n    data-buttontext=\\\"Pay with Razorpay\\\"\\n    data-name=\\\"Merchant Name\\\"\\n    data-description=\\\"Purchase Description\\\"\\n    data-image=\\\"https://your-awesome-site.com/your_logo.jpg\\\"\\n    data-prefill.name=\\\"Gaurav Kumar\\\"\\n    data-prefill.email=\\\"test@test.com\\\"\\n    data-theme.color=\\\"#F37254\\\"\\n></script>\\n<input type=\\\"hidden\\\" value=\\\"Hidden Element\\\" name=\\\"hidden\\\">\\n</form>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\nWhen the checkout process is completed, the browser will add an additional field (name=id) to the form that contains the script tag. This form is then automatically submitted.\n\nThe `razorpay_payment_id` is also submitted along with the form to the action url. You can add any additional hidden(or visible) fields you need to that form as well, as seen here, which will be submitted along as well.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Note\",\n  \"body\": \"In addition to the `razorpay_payment_id`, an additional parameter, `razorpay_order_id` is also submitted to the checkout form. This is applicable only when you have integrated with our Orders API. Refer [Orders API] documentation (https://docs.razorpay.com/v2/page/orders)\"\n}\n[/block]\nPlease note that only successful authorizations are auto-submitted. Failed payments are shown the checkout form again with the option to retry the payment.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Custom Checkout\"\n}\n[/block]\nInstead of a form being auto-submitted, the checkout javascript hands over the payment details to a javascript handler function (written by you). You can then use the payment id, send it to your back-end and verify the payment as you wish.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"Please note that checkout.js is meant to be used for normal web based integration. For Cordova/Phonegap/Ionic, have a look at our [Cordova SDK](https://github.com/razorpay/razorpay-cordova)\"\n}\n[/block]\n**HANDLER FUNCTION**\nIn the case of manual checkout, the handler function specified will be called automatically at the end of the checkout process with an object consisting of `razorpay_payment_id`. It must then pass along this `razorpay_payment_id` (to capture) to your back-end in some way (using AJAX, for example).\n\nPlease note that you only need to handle successful authorizations. Failed payments are shown the checkout form again with the option to retry the payment.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<button id=\\\"rzp-button1\\\">Pay</button>\\n<script src=\\\"https://checkout.razorpay.com/v1/checkout.js\\\"></script>\\n<script>\\nvar options = {\\n    \\\"key\\\": \\\"YOUR_KEY_ID\\\",\\n    \\\"amount\\\": \\\"2000\\\", // 2000 paise = INR 20\\n    \\\"name\\\": \\\"Merchant Name\\\",\\n    \\\"description\\\": \\\"Purchase Description\\\",\\n    \\\"image\\\": \\\"/your_logo.png\\\",\\n    \\\"handler\\\": function (response){\\n        alert(response.razorpay_payment_id);\\n    },\\n    \\\"prefill\\\": {\\n        \\\"name\\\": \\\"Gaurav Kumar\\\",\\n        \\\"email\\\": \\\"test@test.com\\\"\\n    },\\n    \\\"notes\\\": {\\n        \\\"address\\\": \\\"Hello World\\\"\\n    },\\n    \\\"theme\\\": {\\n        \\\"color\\\": \\\"#F37254\\\"\\n    }\\n};\\nvar rzp1 = new Razorpay(options);\\n\\ndocument.getElementById('rzp-button1').onclick = function(e){\\n    rzp1.open();\\n    e.preventDefault();\\n}\\n</script>\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nTo integrate manual checkout:\n\n1. Modify the attributes to suit your needs, [use this table](doc:checkout-form#checkout-fields) as reference. Modify the handler function to handle the response object.\n2. After the payment is done on checkout form, the handler function will receive a payment object with `razorpay_payment_id` attribute. This means the payment is `authorized` and you can capture it now.\n[block:callout]\n{\n  \"type\": \"success\",\n  \"body\": \"You can capture the payment immediately after authorization. To enable the auto capture feature in your payments, read [Orders API](https://docs.razorpay.com/v1/page/orders)\"\n}\n[/block]\n3. Send the `razorpay_payment_id` to your server sided handler url with any other attributes as you may need to [capture the transaction server-sided.](doc:v1paymentsidcapture) \n4. If the capture response has no `error_code` set, that means the payment is successful. Check the amount and status attributes of the payment entity returned to validate. You may now process the order on your end.\n[block:api-header]\n{\n  \"type\": \"link\",\n  \"title\": \"Checkout Fields\"\n}\n[/block]\nThe following fields are allowed to be passed to the Razorpay function. Field name is used for manual checkout and Attribute names for automatic checkout. Dotted attributes are to be passed as an object in case of manual checkout.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field Name (Manual Checkout)\",\n    \"h-1\": \"Attribute Name (Automatic Checkout)\",\n    \"h-2\": \"Required?\",\n    \"h-3\": \"Description\",\n    \"0-0\": \"key\",\n    \"0-1\": \"data-key\",\n    \"0-2\": \"Yes\",\n    \"0-3\": \"Merchant Key-Id\",\n    \"1-3\": \"Payment amount in paisa (INR). e.g. If amount = 100, it means Re 1.\",\n    \"1-0\": \"amount\",\n    \"1-1\": \"data-amount\",\n    \"1-2\": \"Yes\",\n    \"2-0\": \"name\",\n    \"2-3\": \"Merchant Name to be shown in Checkout Form\",\n    \"2-2\": \"Yes\",\n    \"2-1\": \"data-name\",\n    \"3-0\": \"description\",\n    \"3-3\": \"Description of the item being purchased. Shown in the checkout form. Must start with an alphanumeric character.\",\n    \"3-2\": \"No\",\n    \"3-1\": \"data-description\",\n    \"4-0\": \"image\",\n    \"4-1\": \"data-image\",\n    \"4-2\": \"No\",\n    \"4-3\": \"Link to an image (usually merchant logo) shown in the checkout form. Can also be a base64 string, if loading image from network is not desirable.\",\n    \"5-0\": \"prefill.name\",\n    \"5-1\": \"data-prefill.name\",\n    \"5-2\": \"No\",\n    \"5-3\": \"Cardholder name to be prefilled while displaying the checkout form\",\n    \"6-0\": \"prefill.email\",\n    \"6-1\": \"data-prefill.email\",\n    \"6-2\": \"No\",\n    \"6-3\": \"Customer’s email to be prefilled on the checkout form\",\n    \"7-0\": \"prefill.contact\",\n    \"7-1\": \"data-prefill.contact\",\n    \"7-2\": \"No\",\n    \"7-3\": \"Customer’s phone number to be prefilled on the checkout form\",\n    \"9-3\": \"Any additional fields you want to associate with the payment. Usually includes things like shipping address. Upto 15 notes fields may be specified in this way.\",\n    \"9-0\": \"notes.fieldname\",\n    \"9-1\": \"data-notes.fieldname\",\n    \"9-2\": \"No\",\n    \"10-0\": \"handler\",\n    \"10-1\": \"N/A\",\n    \"10-2\": \"Yes (Manual)\\n\\nNo (Automatic)\",\n    \"10-3\": \"Handler function for manual checkout\",\n    \"11-0\": \"theme.color\",\n    \"11-1\": \"data-theme.color\",\n    \"11-2\": \"No\",\n    \"11-3\": \"Brand color to alter the appearance of checkout form.\",\n    \"12-0\": \"modal.backdropclose\",\n    \"12-1\": \"data-modal.backdropclose\",\n    \"12-2\": \"No\",\n    \"12-3\": \"Boolean indicating whether clicking translucent blank space outside checkout form should close the form. (default: **false**)\",\n    \"14-0\": \"modal.ondismiss\",\n    \"14-1\": \"N/A\",\n    \"14-2\": \"No\",\n    \"14-3\": \"Callback function invoked when form is closed without payment being completed.\",\n    \"15-0\": \"order_id\",\n    \"15-1\": \"data-order_id\",\n    \"15-2\": \"No\",\n    \"15-3\": \"Order ID generated via [Orders API](https://docs.razorpay.com/v1/page/orders)\",\n    \"8-0\": \"prefill.method\",\n    \"8-1\": \"data-prefill.method\",\n    \"8-2\": \"No\",\n    \"8-3\": \"Pre-select the payment method for the customer. Can be {card|netbanking|wallet|emi|upi}. However, it'll only work if phone and email are also prefilled.\",\n    \"13-0\": \"modal.escape\",\n    \"13-1\": \"data-modal.escape\",\n    \"13-2\": \"No\",\n    \"13-3\": \"Boolean indicating whether pressing escape key should close the checkout form. (default: **true**)\",\n    \"16-0\": \"invoice_id\",\n    \"16-1\": \"data-invoice_id\",\n    \"16-2\": \"No\",\n    \"16-3\": \"Invoice ID generated via Payment link/Invoices API\"\n  },\n  \"cols\": 4,\n  \"rows\": 17\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"\"\n}\n[/block]\n\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Checkout Modal Lifecycle\"\n}\n[/block]\nIn case you want to track the lifecycle of the checkout modal, in `options` you can pass a `modal` object with `ondismiss: function(){}`. \n\n`ondismiss` is called when the modal is closed by the user.\n\nTo track the end of the payment, you can use the `handler` function which gets called on successful transaction.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var options = {\\n    \\\"key\\\": \\\"YOUR_KEY_ID\\\",\\n    \\\"amount\\\": \\\"2000\\\",\\n    \\\"name\\\": \\\"Merchant Name\\\",\\n    \\\"description\\\": \\\"Purchase Description\\\",\\n    \\\"image\\\": \\\"/your_logo.png\\\",\\n    \\\"handler\\\": function (response){\\n        alert(response.razorpay_payment_id);\\n    },\\n    \\\"modal\\\": {\\n        \\\"ondismiss\\\": function(){}\\n    }\\n};\\nvar rzp1 = new Razorpay(options);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"EMI Utilities\"\n}\n[/block]\n## Fetching EMI Plans\nTo retrieve EMI plans, you can use the event `ready`, as shown below:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var razorpay = new Razorpay(...); // as before\\n\\nrazorpay.once('ready', function() {\\n  // razorpay.methods.emi_plans has list of EMI-supported banks, and respective interest rates\\n  console.log(razorpay.methods.emi_plans);\\n\\n  // razorpay.methods.netbanking contains list of all banks and bank-codes\\n  console.log(razorpay.methods.netbanking);\\n})\",\n      \"language\": \"javascript\",\n      \"name\": null\n    }\n  ]\n}\n[/block]\nEMI plans are sent in the following form:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"HDFC\\\": {\\n    \\\"min_amount\\\": 300000,\\n    \\\"plans\\\": {\\n      \\\"3\\\": 12,\\n      \\\"6\\\": 12,\\n      \\\"9\\\": 13,\\n      \\\"12\\\": 13,\\n      \\\"18\\\": 15,\\n      \\\"24\\\": 15\\n    }\\n  },\\n  \\\"AMEX\\\": {\\n    \\\"min_amount\\\": 500000,\\n    \\\"plans\\\": {\\n      \\\"3\\\": 15,\\n      \\\"6\\\": 15,\\n      \\\"9\\\": 15,\\n      \\\"12\\\": 15\\n    }\\n  }\\n  // etc.. \\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nIn the above given example, the parameter `min_amount` corresponds to minimum Paise below which EMI is not applicable and the parameter `plans` contain a mapping of plan duration in months against the yearly interest rate in percentage.\n\n## Calculating EMI\nYou can utilize the function `Razorpay.emi.calculator` to calculate installment amounts, as shown below:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"Razorpay.emi.calculator(principle_amount, duration_in_month, annual_interest_rate);\\n\\n// example: To calculate EMI for principle amount of ₹10000 over 12 months with \\n// annual interest rate of 9%\\n> Razorpay.emi.calculator(10000, 12, 9);\\n= 874\\n\\n// Returned amount has the same units as passed principle.\\n// i.e. If principle is in paise, returned EMI will also be in paise\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n## Displaying EMI as payment option\nYou can also use the parameter `theme.emi_mode: true` to display EMI tab as a separate payment option in the Checkout form.\n\n\n## Test Card Details\n\nUse our test cards, any future expiry and a random CVV to inspect a flow. The domestic and international test card details as given in the tables below:\n\n### Domestic\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"Mastercard\",\n    \"0-1\": \"5104_0155_5555_5558, <br>5104_0600_0000_0008\",\n    \"1-0\": \"Visa\",\n    \"1-1\": \"4111_1111_1111_1111\"\n  },\n  \"cols\": 2,\n  \"rows\": 2\n}\n[/block]\n### International\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"Mastercard\",\n    \"0-1\": \"5555_5555_5555_4444, <br>5105_1051_0510_5100\",\n    \"1-1\": \"4012_8888_8888_1881, <br>4000_1841_8621_8826\",\n    \"1-0\": \"Visa\"\n  },\n  \"cols\": 2,\n  \"rows\": 2\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"Please remove `_` from the test card numbers while attempting a transaction.\",\n  \"title\": \"Note\"\n}\n[/block]","githubsync":"","isReference":false,"link_external":false,"link_url":"","updates":["55225d95f9996e0d0097ee67","5be1a3579361340192034868"],"api":{"auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":""},"category":"566be10e4db9c60d00c9a82b","createdAt":"2015-02-14T01:44:23.718Z","order":0,"slug":"checkout-form","version":"54dec8b6c2b4b70d009c3f0f","excerpt":"","next":{"description":"","pages":[]},"parentDoc":null,"project":"54c83b5aab706219009e067b","type":"basic","__v":48,"hidden":false,"sync_unique":"","title":"Checkout Form","user":"54c83ac1ab706219009e067a","childrenPages":[]}

Checkout Form


Checkout Form is the primary way to integrate Razorpay with your front end and accept payments online. It provides you with a well designed and tested checkout form for your end customers. This form handles all types of payment methods - cards, netbanking, or wallets. Checkout integration takes care of only the Authorization step in the payment process flow. By default, the standard checkout form is displayed in your customer's browser. However, you can customize to suit your needs. [block:api-header] { "title": "Prerequisites" } [/block] Before integrating the checkout form, add the following line to your `<head>` tag, if not already there: [block:code] { "codes": [ { "code": "<meta name=\"viewport\" content=\"width=device-width\">", "language": "text" } ] } [/block] [block:api-header] { "type": "basic", "title": "Standard Vs Custom Checkout" } [/block] Standard checkout is usually very easy to integrate into your own product. However, when you have multiple products, or a complex way to pre-calculate amount for a payment (in javascript), you can switch to the manual checkout method for greater control. To decide which method the script must follow, it checks for an attribute called `data-key` on the `<script>` tag invocation. If found, the script goes into automatic mode, and will create a button alongside the script tag, and attach its onclick event handler to the `.open` method of the Razorpay object it internally creates. [block:api-header] { "title": "Standard Checkout" } [/block] For standard checkout, you pass the options to `checkout.js` via data attributes in the script tag. The script tag is enclosed within a form tag. Once the payment has been `authorized`, the form is auto-submitted to the URL set in `action` by you in the form tag. [block:code] { "codes": [ { "code": "<form action=\"/purchase\" method=\"POST\">\n<!-- Note that the amount is in paise = 50 INR -->\n<script\n src=\"https://checkout.razorpay.com/v1/checkout.js\"\n data-key=\"<YOUR_KEY_ID>\"\n data-amount=\"5000\"\n data-buttontext=\"Pay with Razorpay\"\n data-name=\"Merchant Name\"\n data-description=\"Purchase Description\"\n data-image=\"https://your-awesome-site.com/your_logo.jpg\"\n data-prefill.name=\"Gaurav Kumar\"\n data-prefill.email=\"test@test.com\"\n data-theme.color=\"#F37254\"\n></script>\n<input type=\"hidden\" value=\"Hidden Element\" name=\"hidden\">\n</form>", "language": "html" } ] } [/block] When the checkout process is completed, the browser will add an additional field (name=id) to the form that contains the script tag. This form is then automatically submitted. The `razorpay_payment_id` is also submitted along with the form to the action url. You can add any additional hidden(or visible) fields you need to that form as well, as seen here, which will be submitted along as well. [block:callout] { "type": "info", "title": "Note", "body": "In addition to the `razorpay_payment_id`, an additional parameter, `razorpay_order_id` is also submitted to the checkout form. This is applicable only when you have integrated with our Orders API. Refer [Orders API] documentation (https://docs.razorpay.com/v2/page/orders)" } [/block] Please note that only successful authorizations are auto-submitted. Failed payments are shown the checkout form again with the option to retry the payment. [block:api-header] { "type": "basic", "title": "Custom Checkout" } [/block] Instead of a form being auto-submitted, the checkout javascript hands over the payment details to a javascript handler function (written by you). You can then use the payment id, send it to your back-end and verify the payment as you wish. [block:callout] { "type": "info", "body": "Please note that checkout.js is meant to be used for normal web based integration. For Cordova/Phonegap/Ionic, have a look at our [Cordova SDK](https://github.com/razorpay/razorpay-cordova)" } [/block] **HANDLER FUNCTION** In the case of manual checkout, the handler function specified will be called automatically at the end of the checkout process with an object consisting of `razorpay_payment_id`. It must then pass along this `razorpay_payment_id` (to capture) to your back-end in some way (using AJAX, for example). Please note that you only need to handle successful authorizations. Failed payments are shown the checkout form again with the option to retry the payment. [block:code] { "codes": [ { "code": "<button id=\"rzp-button1\">Pay</button>\n<script src=\"https://checkout.razorpay.com/v1/checkout.js\"></script>\n<script>\nvar options = {\n \"key\": \"YOUR_KEY_ID\",\n \"amount\": \"2000\", // 2000 paise = INR 20\n \"name\": \"Merchant Name\",\n \"description\": \"Purchase Description\",\n \"image\": \"/your_logo.png\",\n \"handler\": function (response){\n alert(response.razorpay_payment_id);\n },\n \"prefill\": {\n \"name\": \"Gaurav Kumar\",\n \"email\": \"test@test.com\"\n },\n \"notes\": {\n \"address\": \"Hello World\"\n },\n \"theme\": {\n \"color\": \"#F37254\"\n }\n};\nvar rzp1 = new Razorpay(options);\n\ndocument.getElementById('rzp-button1').onclick = function(e){\n rzp1.open();\n e.preventDefault();\n}\n</script>", "language": "javascript" } ] } [/block] To integrate manual checkout: 1. Modify the attributes to suit your needs, [use this table](doc:checkout-form#checkout-fields) as reference. Modify the handler function to handle the response object. 2. After the payment is done on checkout form, the handler function will receive a payment object with `razorpay_payment_id` attribute. This means the payment is `authorized` and you can capture it now. [block:callout] { "type": "success", "body": "You can capture the payment immediately after authorization. To enable the auto capture feature in your payments, read [Orders API](https://docs.razorpay.com/v1/page/orders)" } [/block] 3. Send the `razorpay_payment_id` to your server sided handler url with any other attributes as you may need to [capture the transaction server-sided.](doc:v1paymentsidcapture) 4. If the capture response has no `error_code` set, that means the payment is successful. Check the amount and status attributes of the payment entity returned to validate. You may now process the order on your end. [block:api-header] { "type": "link", "title": "Checkout Fields" } [/block] The following fields are allowed to be passed to the Razorpay function. Field name is used for manual checkout and Attribute names for automatic checkout. Dotted attributes are to be passed as an object in case of manual checkout. [block:parameters] { "data": { "h-0": "Field Name (Manual Checkout)", "h-1": "Attribute Name (Automatic Checkout)", "h-2": "Required?", "h-3": "Description", "0-0": "key", "0-1": "data-key", "0-2": "Yes", "0-3": "Merchant Key-Id", "1-3": "Payment amount in paisa (INR). e.g. If amount = 100, it means Re 1.", "1-0": "amount", "1-1": "data-amount", "1-2": "Yes", "2-0": "name", "2-3": "Merchant Name to be shown in Checkout Form", "2-2": "Yes", "2-1": "data-name", "3-0": "description", "3-3": "Description of the item being purchased. Shown in the checkout form. Must start with an alphanumeric character.", "3-2": "No", "3-1": "data-description", "4-0": "image", "4-1": "data-image", "4-2": "No", "4-3": "Link to an image (usually merchant logo) shown in the checkout form. Can also be a base64 string, if loading image from network is not desirable.", "5-0": "prefill.name", "5-1": "data-prefill.name", "5-2": "No", "5-3": "Cardholder name to be prefilled while displaying the checkout form", "6-0": "prefill.email", "6-1": "data-prefill.email", "6-2": "No", "6-3": "Customer’s email to be prefilled on the checkout form", "7-0": "prefill.contact", "7-1": "data-prefill.contact", "7-2": "No", "7-3": "Customer’s phone number to be prefilled on the checkout form", "9-3": "Any additional fields you want to associate with the payment. Usually includes things like shipping address. Upto 15 notes fields may be specified in this way.", "9-0": "notes.fieldname", "9-1": "data-notes.fieldname", "9-2": "No", "10-0": "handler", "10-1": "N/A", "10-2": "Yes (Manual)\n\nNo (Automatic)", "10-3": "Handler function for manual checkout", "11-0": "theme.color", "11-1": "data-theme.color", "11-2": "No", "11-3": "Brand color to alter the appearance of checkout form.", "12-0": "modal.backdropclose", "12-1": "data-modal.backdropclose", "12-2": "No", "12-3": "Boolean indicating whether clicking translucent blank space outside checkout form should close the form. (default: **false**)", "14-0": "modal.ondismiss", "14-1": "N/A", "14-2": "No", "14-3": "Callback function invoked when form is closed without payment being completed.", "15-0": "order_id", "15-1": "data-order_id", "15-2": "No", "15-3": "Order ID generated via [Orders API](https://docs.razorpay.com/v1/page/orders)", "8-0": "prefill.method", "8-1": "data-prefill.method", "8-2": "No", "8-3": "Pre-select the payment method for the customer. Can be {card|netbanking|wallet|emi|upi}. However, it'll only work if phone and email are also prefilled.", "13-0": "modal.escape", "13-1": "data-modal.escape", "13-2": "No", "13-3": "Boolean indicating whether pressing escape key should close the checkout form. (default: **true**)", "16-0": "invoice_id", "16-1": "data-invoice_id", "16-2": "No", "16-3": "Invoice ID generated via Payment link/Invoices API" }, "cols": 4, "rows": 17 } [/block] [block:api-header] { "type": "basic", "title": "" } [/block] [block:api-header] { "type": "basic", "title": "Checkout Modal Lifecycle" } [/block] In case you want to track the lifecycle of the checkout modal, in `options` you can pass a `modal` object with `ondismiss: function(){}`. `ondismiss` is called when the modal is closed by the user. To track the end of the payment, you can use the `handler` function which gets called on successful transaction. [block:code] { "codes": [ { "code": "var options = {\n \"key\": \"YOUR_KEY_ID\",\n \"amount\": \"2000\",\n \"name\": \"Merchant Name\",\n \"description\": \"Purchase Description\",\n \"image\": \"/your_logo.png\",\n \"handler\": function (response){\n alert(response.razorpay_payment_id);\n },\n \"modal\": {\n \"ondismiss\": function(){}\n }\n};\nvar rzp1 = new Razorpay(options);", "language": "javascript" } ] } [/block] [block:api-header] { "type": "basic", "title": "EMI Utilities" } [/block] ## Fetching EMI Plans To retrieve EMI plans, you can use the event `ready`, as shown below: [block:code] { "codes": [ { "code": "var razorpay = new Razorpay(...); // as before\n\nrazorpay.once('ready', function() {\n // razorpay.methods.emi_plans has list of EMI-supported banks, and respective interest rates\n console.log(razorpay.methods.emi_plans);\n\n // razorpay.methods.netbanking contains list of all banks and bank-codes\n console.log(razorpay.methods.netbanking);\n})", "language": "javascript", "name": null } ] } [/block] EMI plans are sent in the following form: [block:code] { "codes": [ { "code": "{\n \"HDFC\": {\n \"min_amount\": 300000,\n \"plans\": {\n \"3\": 12,\n \"6\": 12,\n \"9\": 13,\n \"12\": 13,\n \"18\": 15,\n \"24\": 15\n }\n },\n \"AMEX\": {\n \"min_amount\": 500000,\n \"plans\": {\n \"3\": 15,\n \"6\": 15,\n \"9\": 15,\n \"12\": 15\n }\n }\n // etc.. \n}", "language": "json" } ] } [/block] In the above given example, the parameter `min_amount` corresponds to minimum Paise below which EMI is not applicable and the parameter `plans` contain a mapping of plan duration in months against the yearly interest rate in percentage. ## Calculating EMI You can utilize the function `Razorpay.emi.calculator` to calculate installment amounts, as shown below: [block:code] { "codes": [ { "code": "Razorpay.emi.calculator(principle_amount, duration_in_month, annual_interest_rate);\n\n// example: To calculate EMI for principle amount of ₹10000 over 12 months with \n// annual interest rate of 9%\n> Razorpay.emi.calculator(10000, 12, 9);\n= 874\n\n// Returned amount has the same units as passed principle.\n// i.e. If principle is in paise, returned EMI will also be in paise", "language": "javascript" } ] } [/block] ## Displaying EMI as payment option You can also use the parameter `theme.emi_mode: true` to display EMI tab as a separate payment option in the Checkout form. ## Test Card Details Use our test cards, any future expiry and a random CVV to inspect a flow. The domestic and international test card details as given in the tables below: ### Domestic [block:parameters] { "data": { "0-0": "Mastercard", "0-1": "5104_0155_5555_5558, <br>5104_0600_0000_0008", "1-0": "Visa", "1-1": "4111_1111_1111_1111" }, "cols": 2, "rows": 2 } [/block] ### International [block:parameters] { "data": { "0-0": "Mastercard", "0-1": "5555_5555_5555_4444, <br>5105_1051_0510_5100", "1-1": "4012_8888_8888_1881, <br>4000_1841_8621_8826", "1-0": "Visa" }, "cols": 2, "rows": 2 } [/block] [block:callout] { "type": "warning", "body": "Please remove `_` from the test card numbers while attempting a transaction.", "title": "Note" } [/block]
Checkout Form is the primary way to integrate Razorpay with your front end and accept payments online. It provides you with a well designed and tested checkout form for your end customers. This form handles all types of payment methods - cards, netbanking, or wallets. Checkout integration takes care of only the Authorization step in the payment process flow. By default, the standard checkout form is displayed in your customer's browser. However, you can customize to suit your needs. [block:api-header] { "title": "Prerequisites" } [/block] Before integrating the checkout form, add the following line to your `<head>` tag, if not already there: [block:code] { "codes": [ { "code": "<meta name=\"viewport\" content=\"width=device-width\">", "language": "text" } ] } [/block] [block:api-header] { "type": "basic", "title": "Standard Vs Custom Checkout" } [/block] Standard checkout is usually very easy to integrate into your own product. However, when you have multiple products, or a complex way to pre-calculate amount for a payment (in javascript), you can switch to the manual checkout method for greater control. To decide which method the script must follow, it checks for an attribute called `data-key` on the `<script>` tag invocation. If found, the script goes into automatic mode, and will create a button alongside the script tag, and attach its onclick event handler to the `.open` method of the Razorpay object it internally creates. [block:api-header] { "title": "Standard Checkout" } [/block] For standard checkout, you pass the options to `checkout.js` via data attributes in the script tag. The script tag is enclosed within a form tag. Once the payment has been `authorized`, the form is auto-submitted to the URL set in `action` by you in the form tag. [block:code] { "codes": [ { "code": "<form action=\"/purchase\" method=\"POST\">\n<!-- Note that the amount is in paise = 50 INR -->\n<script\n src=\"https://checkout.razorpay.com/v1/checkout.js\"\n data-key=\"<YOUR_KEY_ID>\"\n data-amount=\"5000\"\n data-buttontext=\"Pay with Razorpay\"\n data-name=\"Merchant Name\"\n data-description=\"Purchase Description\"\n data-image=\"https://your-awesome-site.com/your_logo.jpg\"\n data-prefill.name=\"Gaurav Kumar\"\n data-prefill.email=\"test@test.com\"\n data-theme.color=\"#F37254\"\n></script>\n<input type=\"hidden\" value=\"Hidden Element\" name=\"hidden\">\n</form>", "language": "html" } ] } [/block] When the checkout process is completed, the browser will add an additional field (name=id) to the form that contains the script tag. This form is then automatically submitted. The `razorpay_payment_id` is also submitted along with the form to the action url. You can add any additional hidden(or visible) fields you need to that form as well, as seen here, which will be submitted along as well. [block:callout] { "type": "info", "title": "Note", "body": "In addition to the `razorpay_payment_id`, an additional parameter, `razorpay_order_id` is also submitted to the checkout form. This is applicable only when you have integrated with our Orders API. Refer [Orders API] documentation (https://docs.razorpay.com/v2/page/orders)" } [/block] Please note that only successful authorizations are auto-submitted. Failed payments are shown the checkout form again with the option to retry the payment. [block:api-header] { "type": "basic", "title": "Custom Checkout" } [/block] Instead of a form being auto-submitted, the checkout javascript hands over the payment details to a javascript handler function (written by you). You can then use the payment id, send it to your back-end and verify the payment as you wish. [block:callout] { "type": "info", "body": "Please note that checkout.js is meant to be used for normal web based integration. For Cordova/Phonegap/Ionic, have a look at our [Cordova SDK](https://github.com/razorpay/razorpay-cordova)" } [/block] **HANDLER FUNCTION** In the case of manual checkout, the handler function specified will be called automatically at the end of the checkout process with an object consisting of `razorpay_payment_id`. It must then pass along this `razorpay_payment_id` (to capture) to your back-end in some way (using AJAX, for example). Please note that you only need to handle successful authorizations. Failed payments are shown the checkout form again with the option to retry the payment. [block:code] { "codes": [ { "code": "<button id=\"rzp-button1\">Pay</button>\n<script src=\"https://checkout.razorpay.com/v1/checkout.js\"></script>\n<script>\nvar options = {\n \"key\": \"YOUR_KEY_ID\",\n \"amount\": \"2000\", // 2000 paise = INR 20\n \"name\": \"Merchant Name\",\n \"description\": \"Purchase Description\",\n \"image\": \"/your_logo.png\",\n \"handler\": function (response){\n alert(response.razorpay_payment_id);\n },\n \"prefill\": {\n \"name\": \"Gaurav Kumar\",\n \"email\": \"test@test.com\"\n },\n \"notes\": {\n \"address\": \"Hello World\"\n },\n \"theme\": {\n \"color\": \"#F37254\"\n }\n};\nvar rzp1 = new Razorpay(options);\n\ndocument.getElementById('rzp-button1').onclick = function(e){\n rzp1.open();\n e.preventDefault();\n}\n</script>", "language": "javascript" } ] } [/block] To integrate manual checkout: 1. Modify the attributes to suit your needs, [use this table](doc:checkout-form#checkout-fields) as reference. Modify the handler function to handle the response object. 2. After the payment is done on checkout form, the handler function will receive a payment object with `razorpay_payment_id` attribute. This means the payment is `authorized` and you can capture it now. [block:callout] { "type": "success", "body": "You can capture the payment immediately after authorization. To enable the auto capture feature in your payments, read [Orders API](https://docs.razorpay.com/v1/page/orders)" } [/block] 3. Send the `razorpay_payment_id` to your server sided handler url with any other attributes as you may need to [capture the transaction server-sided.](doc:v1paymentsidcapture) 4. If the capture response has no `error_code` set, that means the payment is successful. Check the amount and status attributes of the payment entity returned to validate. You may now process the order on your end. [block:api-header] { "type": "link", "title": "Checkout Fields" } [/block] The following fields are allowed to be passed to the Razorpay function. Field name is used for manual checkout and Attribute names for automatic checkout. Dotted attributes are to be passed as an object in case of manual checkout. [block:parameters] { "data": { "h-0": "Field Name (Manual Checkout)", "h-1": "Attribute Name (Automatic Checkout)", "h-2": "Required?", "h-3": "Description", "0-0": "key", "0-1": "data-key", "0-2": "Yes", "0-3": "Merchant Key-Id", "1-3": "Payment amount in paisa (INR). e.g. If amount = 100, it means Re 1.", "1-0": "amount", "1-1": "data-amount", "1-2": "Yes", "2-0": "name", "2-3": "Merchant Name to be shown in Checkout Form", "2-2": "Yes", "2-1": "data-name", "3-0": "description", "3-3": "Description of the item being purchased. Shown in the checkout form. Must start with an alphanumeric character.", "3-2": "No", "3-1": "data-description", "4-0": "image", "4-1": "data-image", "4-2": "No", "4-3": "Link to an image (usually merchant logo) shown in the checkout form. Can also be a base64 string, if loading image from network is not desirable.", "5-0": "prefill.name", "5-1": "data-prefill.name", "5-2": "No", "5-3": "Cardholder name to be prefilled while displaying the checkout form", "6-0": "prefill.email", "6-1": "data-prefill.email", "6-2": "No", "6-3": "Customer’s email to be prefilled on the checkout form", "7-0": "prefill.contact", "7-1": "data-prefill.contact", "7-2": "No", "7-3": "Customer’s phone number to be prefilled on the checkout form", "9-3": "Any additional fields you want to associate with the payment. Usually includes things like shipping address. Upto 15 notes fields may be specified in this way.", "9-0": "notes.fieldname", "9-1": "data-notes.fieldname", "9-2": "No", "10-0": "handler", "10-1": "N/A", "10-2": "Yes (Manual)\n\nNo (Automatic)", "10-3": "Handler function for manual checkout", "11-0": "theme.color", "11-1": "data-theme.color", "11-2": "No", "11-3": "Brand color to alter the appearance of checkout form.", "12-0": "modal.backdropclose", "12-1": "data-modal.backdropclose", "12-2": "No", "12-3": "Boolean indicating whether clicking translucent blank space outside checkout form should close the form. (default: **false**)", "14-0": "modal.ondismiss", "14-1": "N/A", "14-2": "No", "14-3": "Callback function invoked when form is closed without payment being completed.", "15-0": "order_id", "15-1": "data-order_id", "15-2": "No", "15-3": "Order ID generated via [Orders API](https://docs.razorpay.com/v1/page/orders)", "8-0": "prefill.method", "8-1": "data-prefill.method", "8-2": "No", "8-3": "Pre-select the payment method for the customer. Can be {card|netbanking|wallet|emi|upi}. However, it'll only work if phone and email are also prefilled.", "13-0": "modal.escape", "13-1": "data-modal.escape", "13-2": "No", "13-3": "Boolean indicating whether pressing escape key should close the checkout form. (default: **true**)", "16-0": "invoice_id", "16-1": "data-invoice_id", "16-2": "No", "16-3": "Invoice ID generated via Payment link/Invoices API" }, "cols": 4, "rows": 17 } [/block] [block:api-header] { "type": "basic", "title": "" } [/block] [block:api-header] { "type": "basic", "title": "Checkout Modal Lifecycle" } [/block] In case you want to track the lifecycle of the checkout modal, in `options` you can pass a `modal` object with `ondismiss: function(){}`. `ondismiss` is called when the modal is closed by the user. To track the end of the payment, you can use the `handler` function which gets called on successful transaction. [block:code] { "codes": [ { "code": "var options = {\n \"key\": \"YOUR_KEY_ID\",\n \"amount\": \"2000\",\n \"name\": \"Merchant Name\",\n \"description\": \"Purchase Description\",\n \"image\": \"/your_logo.png\",\n \"handler\": function (response){\n alert(response.razorpay_payment_id);\n },\n \"modal\": {\n \"ondismiss\": function(){}\n }\n};\nvar rzp1 = new Razorpay(options);", "language": "javascript" } ] } [/block] [block:api-header] { "type": "basic", "title": "EMI Utilities" } [/block] ## Fetching EMI Plans To retrieve EMI plans, you can use the event `ready`, as shown below: [block:code] { "codes": [ { "code": "var razorpay = new Razorpay(...); // as before\n\nrazorpay.once('ready', function() {\n // razorpay.methods.emi_plans has list of EMI-supported banks, and respective interest rates\n console.log(razorpay.methods.emi_plans);\n\n // razorpay.methods.netbanking contains list of all banks and bank-codes\n console.log(razorpay.methods.netbanking);\n})", "language": "javascript", "name": null } ] } [/block] EMI plans are sent in the following form: [block:code] { "codes": [ { "code": "{\n \"HDFC\": {\n \"min_amount\": 300000,\n \"plans\": {\n \"3\": 12,\n \"6\": 12,\n \"9\": 13,\n \"12\": 13,\n \"18\": 15,\n \"24\": 15\n }\n },\n \"AMEX\": {\n \"min_amount\": 500000,\n \"plans\": {\n \"3\": 15,\n \"6\": 15,\n \"9\": 15,\n \"12\": 15\n }\n }\n // etc.. \n}", "language": "json" } ] } [/block] In the above given example, the parameter `min_amount` corresponds to minimum Paise below which EMI is not applicable and the parameter `plans` contain a mapping of plan duration in months against the yearly interest rate in percentage. ## Calculating EMI You can utilize the function `Razorpay.emi.calculator` to calculate installment amounts, as shown below: [block:code] { "codes": [ { "code": "Razorpay.emi.calculator(principle_amount, duration_in_month, annual_interest_rate);\n\n// example: To calculate EMI for principle amount of ₹10000 over 12 months with \n// annual interest rate of 9%\n> Razorpay.emi.calculator(10000, 12, 9);\n= 874\n\n// Returned amount has the same units as passed principle.\n// i.e. If principle is in paise, returned EMI will also be in paise", "language": "javascript" } ] } [/block] ## Displaying EMI as payment option You can also use the parameter `theme.emi_mode: true` to display EMI tab as a separate payment option in the Checkout form. ## Test Card Details Use our test cards, any future expiry and a random CVV to inspect a flow. The domestic and international test card details as given in the tables below: ### Domestic [block:parameters] { "data": { "0-0": "Mastercard", "0-1": "5104_0155_5555_5558, <br>5104_0600_0000_0008", "1-0": "Visa", "1-1": "4111_1111_1111_1111" }, "cols": 2, "rows": 2 } [/block] ### International [block:parameters] { "data": { "0-0": "Mastercard", "0-1": "5555_5555_5555_4444, <br>5105_1051_0510_5100", "1-1": "4012_8888_8888_1881, <br>4000_1841_8621_8826", "1-0": "Visa" }, "cols": 2, "rows": 2 } [/block] [block:callout] { "type": "warning", "body": "Please remove `_` from the test card numbers while attempting a transaction.", "title": "Note" } [/block]
{"_id":"566be0f785dc790d0062c10c","next":{"description":"","pages":[]},"title":"Android","type":"basic","sync_unique":"","version":"54dec8b6c2b4b70d009c3f0f","githubsync":"","hidden":false,"link_url":"","parentDoc":null,"project":"54c83b5aab706219009e067b","order":0,"slug":"android","updates":["57804f989a9ff80e0051bea9","5b6147e34e051600037b5dcf"],"__v":5,"body":"Android SDK follows semantic versioning. You can find documentation for our latest SDK here: [Android Checkout SDK](https://razorpay.com/docs/checkout/android/)  \n\nOur SDK is available on Maven Central. For sample app and older releases, visit the sample app GitHub repo here: [github.com/razorpay/razorpay-android-sample-app/releases](https://github.com/razorpay/razorpay-android-sample-app/releases)","category":"566bdfdecb3d040d00abae18","createdAt":"2015-12-12T08:55:19.744Z","isReference":false,"user":"55830889ea39a9390022432b","api":{"url":"","auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":""},"excerpt":"","link_external":false,"childrenPages":[]}

Android


Android SDK follows semantic versioning. You can find documentation for our latest SDK here: [Android Checkout SDK](https://razorpay.com/docs/checkout/android/) Our SDK is available on Maven Central. For sample app and older releases, visit the sample app GitHub repo here: [github.com/razorpay/razorpay-android-sample-app/releases](https://github.com/razorpay/razorpay-android-sample-app/releases)
Android SDK follows semantic versioning. You can find documentation for our latest SDK here: [Android Checkout SDK](https://razorpay.com/docs/checkout/android/) Our SDK is available on Maven Central. For sample app and older releases, visit the sample app GitHub repo here: [github.com/razorpay/razorpay-android-sample-app/releases](https://github.com/razorpay/razorpay-android-sample-app/releases)
{"_id":"54dec8b7c2b4b70d009c3f19","__v":7,"createdAt":"2015-02-13T13:06:46.896Z","title":"/payments","category":"54dec8b7c2b4b70d009c3f11","editedParams2":true,"excerpt":"Retrieve multiple payments","hidden":false,"link_url":"","parentDoc":null,"project":"54c83b5aab706219009e067b","type":"get","isReference":true,"link_external":false,"order":0,"user":"54c83ac1ab706219009e067a","version":"54dec8b6c2b4b70d009c3f0f","updates":["58368342e958a60f0012e077","591c2ccb4588a819002845a9","5934667862fed0000f9aabe2","5934677162fed0000f9aac23","5c455619e574b40180aa0247"],"api":{"method":"get","params":[{"_id":"54ddf6e6c4a3570d009d4955","ref":"","in":"query","required":false,"desc":"The timestamp in seconds after which the payments were created","default":"","type":"timestamp","name":"from"},{"_id":"54ddf6e6c4a3570d009d4954","ref":"","in":"query","required":false,"desc":"The timestamp in seconds before which payments were created","default":"","type":"timestamp","name":"to"},{"_id":"54ddf6e6c4a3570d009d4953","ref":"","in":"query","required":false,"desc":"The number of payments to fetch","default":"10","type":"int","name":"count"},{"_id":"54ddf6e6c4a3570d009d4952","ref":"","in":"query","required":false,"desc":"The number of payments to be skipped","default":"0","type":"int","name":"skip"}],"results":{"codes":[{"name":null,"code":"{\n  \"count\": 2,\n  \"entity\": \"collection\",\n  \"items\": [\n    {\n      \"id\": \"pay_7IZD7aJ2kkmOjk\",\n      \"entity\": \"payment\",\n      \"amount\": 500,\n      \"currency\": \"INR\",\n      \"status\": \"captured\",\n      \"order_id\": null,\n      \"invoice_id\": null,\n      \"international\": false,\n      \"method\": \"wallet\",\n      \"amount_refunded\": 0,\n      \"refund_status\": null,\n      \"captured\": true,\n      \"description\": \"Purchase Description\",\n      \"card_id\": null,\n      \"bank\": null,\n      \"wallet\": \"freecharge\",\n      \"vpa\": null,\n      \"email\": \"a@b.com\",\n      \"contact\": \"91xxxxxxxx\",\n      \"notes\": {\n        \"merchant_order_id\": \"order id\"\n      },\n      \"fee\": 12,\n      \"tax\": 2,\n      \"error_code\": null,\n      \"error_description\": null,\n      \"created_at\": 1487348129\n    },\n    {\n      \"id\": \"pay_19btGlBig6xZ2f\",\n      \"entity\": \"payment\",\n      \"amount\": 500,\n      \"currency\": \"INR\",\n      \"status\": \"captured\",\n      \"order_id\": null,\n      \"invoice_id\": null,\n      \"international\": false,\n      \"method\": \"card\",\n      \"amount_refunded\": 0,\n      \"refund_status\": null,\n      \"captured\": true,\n      \"description\": \"Purchase Description\",\n      \"card_id\": \"card_12abClEig3hi2k\",\n      \"bank\": null,\n      \"wallet\": null,\n      \"vpa\": null,\n      \"email\": \"a@b.com\",\n      \"contact\": \"91xxxxxxxx\",\n      \"notes\": {\n        \"merchant_order_id\": \"order id\"\n      }\n    },\n    {\n      \"fee\": 12,\n      \"tax\": 2,\n      \"error_code\": null,\n      \"error_description\": null,\n      \"created_at\": 1400826750\n    }\n  ]\n}","language":"json","status":200},{"name":"","code":"{\n   \"error\": {\n      \"code\": \"BAD_REQUEST_ERROR\",\n      \"description\": \"The count is invalid\",\n      \"field\": \"count\"\n   }\n}","language":"json","status":400},{"code":"{\n    \"error\": {\n        \"code\": \"BAD_REQUEST_ERROR\",\n        \"description\": \"The api key provided is invalid\"\n    }\n}","language":"json","status":401}]},"settings":"","url":"/payments/","auth":"required","examples":{"codes":[]}},"body":"This endpoint is used for retrieving list of payments based on optional parameters. By default only last 10 are returned. You can use count and skip parameters to change that behavior.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\\\ \\nhttps://api.razorpay.com/v1/payments/?count=2&skip=1&from=1400826740 \",\n      \"language\": \"curl\"\n    },\n    {\n      \"code\": \"<?php\\n\\nuse Razorpay\\\\Api\\\\Api;\\n\\n$api = new Api('rzp_test_26ccbdbfe0e84b', '69b2e24411e384f91213f22a');\\n\\n$params = array(\\n    'count' => 2,\\n    'skip'  => 1,\\n    'from'  => 1400826740\\n);\\n\\n$payments = $api->payment->all($params);\\n\\n?>\",\n      \"language\": \"php\"\n    },\n    {\n      \"code\": \"# do easy_install razorpay or\\n#    pip install razorpay\\n\\nimport razorpay\\n\\nclient = razorpay.Client(auth=(\\\"<YOUR_API_KEY>\\\", \\\"<YOUR_API_SECRET>\\\"))\\n\\nresp = client.payment.fetch_all()\",\n      \"language\": \"python\"\n    },\n    {\n      \"code\": \"require 'razorpay'\\n\\nRazorpay.setup(\\\"rzp_test_26ccbdbfe0e84b\\\", \\\"69b2e24411e384f91213f22a\\\")\\n\\nRazorpay::Payment.all({from:1400826740, count:2, skip:1})\",\n      \"language\": \"ruby\"\n    },\n    {\n      \"code\": \"var request = require('request');\\n\\nrequest('rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a@api.razorpay.com/v1/payments/?from=1400826740&count=2&skip=1', function (error, response, body) {\\n  console.log('Response:', body);\\n});\",\n      \"language\": \"javascript\",\n      \"name\": \"Node\"\n    },\n    {\n      \"code\": \"Dictionary<string, object> options = new Dictionary<string, object>();\\n\\n//supported option filters (from, to, count, skip)\\noptions.Add(\\\"count\\\", 5);\\noptions.Add(\\\"skip\\\", 1000);\\n\\nRazorpayClient client = new RazorpayClient(\\\"<api-key>\\\", \\\"<api-secret>\\\");\\nList<Payment> result = client.Payment.All(options);\",\n      \"language\": \"csharp\"\n    },\n    {\n      \"code\": \"import java.util.List;\\nimport org.json.JSONObject;\\nimport com.razorpay.Payment;\\nimport com.razorpay.RazorpayClient;\\nimport com.razorpay.RazorpayException;\\n\\nRazorpayClient razorpay = new RazorpayClient(\\\"<api_key>\\\", \\\"<api_secret>\\\");\\ntry {\\n\\tJSONObject payemntRequest = new JSONObject();\\n   \\n    //supported option filters (from, to, count, skip)\\n\\tpayemntRequest.put(\\\"count\\\", 2);\\n\\tpayemntRequest.put(\\\"skip\\\", 1);\\n\\t\\t\\t\\n\\tList<Payment> payments = razorpay.Payments.fetchAll(payemntRequest);\\n} catch (RazorpayException e) {\\n\\t// Handle Exception \\n    System.out.println(e.getMessage());\\n}\",\n      \"language\": \"java\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","editedParams":true,"githubsync":"","next":{"description":"","pages":[]},"slug":"payments","sync_unique":"","childrenPages":[]}

get/payments

Retrieve multiple payments

Query Params

from:
timestamp
The timestamp in seconds after which the payments were created
to:
timestamp
The timestamp in seconds before which payments were created
count:
integer10
The number of payments to fetch
skip:
integer0
The number of payments to be skipped
This endpoint is used for retrieving list of payments based on optional parameters. By default only last 10 are returned. You can use count and skip parameters to change that behavior. [block:code] { "codes": [ { "code": "curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\ \nhttps://api.razorpay.com/v1/payments/?count=2&skip=1&from=1400826740 ", "language": "curl" }, { "code": "<?php\n\nuse Razorpay\\Api\\Api;\n\n$api = new Api('rzp_test_26ccbdbfe0e84b', '69b2e24411e384f91213f22a');\n\n$params = array(\n 'count' => 2,\n 'skip' => 1,\n 'from' => 1400826740\n);\n\n$payments = $api->payment->all($params);\n\n?>", "language": "php" }, { "code": "# do easy_install razorpay or\n# pip install razorpay\n\nimport razorpay\n\nclient = razorpay.Client(auth=(\"<YOUR_API_KEY>\", \"<YOUR_API_SECRET>\"))\n\nresp = client.payment.fetch_all()", "language": "python" }, { "code": "require 'razorpay'\n\nRazorpay.setup(\"rzp_test_26ccbdbfe0e84b\", \"69b2e24411e384f91213f22a\")\n\nRazorpay::Payment.all({from:1400826740, count:2, skip:1})", "language": "ruby" }, { "code": "var request = require('request');\n\nrequest('rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a@api.razorpay.com/v1/payments/?from=1400826740&count=2&skip=1', function (error, response, body) {\n console.log('Response:', body);\n});", "language": "javascript", "name": "Node" }, { "code": "Dictionary<string, object> options = new Dictionary<string, object>();\n\n//supported option filters (from, to, count, skip)\noptions.Add(\"count\", 5);\noptions.Add(\"skip\", 1000);\n\nRazorpayClient client = new RazorpayClient(\"<api-key>\", \"<api-secret>\");\nList<Payment> result = client.Payment.All(options);", "language": "csharp" }, { "code": "import java.util.List;\nimport org.json.JSONObject;\nimport com.razorpay.Payment;\nimport com.razorpay.RazorpayClient;\nimport com.razorpay.RazorpayException;\n\nRazorpayClient razorpay = new RazorpayClient(\"<api_key>\", \"<api_secret>\");\ntry {\n\tJSONObject payemntRequest = new JSONObject();\n \n //supported option filters (from, to, count, skip)\n\tpayemntRequest.put(\"count\", 2);\n\tpayemntRequest.put(\"skip\", 1);\n\t\t\t\n\tList<Payment> payments = razorpay.Payments.fetchAll(payemntRequest);\n} catch (RazorpayException e) {\n\t// Handle Exception \n System.out.println(e.getMessage());\n}", "language": "java" } ], "sidebar": true } [/block]

Definition

{{ api_url }}{{ page_api_url }}

Result Format



This endpoint is used for retrieving list of payments based on optional parameters. By default only last 10 are returned. You can use count and skip parameters to change that behavior. [block:code] { "codes": [ { "code": "curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\ \nhttps://api.razorpay.com/v1/payments/?count=2&skip=1&from=1400826740 ", "language": "curl" }, { "code": "<?php\n\nuse Razorpay\\Api\\Api;\n\n$api = new Api('rzp_test_26ccbdbfe0e84b', '69b2e24411e384f91213f22a');\n\n$params = array(\n 'count' => 2,\n 'skip' => 1,\n 'from' => 1400826740\n);\n\n$payments = $api->payment->all($params);\n\n?>", "language": "php" }, { "code": "# do easy_install razorpay or\n# pip install razorpay\n\nimport razorpay\n\nclient = razorpay.Client(auth=(\"<YOUR_API_KEY>\", \"<YOUR_API_SECRET>\"))\n\nresp = client.payment.fetch_all()", "language": "python" }, { "code": "require 'razorpay'\n\nRazorpay.setup(\"rzp_test_26ccbdbfe0e84b\", \"69b2e24411e384f91213f22a\")\n\nRazorpay::Payment.all({from:1400826740, count:2, skip:1})", "language": "ruby" }, { "code": "var request = require('request');\n\nrequest('rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a@api.razorpay.com/v1/payments/?from=1400826740&count=2&skip=1', function (error, response, body) {\n console.log('Response:', body);\n});", "language": "javascript", "name": "Node" }, { "code": "Dictionary<string, object> options = new Dictionary<string, object>();\n\n//supported option filters (from, to, count, skip)\noptions.Add(\"count\", 5);\noptions.Add(\"skip\", 1000);\n\nRazorpayClient client = new RazorpayClient(\"<api-key>\", \"<api-secret>\");\nList<Payment> result = client.Payment.All(options);", "language": "csharp" }, { "code": "import java.util.List;\nimport org.json.JSONObject;\nimport com.razorpay.Payment;\nimport com.razorpay.RazorpayClient;\nimport com.razorpay.RazorpayException;\n\nRazorpayClient razorpay = new RazorpayClient(\"<api_key>\", \"<api_secret>\");\ntry {\n\tJSONObject payemntRequest = new JSONObject();\n \n //supported option filters (from, to, count, skip)\n\tpayemntRequest.put(\"count\", 2);\n\tpayemntRequest.put(\"skip\", 1);\n\t\t\t\n\tList<Payment> payments = razorpay.Payments.fetchAll(payemntRequest);\n} catch (RazorpayException e) {\n\t// Handle Exception \n System.out.println(e.getMessage());\n}", "language": "java" } ], "sidebar": true } [/block]
{"_id":"54dec8b7c2b4b70d009c3f1a","order":1,"sync_unique":"","updates":["562f5b29eed65e0d008deebe","59724e6d107a9f001b2cf5f0","5b0829ad7833b20003ddbe24","5b2c7d44f4eae600035b74c1","5b2ca4dbf4eae600035b765d","5be576f5d37d5c0029ef012d","5c03804ea889f0005c7adb14","5c5a6b2ec4ea03002a1500c6"],"parentDoc":null,"project":"54c83b5aab706219009e067b","version":"54dec8b6c2b4b70d009c3f0f","editedParams":true,"editedParams2":true,"githubsync":"","link_external":false,"link_url":"","body":"This endpoint is used for retrieving a specific payment object by its id.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\\\ \\nhttps://api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f\",\n      \"language\": \"curl\",\n      \"name\": null\n    },\n    {\n      \"code\": \"<?php\\n\\nuse Razorpay\\\\Api\\\\Api;\\n\\n$api = new Api('rzp_test_26ccbdbfe0e84b', '69b2e24411e384f91213f22a');\\n\\n$payment = $api->payment->fetch('pay_29QQoUBi66xm2f');\\n\\n?>\",\n      \"language\": \"php\"\n    },\n    {\n      \"code\": \"# do easy_install razorpay or\\n#    pip install razorpay\\n\\nimport razorpay\\n\\nclient = razorpay.Client(auth=(\\\"<YOUR_API_KEY>\\\", \\\"<YOUR_API_SECRET>\\\"))\\n\\npayment_id = \\\"<PAYMENT_ID>\\\"\\n\\nresp = client.payment.fetch(payment_id)\",\n      \"language\": \"python\"\n    },\n    {\n      \"code\": \"require 'razorpay'\\n\\nRazorpay.setup(\\\"rzp_test_26ccbdbfe0e84b\\\", \\\"69b2e24411e384f91213f22a\\\")\\n\\nRazorpay::Payment.fetch(\\\"pay_29QQoUBi66xm2f\\\")\",\n      \"language\": \"ruby\"\n    },\n    {\n      \"code\": \"var request = require('request');\\n\\nrequest('https://rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a@api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f', function (error, response, body) {\\n  console.log('Response:', body);\\n});\",\n      \"language\": \"javascript\",\n      \"name\": \"Node\"\n    },\n    {\n      \"code\": \"RazorpayClient client = new RazorpayClient(\\\"<api-key>\\\", \\\"<api-secret>\\\");\\nPayment payment = client.Payment.Fetch(paymentId);\",\n      \"language\": \"csharp\"\n    },\n    {\n      \"code\": \"import com.razorpay.Payment;\\nimport com.razorpay.RazorpayClient;\\nimport com.razorpay.RazorpayException;\\n\\nRazorpayClient razorpay = new RazorpayClient(\\\"<api_key>\\\", \\\"<api_secret>\\\");\\ntry {\\n\\tPayment payment = razorpay.Payments.fetch(\\\"<payment_id>\\\");\\n} catch (RazorpayException e) {\\n\\t// Handle Exception\\n\\tSystem.out.println(e.getMessage());\\n}\",\n      \"language\": \"java\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","createdAt":"2015-02-13T13:29:49.756Z","excerpt":"Retrieve a Payment by ID","hidden":false,"slug":"v1paymentsid","title":"/payments/:id","type":"get","__v":9,"api":{"url":"/payments/:id","auth":"required","examples":{"codes":[]},"method":"get","params":[{"default":"","desc":"The id of the payment to be retrieved","in":"path","name":"id","ref":"","required":true,"type":"string","_id":"54ddfdca45aa9e170051e68c"}],"results":{"codes":[{"status":200,"name":"","code":"{\n    \"id\": \"pay_29QQoUBi66xm2f\",\n    \"entity\": \"payment\",\n    \"amount\": 5000,\n    \"currency\": \"INR\",\n    \"status\": \"captured\",\n    \"order_id\": null,\n    \"invoice_id\": null,\n    \"international\": false,\n    \"method\": \"wallet\",\n    \"amount_refunded\": 0,\n    \"refund_status\": null,\n    \"captured\": true,\n    \"description\": \"Purchase Description\",\n    \"card_id\": null,\n    \"bank\": null,\n    \"wallet\": \"freecharge\",\n    \"vpa\": null,\n    \"email\": \"a@b.com\",\n    \"contact\": \"91xxxxxxxx\",\n    \"notes\": {\n        \"merchant_order_id\": \"order id\"\n    },\n    \"fee\": 1438,\n    \"tax\": 188,\n    \"error_code\": null,\n    \"error_description\": null,\n    \"created_at\": 1400826750\n}","language":"json"},{"name":"","code":"{\n   \"error\": {\n      \"code\": \"BAD_REQUEST_ERROR\",\n      \"description\": \"The payment was not found\"\n   }\n}","language":"json","status":400},{"status":401,"language":"json","code":"{\n    \"error\": {\n        \"code\": \"BAD_REQUEST_ERROR\",\n        \"description\": \"The api key provided is invalid\"\n    }\n}"}]},"settings":""},"category":"54dec8b7c2b4b70d009c3f11","isReference":true,"next":{"description":"","pages":[]},"user":"54c83ac1ab706219009e067a","childrenPages":[]}

get/payments/:id

Retrieve a Payment by ID

Path Params

id:
required
string
The id of the payment to be retrieved
This endpoint is used for retrieving a specific payment object by its id. [block:code] { "codes": [ { "code": "curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\ \nhttps://api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f", "language": "curl", "name": null }, { "code": "<?php\n\nuse Razorpay\\Api\\Api;\n\n$api = new Api('rzp_test_26ccbdbfe0e84b', '69b2e24411e384f91213f22a');\n\n$payment = $api->payment->fetch('pay_29QQoUBi66xm2f');\n\n?>", "language": "php" }, { "code": "# do easy_install razorpay or\n# pip install razorpay\n\nimport razorpay\n\nclient = razorpay.Client(auth=(\"<YOUR_API_KEY>\", \"<YOUR_API_SECRET>\"))\n\npayment_id = \"<PAYMENT_ID>\"\n\nresp = client.payment.fetch(payment_id)", "language": "python" }, { "code": "require 'razorpay'\n\nRazorpay.setup(\"rzp_test_26ccbdbfe0e84b\", \"69b2e24411e384f91213f22a\")\n\nRazorpay::Payment.fetch(\"pay_29QQoUBi66xm2f\")", "language": "ruby" }, { "code": "var request = require('request');\n\nrequest('https://rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a@api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f', function (error, response, body) {\n console.log('Response:', body);\n});", "language": "javascript", "name": "Node" }, { "code": "RazorpayClient client = new RazorpayClient(\"<api-key>\", \"<api-secret>\");\nPayment payment = client.Payment.Fetch(paymentId);", "language": "csharp" }, { "code": "import com.razorpay.Payment;\nimport com.razorpay.RazorpayClient;\nimport com.razorpay.RazorpayException;\n\nRazorpayClient razorpay = new RazorpayClient(\"<api_key>\", \"<api_secret>\");\ntry {\n\tPayment payment = razorpay.Payments.fetch(\"<payment_id>\");\n} catch (RazorpayException e) {\n\t// Handle Exception\n\tSystem.out.println(e.getMessage());\n}", "language": "java" } ], "sidebar": true } [/block]

Definition

{{ api_url }}{{ page_api_url }}

Result Format



This endpoint is used for retrieving a specific payment object by its id. [block:code] { "codes": [ { "code": "curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\ \nhttps://api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f", "language": "curl", "name": null }, { "code": "<?php\n\nuse Razorpay\\Api\\Api;\n\n$api = new Api('rzp_test_26ccbdbfe0e84b', '69b2e24411e384f91213f22a');\n\n$payment = $api->payment->fetch('pay_29QQoUBi66xm2f');\n\n?>", "language": "php" }, { "code": "# do easy_install razorpay or\n# pip install razorpay\n\nimport razorpay\n\nclient = razorpay.Client(auth=(\"<YOUR_API_KEY>\", \"<YOUR_API_SECRET>\"))\n\npayment_id = \"<PAYMENT_ID>\"\n\nresp = client.payment.fetch(payment_id)", "language": "python" }, { "code": "require 'razorpay'\n\nRazorpay.setup(\"rzp_test_26ccbdbfe0e84b\", \"69b2e24411e384f91213f22a\")\n\nRazorpay::Payment.fetch(\"pay_29QQoUBi66xm2f\")", "language": "ruby" }, { "code": "var request = require('request');\n\nrequest('https://rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a@api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f', function (error, response, body) {\n console.log('Response:', body);\n});", "language": "javascript", "name": "Node" }, { "code": "RazorpayClient client = new RazorpayClient(\"<api-key>\", \"<api-secret>\");\nPayment payment = client.Payment.Fetch(paymentId);", "language": "csharp" }, { "code": "import com.razorpay.Payment;\nimport com.razorpay.RazorpayClient;\nimport com.razorpay.RazorpayException;\n\nRazorpayClient razorpay = new RazorpayClient(\"<api_key>\", \"<api_secret>\");\ntry {\n\tPayment payment = razorpay.Payments.fetch(\"<payment_id>\");\n} catch (RazorpayException e) {\n\t// Handle Exception\n\tSystem.out.println(e.getMessage());\n}", "language": "java" } ], "sidebar": true } [/block]
{"_id":"54dec8b7c2b4b70d009c3f1b","updates":["590169e7737ec40f00461736","5c63c8ea7c90d20172c08fd8"],"version":"54dec8b6c2b4b70d009c3f0f","excerpt":"Capture a payment","parentDoc":null,"slug":"v1paymentsidcapture","hidden":false,"link_external":false,"link_url":"","sync_unique":"","user":"54c83ac1ab706219009e067a","api":{"results":{"codes":[{"name":"","code":"{\n    \"id\": \"pay_7IZD7aJ2kkmOjk\",\n    \"entity\": \"payment\",\n    \"amount\": 50000,\n    \"currency\": \"INR\",\n    \"status\": \"captured\",\n    \"order_id\": null,\n    \"invoice_id\": null,\n    \"international\": false,\n    \"method\": \"wallet\",\n    \"amount_refunded\": 0,\n    \"refund_status\": null,\n    \"captured\": true,\n    \"description\": \"Purchase Description\",\n    \"card_id\": null,\n    \"bank\": null,\n    \"wallet\": \"freecharge\",\n    \"vpa\": null,\n    \"email\": \"a@b.com\",\n    \"contact\": \"91xxxxxxxx\",\n    \"notes\": {\n        \"merchant_order_id\": \"order id\"\n    },\n    \"fee\": 1438,\n    \"tax\": 188,\n    \"error_code\": null,\n    \"error_description\": null,\n    \"created_at\": 1400826750\n}","language":"json","status":200},{"status":400,"name":"","code":"{\n   \"error\": {\n      \"code\": \"BAD_REQUEST_ERROR\",\n      \"description\": \"The amount is invalid\",\n      \"field\": \"amount\"\n   }\n}","language":"json"},{"code":"{\n    \"error\": {\n        \"code\": \"BAD_REQUEST_ERROR\",\n        \"description\": \"The api key provided is invalid\"\n    }\n}","language":"json","status":401}]},"settings":"","url":"/payments/:id/capture","auth":"required","examples":{"codes":[]},"method":"post","params":[{"_id":"54de07c33a91410d001b16ad","ref":"","in":"path","required":true,"desc":"The ID of the payment to capture","default":"","type":"string","name":"id"},{"_id":"54de07c33a91410d001b16ac","ref":"","in":"body","required":true,"desc":"The amount to be captured (should be equal to the authorized amount, in paise)","default":"","type":"string","name":"amount"}]},"category":"54dec8b7c2b4b70d009c3f11","createdAt":"2015-02-13T14:18:43.845Z","editedParams":true,"githubsync":"","next":{"description":"","pages":[]},"order":2,"project":"54c83b5aab706219009e067b","__v":4,"body":"[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"\",\n  \"title\": \"Take care while specifying amount param, it should be specified in paise and should be equal to authorized amount.\"\n}\n[/block]\nThis endpoint captures a specific payment. Capture is done after a payment status has been successfully set as “authorized”.\n\nAfter capture the funds are transferred to your account in T + 3 days. The amount sent in the capture request must come from a verified source and be the amount that you are expecting to receive. \n\nPlease do not accept the capture amount from the user, for security reasons.\n\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\\\\\n   -X POST \\\\\\n   --data \\\"amount=500\\\" \\\\\\n   https://api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/capture\",\n      \"language\": \"curl\"\n    },\n    {\n      \"code\": \"<?php\\n\\nuse Razorpay\\\\Api\\\\Api;\\n\\n$api = new Api('rzp_test_26ccbdbfe0e84b', '69b2e24411e384f91213f22a');\\n\\n$payment = $api->payment->fetch('pay_29QQoUBi66xm2f');\\n$payment->capture(array('amount' => 500));\\n\\n?>\",\n      \"language\": \"php\"\n    },\n    {\n      \"code\": \"# do easy_install razorpay or\\n#    pip install razorpay\\n\\nimport razorpay\\n\\nclient = razorpay.Client(auth=(\\\"<YOUR_API_KEY>\\\", \\\"<YOUR_API_SECRET>\\\"))\\n\\npayment_id = \\\"<PAYMENT_ID>\\\"\\n\\npayment_amount = <PAYMENT AMOUNT>\\n\\nresp = client.payment.capture(payment_id, payment_amount)\",\n      \"language\": \"python\"\n    },\n    {\n      \"code\": \"require 'razorpay'\\n\\nRazorpay.setup(\\\"rzp_test_26ccbdbfe0e84b\\\", \\\"69b2e24411e384f91213f22a\\\")\\n\\nRazorpay::Payment.fetch(\\\"pay_29QQoUBi66xm2f\\\").capture({amount:500})\",\n      \"language\": \"ruby\"\n    },\n    {\n      \"code\": \"var request = require('request');\\n\\nrequest({\\n  method: 'POST',\\n  url: 'https://rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a@api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/capture',\\n  form: {\\n    amount: 500\\n  }\\n}, function (error, response, body) {\\n  console.log('Status:', response.statusCode);\\n  console.log('Headers:', JSON.stringify(response.headers));\\n  console.log('Response:', body);\\n});\",\n      \"language\": \"javascript\"\n    },\n    {\n      \"code\": \"RazorpayClient client = new RazorpayClient(\\\"<api-key>\\\", \\\"<api-secret>\\\");\\nPayment payment = client.Payment.Fetch(paymentId);\\n\\nDictionary<string, object> options = new Dictionary<string, object>();\\noptions.Add(\\\"amount\\\", \\\"<amount>\\\");\\n\\nPayment paymentCaptured = payment.Capture(options);\",\n      \"language\": \"csharp\"\n    },\n    {\n      \"code\": \"import org.json.JSONObject;\\nimport com.razorpay.Payment;\\nimport com.razorpay.RazorpayClient;\\nimport com.razorpay.RazorpayException;\\n\\nRazorpayClient razorpay = new RazorpayClient(\\\"<api_key>\\\", \\\"<api_secret>\\\");\\ntry {\\n\\tJSONObject captureRequest = new JSONObject();\\n\\tcaptureRequest.put(\\\"amount\\\", amount); // Amount should be in paise \\n\\tPayment payment = razorpay.Payments.capture(\\\"<payment_id>\\\", captureRequest);\\n} catch (RazorpayException e) {\\n\\t// Handle Exception \\n\\tSystem.out.println(e.getMessage());\\n}\",\n      \"language\": \"java\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Check the status of payment has been successfully set to captured after the request and there is no error in response.\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Attempting to capture a payment whose status is not authorized will produce an error.\",\n  \"body\": \"\"\n}\n[/block]","type":"basic","editedParams2":true,"isReference":true,"title":"/payments/:id/capture","childrenPages":[]}

/payments/:id/capture

Capture a payment

[block:callout] { "type": "info", "body": "", "title": "Take care while specifying amount param, it should be specified in paise and should be equal to authorized amount." } [/block] This endpoint captures a specific payment. Capture is done after a payment status has been successfully set as “authorized”. After capture the funds are transferred to your account in T + 3 days. The amount sent in the capture request must come from a verified source and be the amount that you are expecting to receive. Please do not accept the capture amount from the user, for security reasons. [block:code] { "codes": [ { "code": "curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\\n -X POST \\\n --data \"amount=500\" \\\n https://api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/capture", "language": "curl" }, { "code": "<?php\n\nuse Razorpay\\Api\\Api;\n\n$api = new Api('rzp_test_26ccbdbfe0e84b', '69b2e24411e384f91213f22a');\n\n$payment = $api->payment->fetch('pay_29QQoUBi66xm2f');\n$payment->capture(array('amount' => 500));\n\n?>", "language": "php" }, { "code": "# do easy_install razorpay or\n# pip install razorpay\n\nimport razorpay\n\nclient = razorpay.Client(auth=(\"<YOUR_API_KEY>\", \"<YOUR_API_SECRET>\"))\n\npayment_id = \"<PAYMENT_ID>\"\n\npayment_amount = <PAYMENT AMOUNT>\n\nresp = client.payment.capture(payment_id, payment_amount)", "language": "python" }, { "code": "require 'razorpay'\n\nRazorpay.setup(\"rzp_test_26ccbdbfe0e84b\", \"69b2e24411e384f91213f22a\")\n\nRazorpay::Payment.fetch(\"pay_29QQoUBi66xm2f\").capture({amount:500})", "language": "ruby" }, { "code": "var request = require('request');\n\nrequest({\n method: 'POST',\n url: 'https://rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a@api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/capture',\n form: {\n amount: 500\n }\n}, function (error, response, body) {\n console.log('Status:', response.statusCode);\n console.log('Headers:', JSON.stringify(response.headers));\n console.log('Response:', body);\n});", "language": "javascript" }, { "code": "RazorpayClient client = new RazorpayClient(\"<api-key>\", \"<api-secret>\");\nPayment payment = client.Payment.Fetch(paymentId);\n\nDictionary<string, object> options = new Dictionary<string, object>();\noptions.Add(\"amount\", \"<amount>\");\n\nPayment paymentCaptured = payment.Capture(options);", "language": "csharp" }, { "code": "import org.json.JSONObject;\nimport com.razorpay.Payment;\nimport com.razorpay.RazorpayClient;\nimport com.razorpay.RazorpayException;\n\nRazorpayClient razorpay = new RazorpayClient(\"<api_key>\", \"<api_secret>\");\ntry {\n\tJSONObject captureRequest = new JSONObject();\n\tcaptureRequest.put(\"amount\", amount); // Amount should be in paise \n\tPayment payment = razorpay.Payments.capture(\"<payment_id>\", captureRequest);\n} catch (RazorpayException e) {\n\t// Handle Exception \n\tSystem.out.println(e.getMessage());\n}", "language": "java" } ], "sidebar": true } [/block] [block:callout] { "type": "info", "title": "Check the status of payment has been successfully set to captured after the request and there is no error in response." } [/block] [block:callout] { "type": "danger", "title": "Attempting to capture a payment whose status is not authorized will produce an error.", "body": "" } [/block]
[block:callout] { "type": "info", "body": "", "title": "Take care while specifying amount param, it should be specified in paise and should be equal to authorized amount." } [/block] This endpoint captures a specific payment. Capture is done after a payment status has been successfully set as “authorized”. After capture the funds are transferred to your account in T + 3 days. The amount sent in the capture request must come from a verified source and be the amount that you are expecting to receive. Please do not accept the capture amount from the user, for security reasons. [block:code] { "codes": [ { "code": "curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\\n -X POST \\\n --data \"amount=500\" \\\n https://api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/capture", "language": "curl" }, { "code": "<?php\n\nuse Razorpay\\Api\\Api;\n\n$api = new Api('rzp_test_26ccbdbfe0e84b', '69b2e24411e384f91213f22a');\n\n$payment = $api->payment->fetch('pay_29QQoUBi66xm2f');\n$payment->capture(array('amount' => 500));\n\n?>", "language": "php" }, { "code": "# do easy_install razorpay or\n# pip install razorpay\n\nimport razorpay\n\nclient = razorpay.Client(auth=(\"<YOUR_API_KEY>\", \"<YOUR_API_SECRET>\"))\n\npayment_id = \"<PAYMENT_ID>\"\n\npayment_amount = <PAYMENT AMOUNT>\n\nresp = client.payment.capture(payment_id, payment_amount)", "language": "python" }, { "code": "require 'razorpay'\n\nRazorpay.setup(\"rzp_test_26ccbdbfe0e84b\", \"69b2e24411e384f91213f22a\")\n\nRazorpay::Payment.fetch(\"pay_29QQoUBi66xm2f\").capture({amount:500})", "language": "ruby" }, { "code": "var request = require('request');\n\nrequest({\n method: 'POST',\n url: 'https://rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a@api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/capture',\n form: {\n amount: 500\n }\n}, function (error, response, body) {\n console.log('Status:', response.statusCode);\n console.log('Headers:', JSON.stringify(response.headers));\n console.log('Response:', body);\n});", "language": "javascript" }, { "code": "RazorpayClient client = new RazorpayClient(\"<api-key>\", \"<api-secret>\");\nPayment payment = client.Payment.Fetch(paymentId);\n\nDictionary<string, object> options = new Dictionary<string, object>();\noptions.Add(\"amount\", \"<amount>\");\n\nPayment paymentCaptured = payment.Capture(options);", "language": "csharp" }, { "code": "import org.json.JSONObject;\nimport com.razorpay.Payment;\nimport com.razorpay.RazorpayClient;\nimport com.razorpay.RazorpayException;\n\nRazorpayClient razorpay = new RazorpayClient(\"<api_key>\", \"<api_secret>\");\ntry {\n\tJSONObject captureRequest = new JSONObject();\n\tcaptureRequest.put(\"amount\", amount); // Amount should be in paise \n\tPayment payment = razorpay.Payments.capture(\"<payment_id>\", captureRequest);\n} catch (RazorpayException e) {\n\t// Handle Exception \n\tSystem.out.println(e.getMessage());\n}", "language": "java" } ], "sidebar": true } [/block] [block:callout] { "type": "info", "title": "Check the status of payment has been successfully set to captured after the request and there is no error in response." } [/block] [block:callout] { "type": "danger", "title": "Attempting to capture a payment whose status is not authorized will produce an error.", "body": "" } [/block]
{"_id":"54dec8b7c2b4b70d009c3f1c","category":"54dec8b7c2b4b70d009c3f11","hidden":false,"next":{"pages":[],"description":""},"project":"54c83b5aab706219009e067b","user":"54c83ac1ab706219009e067a","updates":["58f74f78f2adce190000bf14","5b0251f922f38b00038b6d3f"],"version":"54dec8b6c2b4b70d009c3f0f","__v":7,"api":{"method":"post","params":[{"_id":"54de08cac4a3570d009d4973","ref":"","in":"path","required":true,"desc":"The ID of the payment to refund.","default":"","type":"string","name":"id"},{"_id":"54de08cac4a3570d009d4972","ref":"","in":"body","required":false,"desc":"Amount to be refunded, whole amount is refunded if not specified.","default":"","type":"string","name":"amount"},{"_id":"5731e3943cc3840e0088a192","ref":"","in":"body","required":false,"desc":"Array of notes fields. This is validated the same way as the payment.notes field","default":"[]","type":"array_string","name":"notes"}],"results":{"codes":[{"name":"","code":"{\n  \"id\": \"rfnd_5UXHCzSiC02RBz\",\n  \"entity\": \"refund\",\n  \"amount\": 100,\n  \"currency\": \"INR\",\n  \"payment_id\": \"pay_5UWttxtCjkrldV\",\n  \"notes\": {},\n  \"created_at\": 1462887226\n}","language":"json","status":200},{"name":"","code":"{\n   \"error\": {\n      \"code\": \"BAD_REQUEST_ERROR\",\n      \"description\": \"The amount is invalid\",\n      \"field\": \"amount\"\n   }\n}","language":"json","status":400},{"status":401,"language":"json","code":"{\n    \"error\": {\n        \"code\": \"BAD_REQUEST_ERROR\",\n        \"description\": \"The api key provided is invalid\"\n    }\n}"}]},"settings":"","url":"/payments/:id/refund","auth":"required","examples":{"codes":[]}},"editedParams2":true,"link_external":false,"link_url":"","title":"/payments/:id/refund","editedParams":true,"githubsync":"","parentDoc":null,"slug":"v1paymentsidrefund","sync_unique":"","type":"post","body":"This endpoint refunds a specific payment. Refund is done only after a payment has been successfully captured.\n\nAfter a refund is initiated, it is completed in 5-7 working days. The transaction fee and GST charged on successful transactions will not be reversed in case of refunds.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\\\\\n   -X POST \\\\ \\n   https://api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/refund\",\n      \"language\": \"curl\"\n    },\n    {\n      \"code\": \"<?php\\n\\nuse Razorpay\\\\Api\\\\Api;\\n\\n$api = new Api('rzp_test_26ccbdbfe0e84b', '69b2e24411e384f91213f22a');\\n\\n$payment = $api->payment->fetch('pay_29QQoUBi66xm2f');\\n$refund = $payment->refund();\\n\\n//$refund = $payment->refund(array('amount' => 100)); for partial refund\\n\\n?>\",\n      \"language\": \"php\"\n    },\n    {\n      \"code\": \"# do easy_install razorpay or\\n#    pip install razorpay\\n\\nimport razorpay\\n\\nclient = razorpay.Client(auth=(\\\"<YOUR_API_KEY>\\\", \\\"<YOUR_API_SECRET>\\\"))\\n\\npayment_id = \\\"<PAYMENT_ID>\\\"\\n\\npayment_amount = <payment_amount>\\n\\nresp = client.payment.refund(payment_id, payment_amount)\\n\\n#Refund with Extra Parameters\\n\\nnotes = {'key': 'value'}\\n\\nresp = client.payment.refund(payment_id, payment_amount, notes=notes)\\n\",\n      \"language\": \"python\"\n    },\n    {\n      \"code\": \"require 'razorpay'\\n\\nRazorpay.setup(\\\"rzp_test_26ccbdbfe0e84b\\\", \\\"69b2e24411e384f91213f22a\\\")\\n\\nRazorpay::Payment.fetch(\\\"pay_29QQoUBi66xm2f\\\").refund()\",\n      \"language\": \"ruby\"\n    },\n    {\n      \"code\": \"var request = require('request');\\n\\nrequest({\\n  method: 'POST',\\n  url: 'https://rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a@api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/refund',\\n}, function (error, response, body) {\\n  console.log('Status:', response.statusCode);\\n  console.log('Headers:', JSON.stringify(response.headers));\\n  console.log('Response:', body);\\n});\",\n      \"language\": \"javascript\",\n      \"name\": \"Node\"\n    },\n    {\n      \"code\": \"//intialze the sdk client\\nRazorpayClient client = new RazorpayClient(\\\"<api-key>\\\", \\\"<api-secret>\\\");\\n\\n// payment to be refunded, payment must be a captured payment\\nPayment payment = client.Payment.Fetch(paymentId);\\n\\n//Full Refund\\nRefund refund = payment.Refund();\\n\\n//Partial Refund\\nDictionary<string, object> data = new Dictionary<string, object>();\\ndata.Add(\\\"amount\\\", \\\"100\\\");\\nRefund refund = payment.Refund(data);\",\n      \"language\": \"csharp\"\n    },\n    {\n      \"code\": \"import org.json.JSONObject;\\nimport com.razorpay.Payment;\\nimport com.razorpay.Refund;\\nimport com.razorpay.RazorpayClient;\\nimport com.razorpay.RazorpayException;\\n\\nRazorpayClient razorpay = new RazorpayClient(\\\"<api_key>\\\", \\\"<api_secret>\\\");\\ntry {\\n\\t// Full Refund\\t\\n\\tRefund refund = razorpay.Payments.refund(\\\"<payment_id>\\\");\\n\\n\\t// Partial Refund\\n\\tJSONObject refundRequest = new JSONObject();\\n\\trefundRequest.put(\\\"amount\\\", amount); // Amount should be in paise\\n\\tRefund refund = razorpay.Payments.refund(\\\"<payment_id>\\\", refundRequest);\\n} catch (RazorpayException e) {\\n\\t// Handle Exception\\n\\tSystem.out.println(e.getMessage());\\n}\",\n      \"language\": \"java\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Check that the refund object returned after the request has the correct amount and no error is returned.\",\n  \"body\": \"\"\n}\n[/block]","createdAt":"2015-02-13T14:21:32.434Z","excerpt":"Refund a payment","isReference":true,"order":3,"childrenPages":[]}

post/payments/:id/refund

Refund a payment

Path Params

id:
required
string
The ID of the payment to refund.

Body Params

amount:
string
Amount to be refunded, whole amount is refunded if not specified.
notes:
array of strings[]
Array of notes fields. This is validated the same way as the payment.notes field
This endpoint refunds a specific payment. Refund is done only after a payment has been successfully captured. After a refund is initiated, it is completed in 5-7 working days. The transaction fee and GST charged on successful transactions will not be reversed in case of refunds. [block:code] { "codes": [ { "code": "curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\\n -X POST \\ \n https://api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/refund", "language": "curl" }, { "code": "<?php\n\nuse Razorpay\\Api\\Api;\n\n$api = new Api('rzp_test_26ccbdbfe0e84b', '69b2e24411e384f91213f22a');\n\n$payment = $api->payment->fetch('pay_29QQoUBi66xm2f');\n$refund = $payment->refund();\n\n//$refund = $payment->refund(array('amount' => 100)); for partial refund\n\n?>", "language": "php" }, { "code": "# do easy_install razorpay or\n# pip install razorpay\n\nimport razorpay\n\nclient = razorpay.Client(auth=(\"<YOUR_API_KEY>\", \"<YOUR_API_SECRET>\"))\n\npayment_id = \"<PAYMENT_ID>\"\n\npayment_amount = <payment_amount>\n\nresp = client.payment.refund(payment_id, payment_amount)\n\n#Refund with Extra Parameters\n\nnotes = {'key': 'value'}\n\nresp = client.payment.refund(payment_id, payment_amount, notes=notes)\n", "language": "python" }, { "code": "require 'razorpay'\n\nRazorpay.setup(\"rzp_test_26ccbdbfe0e84b\", \"69b2e24411e384f91213f22a\")\n\nRazorpay::Payment.fetch(\"pay_29QQoUBi66xm2f\").refund()", "language": "ruby" }, { "code": "var request = require('request');\n\nrequest({\n method: 'POST',\n url: 'https://rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a@api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/refund',\n}, function (error, response, body) {\n console.log('Status:', response.statusCode);\n console.log('Headers:', JSON.stringify(response.headers));\n console.log('Response:', body);\n});", "language": "javascript", "name": "Node" }, { "code": "//intialze the sdk client\nRazorpayClient client = new RazorpayClient(\"<api-key>\", \"<api-secret>\");\n\n// payment to be refunded, payment must be a captured payment\nPayment payment = client.Payment.Fetch(paymentId);\n\n//Full Refund\nRefund refund = payment.Refund();\n\n//Partial Refund\nDictionary<string, object> data = new Dictionary<string, object>();\ndata.Add(\"amount\", \"100\");\nRefund refund = payment.Refund(data);", "language": "csharp" }, { "code": "import org.json.JSONObject;\nimport com.razorpay.Payment;\nimport com.razorpay.Refund;\nimport com.razorpay.RazorpayClient;\nimport com.razorpay.RazorpayException;\n\nRazorpayClient razorpay = new RazorpayClient(\"<api_key>\", \"<api_secret>\");\ntry {\n\t// Full Refund\t\n\tRefund refund = razorpay.Payments.refund(\"<payment_id>\");\n\n\t// Partial Refund\n\tJSONObject refundRequest = new JSONObject();\n\trefundRequest.put(\"amount\", amount); // Amount should be in paise\n\tRefund refund = razorpay.Payments.refund(\"<payment_id>\", refundRequest);\n} catch (RazorpayException e) {\n\t// Handle Exception\n\tSystem.out.println(e.getMessage());\n}", "language": "java" } ], "sidebar": true } [/block] [block:callout] { "type": "info", "title": "Check that the refund object returned after the request has the correct amount and no error is returned.", "body": "" } [/block]

Definition

{{ api_url }}{{ page_api_url }}

Result Format



This endpoint refunds a specific payment. Refund is done only after a payment has been successfully captured. After a refund is initiated, it is completed in 5-7 working days. The transaction fee and GST charged on successful transactions will not be reversed in case of refunds. [block:code] { "codes": [ { "code": "curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\\n -X POST \\ \n https://api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/refund", "language": "curl" }, { "code": "<?php\n\nuse Razorpay\\Api\\Api;\n\n$api = new Api('rzp_test_26ccbdbfe0e84b', '69b2e24411e384f91213f22a');\n\n$payment = $api->payment->fetch('pay_29QQoUBi66xm2f');\n$refund = $payment->refund();\n\n//$refund = $payment->refund(array('amount' => 100)); for partial refund\n\n?>", "language": "php" }, { "code": "# do easy_install razorpay or\n# pip install razorpay\n\nimport razorpay\n\nclient = razorpay.Client(auth=(\"<YOUR_API_KEY>\", \"<YOUR_API_SECRET>\"))\n\npayment_id = \"<PAYMENT_ID>\"\n\npayment_amount = <payment_amount>\n\nresp = client.payment.refund(payment_id, payment_amount)\n\n#Refund with Extra Parameters\n\nnotes = {'key': 'value'}\n\nresp = client.payment.refund(payment_id, payment_amount, notes=notes)\n", "language": "python" }, { "code": "require 'razorpay'\n\nRazorpay.setup(\"rzp_test_26ccbdbfe0e84b\", \"69b2e24411e384f91213f22a\")\n\nRazorpay::Payment.fetch(\"pay_29QQoUBi66xm2f\").refund()", "language": "ruby" }, { "code": "var request = require('request');\n\nrequest({\n method: 'POST',\n url: 'https://rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a@api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/refund',\n}, function (error, response, body) {\n console.log('Status:', response.statusCode);\n console.log('Headers:', JSON.stringify(response.headers));\n console.log('Response:', body);\n});", "language": "javascript", "name": "Node" }, { "code": "//intialze the sdk client\nRazorpayClient client = new RazorpayClient(\"<api-key>\", \"<api-secret>\");\n\n// payment to be refunded, payment must be a captured payment\nPayment payment = client.Payment.Fetch(paymentId);\n\n//Full Refund\nRefund refund = payment.Refund();\n\n//Partial Refund\nDictionary<string, object> data = new Dictionary<string, object>();\ndata.Add(\"amount\", \"100\");\nRefund refund = payment.Refund(data);", "language": "csharp" }, { "code": "import org.json.JSONObject;\nimport com.razorpay.Payment;\nimport com.razorpay.Refund;\nimport com.razorpay.RazorpayClient;\nimport com.razorpay.RazorpayException;\n\nRazorpayClient razorpay = new RazorpayClient(\"<api_key>\", \"<api_secret>\");\ntry {\n\t// Full Refund\t\n\tRefund refund = razorpay.Payments.refund(\"<payment_id>\");\n\n\t// Partial Refund\n\tJSONObject refundRequest = new JSONObject();\n\trefundRequest.put(\"amount\", amount); // Amount should be in paise\n\tRefund refund = razorpay.Payments.refund(\"<payment_id>\", refundRequest);\n} catch (RazorpayException e) {\n\t// Handle Exception\n\tSystem.out.println(e.getMessage());\n}", "language": "java" } ], "sidebar": true } [/block] [block:callout] { "type": "info", "title": "Check that the refund object returned after the request has the correct amount and no error is returned.", "body": "" } [/block]
{"_id":"54dec8b7c2b4b70d009c3f1d","__v":2,"api":{"auth":"required","examples":{"codes":[]},"method":"get","params":[{"default":"","desc":"The payment id whose refunds are to be fetched","name":"id","ref":"","required":true,"type":"string","in":"path","_id":"54de09dd3a91410d001b16b6"},{"desc":"The timestamp in seconds after which the refunds were created","in":"query","name":"from","ref":"","required":false,"type":"timestamp","_id":"54de09dd3a91410d001b16b5","default":""},{"name":"to","ref":"","required":false,"type":"timestamp","_id":"54de09dd3a91410d001b16b4","default":"","desc":"The timestamp in seconds before which the refunds were created","in":"query"},{"_id":"54de09dd3a91410d001b16b3","default":"10","desc":"The number of refunds to fetch","name":"count","ref":"","required":false,"type":"int","in":"query"},{"in":"query","_id":"54de09dd3a91410d001b16b2","default":"0","desc":"The number of refunds to be skipped","name":"skip","ref":"","required":false,"type":"int"}],"results":{"codes":[{"status":200,"name":"","code":"{\n  \"count\": 2,\n  \"entity\": \"collection\",\n  \"items\": [\n    {\n      \"id\": \"rfnd_AABBdHIieexn5c\",\n      \"entity\": \"refund\",\n      \"amount\": 100,\n      \"currency\": \"INR\",\n      \"payment_id\": \"pay_29QQoUBi66xm2f\",\n      \"notes\": {},\n      \"created_at\": 1500826750\n    },\n    {\n      \"id\": \"rfnd_19btGlBig6xZ2f\",\n      \"entity\": \"refund\",\n      \"amount\": 100,\n      \"currency\": \"INR\",\n      \"payment_id\": \"pay_29QQoUBi66xm2f\",\n      \"notes\": {},\n      \"created_at\": 1500826750\n    }\n  ]\n}","language":"json"},{"code":"{\n   \"error\": {\n      \"code\": \"BAD_REQUEST_ERROR\",\n      \"description\": \"The paymentid was not found\"\n   }\n}","language":"json","status":400,"name":""},{"status":401,"language":"json","code":"{\n    \"error\": {\n        \"code\": \"BAD_REQUEST_ERROR\",\n        \"description\": \"The api key provided is invalid\"\n    }\n}"}]},"settings":"","url":"/payments/:id/refunds"},"editedParams":true,"isReference":true,"link_external":false,"sync_unique":"","project":"54c83b5aab706219009e067b","slug":"v1paymentspaymentidrefunds","editedParams2":true,"excerpt":"Retrieve multiple refunds of a payment","hidden":false,"link_url":"","order":4,"parentDoc":null,"body":"This endpoint is used for retrieving list of refunds of a payment based on optional parameters. By default only last 10 are returned. You can use count and skip parameters to change that behavior.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\\\ \\nhttps://api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/refunds?created=1500826750\",\n      \"language\": \"curl\"\n    },\n    {\n      \"code\": \"<?php\\n\\nuse Razorpay\\\\Api\\\\Api;\\n\\n$api = new Api('rzp_test_26ccbdbfe0e84b', '69b2e24411e384f91213f22a');\\n\\n$params = array(\\n    'from'  => 1500826740,\\n    'to'    => 1500826760,\\n    'count' => 2,\\n    'skip'  => 1\\n);\\n\\n$payments = $api->payment->fetch('pay_29QQoUBi66xm2f')->refunds()->all($params);\\n\\n?>\",\n      \"language\": \"php\"\n    },\n    {\n      \"code\": \"# do easy_install razorpay or\\n#    pip install razorpay\\n\\nimport razorpay\\n\\nclient = razorpay.Client(auth=(\\\"<YOUR_API_KEY>\\\", \\\"<YOUR_API_SECRET>\\\"))\\n\\npayment_id = \\\"<PAYMENT_ID>\\\"\\n\\nresp = client.refund.fetch_all(payment_id)\",\n      \"language\": \"python\"\n    },\n    {\n      \"code\": \"require 'razorpay'\\n\\nRazorpay.setup(\\\"rzp_test_26ccbdbfe0e84b\\\", \\\"69b2e24411e384f91213f22a\\\")\\n\\nRazorpay::Payment.fetch(\\\"pay_29QQoUBi66xm2f\\\").refunds.all({from:1500826740,to:1500826760,count:2,skip:1})\",\n      \"language\": \"ruby\"\n    },\n    {\n      \"code\": \"RazorpayClient client = new RazorpayClient(\\\"<api-key>\\\", \\\"<api-secret>\\\");\\nPayment payment = client.Payment.Fetch(paymentId);\\n\\nList<Refund> refunds = payment.Refunds.All();\",\n      \"language\": \"csharp\"\n    },\n    {\n      \"code\": \"import java.util.List;\\nimport com.razorpay.Refund;\\nimport com.razorpay.RazorpayClient;\\nimport com.razorpay.RazorpayException;\\n\\nRazorpayClient razorpay = new RazorpayClient(\\\"<api_key>\\\", \\\"<api_secret>\\\");\\ntry {\\n\\tList<Refund> refunds = razorpay.Payments.fetchAllRefunds(\\\"<payment_id>\\\");\\n} catch (RazorpayException e) {\\n\\t// Handle Exception\\n\\tSystem.out.println(e.getMessage());\\n}\",\n      \"language\": \"java\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","category":"54dec8b7c2b4b70d009c3f11","createdAt":"2015-02-13T14:25:10.509Z","title":"/payments/:id/refunds","githubsync":"","next":{"description":"","pages":[]},"type":"get","updates":["5b025225d067c300036b53e4"],"user":"54c83ac1ab706219009e067a","version":"54dec8b6c2b4b70d009c3f0f","childrenPages":[]}

get/payments/:id/refunds

Retrieve multiple refunds of a payment

Path Params

id:
required
string
The payment id whose refunds are to be fetched

Query Params

from:
timestamp
The timestamp in seconds after which the refunds were created
to:
timestamp
The timestamp in seconds before which the refunds were created
count:
integer10
The number of refunds to fetch
skip:
integer0
The number of refunds to be skipped
This endpoint is used for retrieving list of refunds of a payment based on optional parameters. By default only last 10 are returned. You can use count and skip parameters to change that behavior. [block:code] { "codes": [ { "code": "curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\ \nhttps://api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/refunds?created=1500826750", "language": "curl" }, { "code": "<?php\n\nuse Razorpay\\Api\\Api;\n\n$api = new Api('rzp_test_26ccbdbfe0e84b', '69b2e24411e384f91213f22a');\n\n$params = array(\n 'from' => 1500826740,\n 'to' => 1500826760,\n 'count' => 2,\n 'skip' => 1\n);\n\n$payments = $api->payment->fetch('pay_29QQoUBi66xm2f')->refunds()->all($params);\n\n?>", "language": "php" }, { "code": "# do easy_install razorpay or\n# pip install razorpay\n\nimport razorpay\n\nclient = razorpay.Client(auth=(\"<YOUR_API_KEY>\", \"<YOUR_API_SECRET>\"))\n\npayment_id = \"<PAYMENT_ID>\"\n\nresp = client.refund.fetch_all(payment_id)", "language": "python" }, { "code": "require 'razorpay'\n\nRazorpay.setup(\"rzp_test_26ccbdbfe0e84b\", \"69b2e24411e384f91213f22a\")\n\nRazorpay::Payment.fetch(\"pay_29QQoUBi66xm2f\").refunds.all({from:1500826740,to:1500826760,count:2,skip:1})", "language": "ruby" }, { "code": "RazorpayClient client = new RazorpayClient(\"<api-key>\", \"<api-secret>\");\nPayment payment = client.Payment.Fetch(paymentId);\n\nList<Refund> refunds = payment.Refunds.All();", "language": "csharp" }, { "code": "import java.util.List;\nimport com.razorpay.Refund;\nimport com.razorpay.RazorpayClient;\nimport com.razorpay.RazorpayException;\n\nRazorpayClient razorpay = new RazorpayClient(\"<api_key>\", \"<api_secret>\");\ntry {\n\tList<Refund> refunds = razorpay.Payments.fetchAllRefunds(\"<payment_id>\");\n} catch (RazorpayException e) {\n\t// Handle Exception\n\tSystem.out.println(e.getMessage());\n}", "language": "java" } ], "sidebar": true } [/block]

Definition

{{ api_url }}{{ page_api_url }}

Result Format



This endpoint is used for retrieving list of refunds of a payment based on optional parameters. By default only last 10 are returned. You can use count and skip parameters to change that behavior. [block:code] { "codes": [ { "code": "curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\ \nhttps://api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/refunds?created=1500826750", "language": "curl" }, { "code": "<?php\n\nuse Razorpay\\Api\\Api;\n\n$api = new Api('rzp_test_26ccbdbfe0e84b', '69b2e24411e384f91213f22a');\n\n$params = array(\n 'from' => 1500826740,\n 'to' => 1500826760,\n 'count' => 2,\n 'skip' => 1\n);\n\n$payments = $api->payment->fetch('pay_29QQoUBi66xm2f')->refunds()->all($params);\n\n?>", "language": "php" }, { "code": "# do easy_install razorpay or\n# pip install razorpay\n\nimport razorpay\n\nclient = razorpay.Client(auth=(\"<YOUR_API_KEY>\", \"<YOUR_API_SECRET>\"))\n\npayment_id = \"<PAYMENT_ID>\"\n\nresp = client.refund.fetch_all(payment_id)", "language": "python" }, { "code": "require 'razorpay'\n\nRazorpay.setup(\"rzp_test_26ccbdbfe0e84b\", \"69b2e24411e384f91213f22a\")\n\nRazorpay::Payment.fetch(\"pay_29QQoUBi66xm2f\").refunds.all({from:1500826740,to:1500826760,count:2,skip:1})", "language": "ruby" }, { "code": "RazorpayClient client = new RazorpayClient(\"<api-key>\", \"<api-secret>\");\nPayment payment = client.Payment.Fetch(paymentId);\n\nList<Refund> refunds = payment.Refunds.All();", "language": "csharp" }, { "code": "import java.util.List;\nimport com.razorpay.Refund;\nimport com.razorpay.RazorpayClient;\nimport com.razorpay.RazorpayException;\n\nRazorpayClient razorpay = new RazorpayClient(\"<api_key>\", \"<api_secret>\");\ntry {\n\tList<Refund> refunds = razorpay.Payments.fetchAllRefunds(\"<payment_id>\");\n} catch (RazorpayException e) {\n\t// Handle Exception\n\tSystem.out.println(e.getMessage());\n}", "language": "java" } ], "sidebar": true } [/block]
{"_id":"54dec8b7c2b4b70d009c3f1e","editedParams2":true,"hidden":false,"type":"get","user":"54c83ac1ab706219009e067a","body":"This endpoint is used for retrieving a specific refund of a specific payment entity by its id.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\\\\\nhttps://api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/refunds/rfnd_AABBdHIieexn5c\",\n      \"language\": \"curl\"\n    },\n    {\n      \"code\": \"<?php\\n\\nuse Razorpay\\\\Api\\\\Api;\\n\\n$api = new Api('rzp_test_26ccbdbfe0e84b', '69b2e24411e384f91213f22a');\\n\\n$payment = $api->payment->fetch('pay_29QQoUBi66xm2f')->refunds()->fetch('rfnd_AABBdHIieexn5c');\\n\\n?>\",\n      \"language\": \"php\"\n    },\n    {\n      \"code\": \"# do easy_install razorpay or\\n#    pip install razorpay\\n\\nimport razorpay\\n\\nrazorpay.Client(auth=(\\\"<YOUR_API_KEY>\\\", \\\"<YOUR_API_SECRET>\\\"))\\n\\npayment_id = \\\"<PAYMENT_ID>\\\"\\n\\nrefund_id = \\\"<REFUND_ID>\\\"\\n\\nresp = client.refund.fetch(payment_id, refund_id)\",\n      \"language\": \"python\"\n    },\n    {\n      \"code\": \"rrequire 'razorpay'\\n\\nRazorpay.setup(\\\"rzp_test_26ccbdbfe0e84b\\\", \\\"69b2e24411e384f91213f22a\\\")\\n\\nRazorpay::Payment.fetch(\\\"pay_29QQoUBi66xm2f\\\").refunds.fetch(\\\"rfnd_AABBdHIieexn5c\\\")\",\n      \"language\": \"ruby\"\n    },\n    {\n      \"code\": \"var request = require('request');\\n\\nrequest('rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a@api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/refunds?from=1500826740&to=1500826760&count=2&skip=1', function (error, response, body) {\\n\\nconsole.log('Response:', body);\\n});\",\n      \"language\": \"javascript\",\n      \"name\": \"Node\"\n    },\n    {\n      \"code\": \"RazorpayClient client = new RazorpayClient(\\\"<api-key>\\\", \\\"<api-secret>\\\");\\nPayment payment = client.Payment.Fetch(paymentId);\\n\\nRefund refund = payment.Refunds.Fetch(refundId);\",\n      \"language\": \"csharp\"\n    },\n    {\n      \"code\": \"import com.razorpay.Refund;\\nimport com.razorpay.RazorpayClient;\\nimport com.razorpay.RazorpayException;\\n\\nRazorpayClient razorpay = new RazorpayClient(\\\"<api_key>\\\", \\\"<api_secret>\\\");\\ntry {\\n\\tRefund refund = razorpay.Payments.fetchRefund(\\\"<payment_id>\\\", \\\"<refund_id>\\\");\\n} catch (RazorpayException e) {\\n\\t// Handle Exception\\n\\tSystem.out.println(e.getMessage());\\n}\",\n      \"language\": \"java\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]","createdAt":"2015-02-13T14:30:26.211Z","githubsync":"","isReference":true,"next":{"description":"","pages":[]},"sync_unique":"","updates":["56cabd4f6b58fb0b00c6d32f","5b1647815c9a620003d4b1ab"],"api":{"auth":"required","examples":{"codes":[{"name":null,"code":"curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\\nhttps://api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/refunds/rfnd_AABBdHIieexn5c","language":"curl"},{"language":"php","code":"<?php\n\nuse Razorpay\\Api\\Api;\n\n$api = new Api('rzp_test_26ccbdbfe0e84b', '69b2e24411e384f91213f22a');\n\n$payment = $api->payment->fetch('pay_29QQoUBi66xm2f')->refunds()->fetch('rfnd_AABBdHIieexn5c');\n\n?>"},{"code":"# do easy_install razorpay or\n#    pip install razorpay\n\nimport razorpay\n\nrazorpay.Client(auth=(\"<YOUR_API_KEY>\", \"<YOUR_API_SECRET>\"))\n\npayment_id = \"<PAYMENT_ID>\"\n\nrefund_id = \"<REFUND_ID>\"\n\nresp = client.refund.fetch(payment_id, refund_id)","language":"python"},{"code":"rrequire 'razorpay'\n\nRazorpay.setup(\"rzp_test_26ccbdbfe0e84b\", \"69b2e24411e384f91213f22a\")\n\nRazorpay::Payment.fetch(\"pay_29QQoUBi66xm2f\").refunds.fetch(\"rfnd_AABBdHIieexn5c\")","language":"ruby"},{"code":"var request = require('request');\n\nrequest('rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a@api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/refunds?from=1500826740&to=1500826760&count=2&skip=1', function (error, response, body) {\n\nconsole.log('Response:', body);\n});","language":"javascript","name":"Node"},{"language":"csharp","code":"RazorpayClient client = new RazorpayClient(\"<api-key>\", \"<api-secret>\");\nPayment payment = client.Payment.Fetch(paymentId);\n\nRefund refund = payment.Refunds.Fetch(refundId);"},{"code":"import com.razorpay.Refund;\nimport com.razorpay.RazorpayClient;\nimport com.razorpay.RazorpayException;\n\nRazorpayClient razorpay = new RazorpayClient(\"<api_key>\", \"<api_secret>\");\ntry {\n\tRefund refund = razorpay.Payments.fetchRefund(\"<payment_id>\", \"<refund_id>\");\n} catch (RazorpayException e) {\n\t// Handle Exception\n\tSystem.out.println(e.getMessage());\n}","language":"java"}]},"method":"get","params":[{"desc":"The id of the payment whose refund is to be retrieved","name":"payment_id","ref":"","required":true,"type":"string","in":"path","_id":"54de0a82c48ad90d00c1876a","default":""},{"name":"refund_id","ref":"","required":true,"type":"string","in":"path","_id":"54de0a82c48ad90d00c18769","default":"","desc":"The id of the refund to be retrieved"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"id\": \"rfnd_AABBdHIieexn5c\",\n  \"entity\": \"refund\",\n  \"amount\": 100,\n  \"currency\": \"INR\",\n  \"payment_id\": \"pay_29QQoUBi66xm2f\",\n  \"notes\": {},\n  \"created_at\": 1500826750\n}","name":""},{"status":400,"language":"json","code":"{\n   \"error\": {\n      \"code\": \"BAD_REQUEST_ERROR\",\n      \"description\": \"The payment id was not found\"\n   }\n}","name":""},{"status":401,"language":"json","code":"{\n    \"error\": {\n        \"code\": \"BAD_REQUEST_ERROR\",\n        \"description\": \"The api key provided is invalid\"\n    }\n}"}]},"settings":"","url":"/payments/:payment_id/refunds/:refund_id"},"editedParams":true,"order":5,"project":"54c83b5aab706219009e067b","title":"/payments/:paymentid/refunds/:refundid","excerpt":"Retrieve a refund of payment by id","link_external":false,"link_url":"","parentDoc":null,"slug":"v1paymentspaymentidrefundsrefundid","version":"54dec8b6c2b4b70d009c3f0f","__v":3,"category":"54dec8b7c2b4b70d009c3f11","childrenPages":[]}

get/payments/:paymentid/refunds/:refundid

Retrieve a refund of payment by id

Path Params

payment_id:
required
string
The id of the payment whose refund is to be retrieved
refund_id:
required
string
The id of the refund to be retrieved
This endpoint is used for retrieving a specific refund of a specific payment entity by its id. [block:code] { "codes": [ { "code": "curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\\nhttps://api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/refunds/rfnd_AABBdHIieexn5c", "language": "curl" }, { "code": "<?php\n\nuse Razorpay\\Api\\Api;\n\n$api = new Api('rzp_test_26ccbdbfe0e84b', '69b2e24411e384f91213f22a');\n\n$payment = $api->payment->fetch('pay_29QQoUBi66xm2f')->refunds()->fetch('rfnd_AABBdHIieexn5c');\n\n?>", "language": "php" }, { "code": "# do easy_install razorpay or\n# pip install razorpay\n\nimport razorpay\n\nrazorpay.Client(auth=(\"<YOUR_API_KEY>\", \"<YOUR_API_SECRET>\"))\n\npayment_id = \"<PAYMENT_ID>\"\n\nrefund_id = \"<REFUND_ID>\"\n\nresp = client.refund.fetch(payment_id, refund_id)", "language": "python" }, { "code": "rrequire 'razorpay'\n\nRazorpay.setup(\"rzp_test_26ccbdbfe0e84b\", \"69b2e24411e384f91213f22a\")\n\nRazorpay::Payment.fetch(\"pay_29QQoUBi66xm2f\").refunds.fetch(\"rfnd_AABBdHIieexn5c\")", "language": "ruby" }, { "code": "var request = require('request');\n\nrequest('rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a@api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/refunds?from=1500826740&to=1500826760&count=2&skip=1', function (error, response, body) {\n\nconsole.log('Response:', body);\n});", "language": "javascript", "name": "Node" }, { "code": "RazorpayClient client = new RazorpayClient(\"<api-key>\", \"<api-secret>\");\nPayment payment = client.Payment.Fetch(paymentId);\n\nRefund refund = payment.Refunds.Fetch(refundId);", "language": "csharp" }, { "code": "import com.razorpay.Refund;\nimport com.razorpay.RazorpayClient;\nimport com.razorpay.RazorpayException;\n\nRazorpayClient razorpay = new RazorpayClient(\"<api_key>\", \"<api_secret>\");\ntry {\n\tRefund refund = razorpay.Payments.fetchRefund(\"<payment_id>\", \"<refund_id>\");\n} catch (RazorpayException e) {\n\t// Handle Exception\n\tSystem.out.println(e.getMessage());\n}", "language": "java" } ], "sidebar": true } [/block]

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



This endpoint is used for retrieving a specific refund of a specific payment entity by its id. [block:code] { "codes": [ { "code": "curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\\nhttps://api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/refunds/rfnd_AABBdHIieexn5c", "language": "curl" }, { "code": "<?php\n\nuse Razorpay\\Api\\Api;\n\n$api = new Api('rzp_test_26ccbdbfe0e84b', '69b2e24411e384f91213f22a');\n\n$payment = $api->payment->fetch('pay_29QQoUBi66xm2f')->refunds()->fetch('rfnd_AABBdHIieexn5c');\n\n?>", "language": "php" }, { "code": "# do easy_install razorpay or\n# pip install razorpay\n\nimport razorpay\n\nrazorpay.Client(auth=(\"<YOUR_API_KEY>\", \"<YOUR_API_SECRET>\"))\n\npayment_id = \"<PAYMENT_ID>\"\n\nrefund_id = \"<REFUND_ID>\"\n\nresp = client.refund.fetch(payment_id, refund_id)", "language": "python" }, { "code": "rrequire 'razorpay'\n\nRazorpay.setup(\"rzp_test_26ccbdbfe0e84b\", \"69b2e24411e384f91213f22a\")\n\nRazorpay::Payment.fetch(\"pay_29QQoUBi66xm2f\").refunds.fetch(\"rfnd_AABBdHIieexn5c\")", "language": "ruby" }, { "code": "var request = require('request');\n\nrequest('rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a@api.razorpay.com/v1/payments/pay_29QQoUBi66xm2f/refunds?from=1500826740&to=1500826760&count=2&skip=1', function (error, response, body) {\n\nconsole.log('Response:', body);\n});", "language": "javascript", "name": "Node" }, { "code": "RazorpayClient client = new RazorpayClient(\"<api-key>\", \"<api-secret>\");\nPayment payment = client.Payment.Fetch(paymentId);\n\nRefund refund = payment.Refunds.Fetch(refundId);", "language": "csharp" }, { "code": "import com.razorpay.Refund;\nimport com.razorpay.RazorpayClient;\nimport com.razorpay.RazorpayException;\n\nRazorpayClient razorpay = new RazorpayClient(\"<api_key>\", \"<api_secret>\");\ntry {\n\tRefund refund = razorpay.Payments.fetchRefund(\"<payment_id>\", \"<refund_id>\");\n} catch (RazorpayException e) {\n\t// Handle Exception\n\tSystem.out.println(e.getMessage());\n}", "language": "java" } ], "sidebar": true } [/block]
{"_id":"574a8ef8d1d1381900b73fcb","hidden":false,"next":{"description":"","pages":[]},"order":6,"project":"54c83b5aab706219009e067b","sync_unique":"","user":"54f6ab9009da88170095c103","__v":2,"editedParams2":true,"githubsync":"","link_external":false,"updates":["5a662afade13bd0026c1983f"],"api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\ \nhttps://api.razorpay.com/v1/refunds"},{"code":"import java.util.List;\nimport org.json.JSONObject;\nimport com.razorpay.Refund;\nimport com.razorpay.RazorpayClient;\nimport com.razorpay.RazorpayException;\n\nRazorpayClient razorpay = new RazorpayClient(\"<api_key>\", \"<api_secret>\");\ntry {\n  JSONObject refundRequest = new JSONObject();\n\n  // supported option filters (from, to, count, skip)\n  refundRequest.put(\"count\", 2);\n  refundRequest.put(\"skip\", 1);\n\n  List<Refund> refunds = razorpay.Refunds.fetchAll(refundRequest);\n} catch (RazorpayException e) {\n  // Handle Exception\n  System.out.println(e.getMessage());\n}","language":"java"},{"code":"# do easy_install razorpay or\n#    pip install razorpay\n\nimport razorpay\n\nrazorpay.Client(auth=(\"<YOUR_API_KEY>\", \"<YOUR_API_SECRET>\"))\n\npayment_id = \"<PAYMENT_ID>\"\n\nresp = client.refund.fetch_all(payment_id)","language":"python"}]},"method":"get","params":[{"required":false,"type":"timestamp","_id":"574a8ef8d1d1381900b73fcf","default":"","desc":"The timestamp in seconds after which the refunds were created","in":"query","name":"from","ref":""},{"in":"query","name":"to","ref":"","required":false,"type":"timestamp","_id":"574a8ef8d1d1381900b73fce","default":"","desc":"The timestamp in seconds after which the refunds were created"},{"name":"count","in":"query","_id":"574a8ef8d1d1381900b73fcd","ref":"","required":false,"desc":"The number of refunds to fetch. Maximum: 100","default":"10","type":"int"},{"desc":"The number of refunds to be skipped","default":"0","type":"int","name":"skip","in":"query","_id":"574a8ef8d1d1381900b73fcc","ref":"","required":false}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"count\": 2,\n  \"entity\": \"collection\",\n  \"items\": [\n    {\n      \"id\": \"rfnd_AABBdHIieexn5c\",\n      \"entity\": \"refund\",\n      \"amount\": 100,\n      \"currency\": \"INR\",\n      \"payment_id\": \"pay_29QQoUBi66xm2f\",\n      \"notes\": {},\n      \"created_at\": 1500826750\n    },\n    {\n      \"id\": \"rfnd_19btGlBig6xZ2f\",\n      \"entity\": \"refund\",\n      \"amount\": 100,\n      \"currency\": \"INR\",\n      \"payment_id\": \"pay_29QQoUBi66xm2f\",\n      \"notes\": {},\n      \"created_at\": 1500826750\n    }\n  ]\n}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":"/refunds/"},"excerpt":"","isReference":true,"link_url":"","parentDoc":null,"slug":"refunds","body":"This endpoint is used for retrieving list of refunds based on optional parameters. By default only last 10 are returned. You can use count and skip parameters to change that behavior.","editedParams":true,"title":"/refunds","type":"get","version":"54dec8b6c2b4b70d009c3f0f","category":"54dec8b7c2b4b70d009c3f11","createdAt":"2016-05-29T06:40:56.421Z","childrenPages":[]}

get/refunds


Query Params

from:
timestamp
The timestamp in seconds after which the refunds were created
to:
timestamp
The timestamp in seconds after which the refunds were created
count:
integer10
The number of refunds to fetch. Maximum: 100
skip:
integer0
The number of refunds to be skipped
This endpoint is used for retrieving list of refunds based on optional parameters. By default only last 10 are returned. You can use count and skip parameters to change that behavior.

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



This endpoint is used for retrieving list of refunds based on optional parameters. By default only last 10 are returned. You can use count and skip parameters to change that behavior.
{"_id":"574a9054bd8f971700399591","updates":["5aa93cb62a1896004ba78c11","5be6b9b944b59d0018be155d"],"editedParams2":true,"hidden":false,"next":{"description":"","pages":[]},"title":"/refunds/:id","type":"get","editedParams":true,"link_url":"","order":7,"slug":"refundsid","user":"54f6ab9009da88170095c103","body":"","category":"54dec8b7c2b4b70d009c3f11","createdAt":"2016-05-29T06:46:44.343Z","githubsync":"","link_external":false,"parentDoc":null,"project":"54c83b5aab706219009e067b","sync_unique":"","__v":3,"api":{"examples":{"codes":[{"language":"curl","code":"curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\\nhttps://api.razorpay.com/v1/refunds/rfnd_AABBdHIieexn5c"},{"language":"java","code":"import com.razorpay.Refund;\nimport com.razorpay.RazorpayClient;\nimport com.razorpay.RazorpayException;\n\nRazorpayClient razorpay = new RazorpayClient(\"<api_key>\", \"<api_secret>\");\ntry {\n\tRefund refund = razorpay.Refunds.fetch(\"<refund_id>\");\n} catch (RazorpayException e) {\n\t// Handle Exception\n\tSystem.out.println(e.getMessage());\n}"},{"language":"python","code":"# do easy_install razorpay or\n#    pip install razorpay\n\nimport razorpay\n\nrazorpay.Client(auth=(\"<YOUR_API_KEY>\", \"<YOUR_API_SECRET>\"))\n\npayment_id = \"<PAYMENT_ID>\"\n\nrefund_id = \"<REFUND_ID>\"\n\nresp = client.refund.fetch(payment_id, refund_id)"}]},"method":"get","params":[{"default":"","type":"string","name":"id","in":"path","_id":"574a9054bd8f971700399592","ref":"","required":true,"desc":"The id of the refund to be retrieved"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"id\": \"rfnd_AABBdHIieexn5c\",\n  \"entity\": \"refund\",\n  \"amount\": 100,\n  \"currency\": \"INR\",\n  \"payment_id\": \"pay_29QQoUBi66xm2f\",\n  \"notes\": {},\n  \"created_at\": 1500826750\n}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":"/refunds/:id","auth":"required"},"excerpt":"","isReference":true,"version":"54dec8b6c2b4b70d009c3f0f","childrenPages":[]}

get/refunds/:id


Path Params

id:
required
string
The id of the refund to be retrieved

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"57dbaa97b68b500e00d37366","version":"54dec8b6c2b4b70d009c3f0f","__v":1,"excerpt":"Create an order","githubsync":"","next":{"description":"","pages":[]},"type":"post","updates":[],"category":"54dec8b7c2b4b70d009c3f11","createdAt":"2016-09-16T08:17:27.144Z","hidden":false,"project":"54c83b5aab706219009e067b","title":"/orders","api":{"method":"post","params":[{"desc":"Amount of the order to be paid","default":"","type":"int","name":"amount","_id":"57dbaa97b68b500e00d3736b","ref":"","in":"body","required":false},{"_id":"57dbaa97b68b500e00d3736a","ref":"","in":"body","required":false,"desc":"Currency of the order. Currently only INR is supported.","default":"","type":"string","name":"currency"},{"_id":"57dbaa97b68b500e00d37369","ref":"","in":"body","required":false,"desc":"Your system order reference id.","default":"","type":"string","name":"receipt"},{"name":"payment_capture","_id":"57dbaa97b68b500e00d37368","ref":"","in":"body","required":false,"desc":"Whether the payment should be captured automatically or not.","default":"0","type":"boolean"},{"ref":"","in":"body","required":false,"desc":"A key-value pair dictionary","default":"","type":"mixed","name":"notes","_id":"57dbaa97b68b500e00d37367"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n    \"id\": \"order_6JUYuvmgCLfgjY\",\n    \"entity\": \"order\",\n    \"amount\": 50000,\n    \"currency\": \"INR\",\n    \"receipt\": \"rcptid42\",\n    \"status\": \"created\",\n    \"attempts\": 0,\n    \"notes\": [],\n    \"created_at\": 1487348538\n}","name":""},{"code":"{\n   \"error\": {\n      \"code\": \"BAD_REQUEST_ERROR\",\n      \"description\": \"The amount is invalid\",\n      \"field\": \"amount\"\n   }\n}","name":"","status":400,"language":"json"},{"status":401,"language":"text","code":"{\n    \"error\": {\n        \"code\": \"BAD_REQUEST_ERROR\",\n        \"description\": \"The api key provided is invalid\"\n    }\n}"}]},"settings":"","url":"/orders","auth":"required","examples":{"codes":[{"language":"curl","code":"curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\ \nhttps://api.razorpay.com/v1/orders"},{"language":"java","code":"import com.razorpay.Order;\nimport org.json.JSONObject;\nimport com.razorpay.RazorpayClient;\nimport com.razorpay.RazorpayException;\n\nRazorpayClient razorpay = new RazorpayClient(\"<api_key>\", \"<api_secret>\");\ntry {\n\tJSONObject orderRequest = new JSONObject();\n\torderRequest.put(\"amount\", amount); // amount in paise\n\torderRequest.put(\"currency\", \"INR\");\n\torderRequest.put(\"receipt\", \"test_1\");\n\torderRequest.put(\"payment_capture\", false);\n\n\tOrder order = razorpay.Orders.create(orderRequest);\n} catch (RazorpayException e) {\n\t// Handle Exception\n\tSystem.out.println(e.getMessage());\n}"},{"language":"python","code":"# do easy_install razorpay or\n#    pip install razorpay\n\nimport razorpay\n\nrazorpay.Client(auth=(\"<YOUR_API_KEY>\", \"<YOUR_API_SECRET>\"))\n\norder_amount =<ORDER AMOUNT>\norder_currency = 'INR'\norder_receipt = '<ORDER_RECEIPT>'\nnotes = {'key': 'value'}   # OPTIONAL\n\nclient.order.create(amount=order_amount, currency=order_currency, receipt=order_receipt, notes=notes)"}]}},"body":"This endpoint is used for creating an Order in Razorpay system.","isReference":true,"slug":"orders","link_external":false,"link_url":"","order":8,"parentDoc":null,"sync_unique":"","user":"54f6ab9009da88170095c103","childrenPages":[]}

post/orders

Create an order

Body Params

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:
boolean0
Whether the payment should be captured automatically or not.
notes:
mixed
A key-value pair dictionary
This endpoint is used for creating an Order in Razorpay system.

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



This endpoint is used for creating an Order in Razorpay system.
{"_id":"57dbbc717b04b40e00a3038a","next":{"description":"","pages":[]},"order":9,"excerpt":"","githubsync":"","link_external":false,"link_url":"","type":"get","version":"54dec8b6c2b4b70d009c3f0f","createdAt":"2016-09-16T09:33:37.706Z","slug":"orders-1","sync_unique":"","user":"54f6ab9009da88170095c103","body":"","hidden":false,"project":"54c83b5aab706219009e067b","updates":[],"parentDoc":null,"title":"/orders","__v":1,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"entity\": \"collection\",\n  \"count\": 2,\n  \"items\": [\n    {\n      \"id\": \"order_7IZKKI4Pnt2kEe\",\n      \"entity\": \"order\",\n      \"amount\": 50000,\n      \"currency\": \"INR\",\n      \"receipt\": \"rcptid42\",\n      \"status\": \"created\",\n      \"attempts\": 0,\n      \"notes\": [],\n      \"created_at\": 1487348538\n    },\n    {\n      \"id\": \"order_4xbSwsPABDJ8oK\",\n      \"entity\": \"order\",\n      \"amount\": 50000,\n      \"currency\": \"INR\",\n      \"receipt\": \"rcptid43\",\n      \"status\": \"created\",\n      \"attempts\": 0,\n      \"created_at\": 1455696756,\n      \"notes\": {}\n    }\n  ]\n}","name":""},{"language":"json","code":"{}","name":"","status":400}]},"settings":"","url":"/orders","auth":"required","examples":{"codes":[{"language":"java","code":"import java.util.List;\nimport com.razorpay.Order;\nimport org.json.JSONObject;\nimport com.razorpay.RazorpayClient;\nimport com.razorpay.RazorpayException;\n\nRazorpayClient razorpay = new RazorpayClient(\"<api_key>\", \"<api_secret>\");\ntry {\n\tJSONObject orderRequest = new JSONObject();\n\n\t// supported option filters (from, to, count, skip)\n\torderRequest.put(\"count\", 2);\n\torderRequest.put(\"skip\", 1);\n\n\tList<Order> orders = razorpay.Orders.fetchAll(orderRequest);\n} catch (RazorpayException e) {\n\t// Handle Exception\n\tSystem.out.println(e.getMessage());\n}"},{"language":"python","code":"# do easy_install razorpay or\n#    pip install razorpay\n\nimport razorpay\n\nrazorpay.Client(auth=(\"<YOUR_API_KEY>\", \"<YOUR_API_SECRET>\"))\n\nresp = client.order.fetch_all()"}]},"method":"get","params":[{"in":"query","name":"from","ref":"","required":false,"type":"timestamp","_id":"57dbbc717b04b40e00a30390","default":"","desc":"The timestamp in seconds after which the orders were created"},{"default":"","desc":"The timestamp in seconds before which the orders were created","in":"query","name":"to","ref":"","required":false,"type":"timestamp","_id":"57dbbc717b04b40e00a3038f"},{"ref":"","required":false,"type":"int","_id":"57dbbc717b04b40e00a3038e","default":"10","desc":"The number of orders to fetch. Max is 100.","in":"query","name":"count"},{"default":"0","type":"int","name":"skip","_id":"57dbbc717b04b40e00a3038d","ref":"","in":"query","required":false,"desc":"The number of orders to be skipped"},{"default":"0","type":"boolean","name":"authorized","_id":"57dbbc717b04b40e00a3038c","ref":"","in":"query","required":false,"desc":"Orders for which payments are currently in authorized state."},{"default":"","type":"string","name":"receipt","_id":"57dbbc717b04b40e00a3038b","ref":"","in":"query","required":false,"desc":"Orders with the provided value for receipt."}]},"category":"54dec8b7c2b4b70d009c3f11","isReference":true,"childrenPages":[]}

get/orders


Query Params

from:
timestamp
The timestamp in seconds after which the orders were created
to:
timestamp
The timestamp in seconds before which the orders were created
count:
integer10
The number of orders to fetch. Max is 100.
skip:
integer0
The number of orders to be skipped
authorized:
boolean0
Orders for which payments are currently in authorized state.
receipt:
string
Orders with the provided value for receipt.

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"57dbc48af4da530e00b3b5a2","updates":["59448457492ff7000f85e790"],"body":"","sync_unique":"","type":"get","slug":"ordersid","title":"/orders/:id","__v":2,"api":{"method":"get","params":[{"required":false,"desc":"The id of the order to be retrieved","default":"","type":"string","name":"id","_id":"57dbc48af4da530e00b3b5a3","ref":"","in":"path"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n    \"id\": \"order_7IZKKI4Pnt2kEe\",\n    \"entity\": \"order\",\n    \"amount\": 60000,\n    \"currency\": \"INR\",\n    \"receipt\": \"rcptid33\",\n    \"status\": \"created\",\n    \"attempts\": 0,\n    \"notes\": [],\n    \"created_at\": 1455696913\n}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":"/orders/:id","auth":"required","examples":{"codes":[{"language":"java","code":"import com.razorpay.Order;\nimport com.razorpay.RazorpayClient;\nimport com.razorpay.RazorpayException;\n\nRazorpayClient razorpay = new RazorpayClient(\"<api_key>\", \"<api_secret>\");\ntry {\n\tOrder order = razorpay.Orders.fetch(\"<order_id>\");\n} catch (RazorpayException e) {\n\t// Handle Exception\n\tSystem.out.println(e.getMessage());\n}"},{"language":"python","code":"# do easy_install razorpay or\n#    pip install razorpay\n\nimport razorpay\n\nrazorpay.Client(auth=(\"<YOUR_API_KEY>\", \"<YOUR_API_SECRET>\"))\n\norder_id = <ORDER_ID>\n\nresp = client.order.fetch(order_id)"}]}},"hidden":false,"parentDoc":null,"project":"54c83b5aab706219009e067b","user":"54f6ab9009da88170095c103","version":"54dec8b6c2b4b70d009c3f0f","isReference":true,"link_url":"","githubsync":"","link_external":false,"next":{"description":"","pages":[]},"order":10,"category":"54dec8b7c2b4b70d009c3f11","createdAt":"2016-09-16T10:08:10.460Z","excerpt":"","childrenPages":[]}

get/orders/:id


Path Params

id:
string
The id of the order to be retrieved

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"59fc2dcd91a52d001a3c850d","project":"54c83b5aab706219009e067b","version":"54dec8b6c2b4b70d009c3f0f","category":"54dec8b7c2b4b70d009c3f11","user":"5704f1e3473f900e004d5c6c","updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-11-03T08:50:21.843Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"method":"get","examples":{"codes":[{"language":"curl","code":"curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\ \nhttps://api.razorpay.com/v1/settlements/?count=2&skip=1&from=1400826740 "}]},"settings":"","results":{"codes":[{"status":200,"language":"json","code":"{\n  \"entity\": \"collection\",\n  \"count\": 2,\n  \"items\": [\n    {\n      \"id\": \"setl_7IZKKI4Pnt2kEe\",\n      \"entity\": \"settlement\",\n      \"amount\": 50000,\n      \"status\" : \"processed\",\n      \"fees\": 123,\n      \"tax\": 12,\n      \"utr\": \"RZRP173069230703\",\n      \"created_at\": 1509622307\n    },\n    {\n      \"id\": \"setl_4xbSwsPABDJ8oK\",\n      \"entity\": \"settlement\",\n      \"amount\": 50000,\n      \"status\" : \"processed\",\n      \"fees\": 123,\n      \"tax\": 12,\n      \"utr\": \"RZRP173069230702\",\n      \"created_at\": 1509622306\n    }\n  ]\n}","name":""},{"language":"json","code":"{}","name":"","status":400}]},"auth":"required","params":[{"_id":"57dbbc717b04b40e00a30390","ref":"","in":"query","required":false,"desc":"The timestamp in seconds after which the settlements were created","default":"","type":"timestamp","name":"from"},{"_id":"57dbbc717b04b40e00a3038f","ref":"","in":"query","required":false,"desc":"The timestamp in seconds before which the settlements were created","default":"","type":"timestamp","name":"to"},{"_id":"57dbbc717b04b40e00a3038e","ref":"","in":"query","required":false,"desc":"The number of settlements to fetch. Max is 100.","default":"10","type":"int","name":"count"},{"_id":"57dbbc717b04b40e00a3038d","ref":"","in":"query","required":false,"desc":"The number of settlements to be skipped","default":"0","type":"int","name":"skip"}],"url":"/settlements"},"isReference":true,"order":11,"body":"","excerpt":"","slug":"settlements","type":"get","title":"/settlements","__v":2,"parentDoc":null,"childrenPages":[]}

get/settlements


Query Params

from:
timestamp
The timestamp in seconds after which the settlements were created
to:
timestamp
The timestamp in seconds before which the settlements were created
count:
integer10
The number of settlements to fetch. Max is 100.
skip:
integer0
The number of settlements to be skipped

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"59fc2eac3cf718001069b665","project":"54c83b5aab706219009e067b","version":"54dec8b6c2b4b70d009c3f0f","category":"54dec8b7c2b4b70d009c3f11","user":"5704f1e3473f900e004d5c6c","updates":["5a8adab113cba9004f2992c7"],"next":{"pages":[],"description":""},"createdAt":"2017-11-03T08:54:04.333Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"language":"curl","code":"curl -u rzp_test_26ccbdbfe0e84b:69b2e24411e384f91213f22a \\ \nhttps://api.razorpay.com/v1/settlements/setl_7IZKKI4Pnt2kEe"}]},"settings":"","results":{"codes":[{"status":200,"language":"json","code":"{\n    \"id\": \"setl_7IZKKI4Pnt2kEe\",\n    \"entity\": \"settlement\",\n    \"amount\": 60000,\n\t\t\"status\": \"processed\",\n    \"fees\": 123,\n    \"tax\": 12,\n    \"utr\": RZRP111111111111,\n    \"created_at\": 1455696913\n}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"method":"get","auth":"required","params":[{"_id":"57dbc48af4da530e00b3b5a3","ref":"","in":"path","required":false,"desc":"The id of the settlement to be retrieved","default":"","type":"string","name":"id"}],"url":"/settlements/:id"},"isReference":true,"order":12,"body":"","excerpt":"","slug":"settlementsid","type":"get","title":"/settlements/:id","__v":2,"parentDoc":null,"childrenPages":[]}

get/settlements/:id


Path Params

id:
string
The id of the settlement to be retrieved

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"58033002271ddf230011c00f","parentDoc":null,"sync_unique":"","title":"Supported Integrations","updates":[],"category":"58032efb128cba2d00c4314a","body":"We have developed server-side SDKs, plugins, and wrappers over our RESTful API that would help you setup the Razorpay Payment ecosystem and perform other useful tasks. \n\n\n[Refer the list of supported integrations.](https://razorpay.com/integrations/)","excerpt":"","isReference":false,"link_url":"https://razorpay.com/integrations/","project":"54c83b5aab706219009e067b","__v":1,"hidden":false,"slug":"other-integrations","type":"basic","user":"5752854a8e9ef90e0083ebb8","createdAt":"2016-10-16T07:45:06.298Z","githubsync":"","link_external":true,"order":0,"version":"54dec8b6c2b4b70d009c3f0f","api":{"params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"code":"{}","name":"","status":400,"language":"json"}]},"settings":"","auth":"required"},"next":{"description":"","pages":[]},"childrenPages":[]}

Supported Integrations


We have developed server-side SDKs, plugins, and wrappers over our RESTful API that would help you setup the Razorpay Payment ecosystem and perform other useful tasks. [Refer the list of supported integrations.](https://razorpay.com/integrations/)
We have developed server-side SDKs, plugins, and wrappers over our RESTful API that would help you setup the Razorpay Payment ecosystem and perform other useful tasks. [Refer the list of supported integrations.](https://razorpay.com/integrations/)
{"_id":"5b46f77e3dcb6a0003c6e7b9","project":"54c83b5aab706219009e067b","version":"54dec8b6c2b4b70d009c3f0f","category":"55a69fc8aaf9cf19001151dc","user":"599c2d24f180820025f1435e","updates":["5c5a68519a8724003f382408"],"next":{"pages":[],"description":""},"createdAt":"2018-07-12T06:38:54.122Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"","excerpt":"We support quite a few more features and platforms. You may want to go through these recommended documentation while you are at it. Click on the left navigation menu item to go to its respective page.","slug":"useful-links","type":"basic","title":"Useful Links","__v":1,"parentDoc":null,"childrenPages":[]}

Useful Links

We support quite a few more features and platforms. You may want to go through these recommended documentation while you are at it. Click on the left navigation menu item to go to its respective page.