{"__v":15,"_id":"54dec8b7c2b4b70d009c3f12","api":{"auth":"required","params":[],"results":{"codes":[]},"settings":"","url":""},"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 view able in the dark area to the right. Programming language of the examples can be switched via links on top of example box.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Getting Started\"\n}\n[/block]\nTo start accepting payments using Razorpay, you need:\n\n1. API keys that can be generated through [Razorpay's dashboard](https://dashboard.razorpay.com)\n2. Checkout form integrated in your website / app\n3. Payment `capturing` process in your backend\n\nThe process of accepting payments from your end customers is as follows:\n1. Users click on a pay button and are shown the Checkout Form\n2. User fills his/her payment details and `Authorizes` the payment.\n3. Checkout Form hands over to you the `razorpay_payment_id`\n4. Your server side backend uses the `razorpay_payment_id` to `capture` the payment\n5. You get the money in your bank account in T+3 days.\n\nThe `capture` process is required to ensure that the correct amount has been charged to the user. In case you don't want to or cannot implement the `capture` process in your server side backend, you can also manually `capture` the payments from our [dashboard](https://dashboard.razorpay.com). There's a section below on [Payment Flow](doc:payment-flow) which explains the stages in a payment like `Authorize` and `Capture`.\n\nNote that if you want to enable auto-capture of payment immediately after authorization, then that can be done via integration of `Orders` API.\n\nTo integrate the [Checkout Form](doc:checkout-form) in your website, read the section below for the integration details. For mobile devices, read the section on [Android and iOS SDK](doc:mobile-payments).\n\nFor the `capture` process, you can either use the [Libraries & Integrations](doc:libraries) that we have provided for various frameworks and languages, or you could directly [query the API](doc:v1paymentsidcapture) for this.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"In case of error in response, [use this as reference](errors)\"\n}\n[/block]","category":"54dec8b7c2b4b70d009c3f10","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!","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","next":{"description":"","pages":[]},"order":0,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"getting-started","sync_unique":"","title":"Getting Started with Razorpay","type":"basic","updates":[],"user":"54c83ac1ab706219009e067a","version":"54dec8b6c2b4b70d009c3f0f","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 view able in the dark area to the right. Programming language of the examples can be switched via links on top of example box. [block:api-header] { "type": "basic", "title": "Getting Started" } [/block] To start accepting payments using Razorpay, you need: 1. API keys that can be generated through [Razorpay's dashboard](https://dashboard.razorpay.com) 2. Checkout form integrated in your website / app 3. Payment `capturing` process in your backend The process of accepting payments from your end customers is as follows: 1. Users click on a pay button and are shown the Checkout Form 2. User fills his/her payment details and `Authorizes` the payment. 3. Checkout Form hands over to you the `razorpay_payment_id` 4. Your server side backend uses the `razorpay_payment_id` to `capture` the payment 5. You get the money in your bank account in T+3 days. The `capture` process is required to ensure that the correct amount has been charged to the user. In case you don't want to or cannot implement the `capture` process in your server side backend, you can also manually `capture` the payments from our [dashboard](https://dashboard.razorpay.com). There's a section below on [Payment Flow](doc:payment-flow) which explains the stages in a payment like `Authorize` and `Capture`. Note that if you want to enable auto-capture of payment immediately after authorization, then that can be done via integration of `Orders` API. To integrate the [Checkout Form](doc:checkout-form) in your website, read the section below for the integration details. For mobile devices, read the section on [Android and iOS SDK](doc:mobile-payments). For the `capture` process, you can either use the [Libraries & Integrations](doc:libraries) that we have provided for various frameworks and languages, or you could directly [query the API](doc:v1paymentsidcapture) for this. [block:callout] { "type": "info", "body": "In case of error in response, [use this as reference](errors)" } [/block]
[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 view able in the dark area to the right. Programming language of the examples can be switched via links on top of example box. [block:api-header] { "type": "basic", "title": "Getting Started" } [/block] To start accepting payments using Razorpay, you need: 1. API keys that can be generated through [Razorpay's dashboard](https://dashboard.razorpay.com) 2. Checkout form integrated in your website / app 3. Payment `capturing` process in your backend The process of accepting payments from your end customers is as follows: 1. Users click on a pay button and are shown the Checkout Form 2. User fills his/her payment details and `Authorizes` the payment. 3. Checkout Form hands over to you the `razorpay_payment_id` 4. Your server side backend uses the `razorpay_payment_id` to `capture` the payment 5. You get the money in your bank account in T+3 days. The `capture` process is required to ensure that the correct amount has been charged to the user. In case you don't want to or cannot implement the `capture` process in your server side backend, you can also manually `capture` the payments from our [dashboard](https://dashboard.razorpay.com). There's a section below on [Payment Flow](doc:payment-flow) which explains the stages in a payment like `Authorize` and `Capture`. Note that if you want to enable auto-capture of payment immediately after authorization, then that can be done via integration of `Orders` API. To integrate the [Checkout Form](doc:checkout-form) in your website, read the section below for the integration details. For mobile devices, read the section on [Android and iOS SDK](doc:mobile-payments). For the `capture` process, you can either use the [Libraries & Integrations](doc:libraries) that we have provided for various frameworks and languages, or you could directly [query the API](doc:v1paymentsidcapture) for this. [block:callout] { "type": "info", "body": "In case of error in response, [use this as reference](errors)" } [/block]
{"__v":7,"_id":"54dec8b7c2b4b70d009c3f14","api":{"auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":""},"body":"A payment has following flow:\n\n**CREATION**\nPayment is created when a user (the customer) fills up and submits the payment information and it is sent to the Razorpay API. No processing has been done on the payment at this stage.\n\n**AUTHORIZATION**\nAn `authorization` is performed when user’s payment details are successfully authenticated by the bank. The money is deducted from the customer’s account, but will not be transferred to the merchant’s account until it is explicitly captured by merchant.\n\n**CAPTURE**\nThe next step, called `capture`, verifies the purchase as complete by the merchant. After capture, the amount is transferred to the merchant within T+3 days where T is the day on which payment is captured. The captured amount must be same as authorized amount.\nAny `authorization` not followed by a capture within 5 days is automatically voided and refunded.\n\n**REFUND**\nA successfully `captured` payment can be `refunded` by the merchant.\n\nThe first two steps (Creation and Authorization) are handled by the checkout form and are client sided. The next two steps (Capture & Refund) are handled using the API and are server side requests.","category":"54dec8b7c2b4b70d009c3f10","createdAt":"2015-02-13T14:36:52.182Z","excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","order":1,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"payment-flow","sync_unique":"","title":"Payment Flow","type":"basic","updates":["56f3ce542ef92e17007b8abc","584fb15beb4bfb1b00a5ad68"],"user":"54c83ac1ab706219009e067a","version":"54dec8b6c2b4b70d009c3f0f","childrenPages":[]}

Payment Flow


A payment has following flow: **CREATION** Payment is created when a user (the customer) fills up and submits the payment information and it is sent to the Razorpay API. No processing has been done on the payment at this stage. **AUTHORIZATION** An `authorization` is performed when user’s payment details are successfully authenticated by the bank. The money is deducted from the customer’s account, but will not be transferred to the merchant’s account until it is explicitly captured by merchant. **CAPTURE** The next step, called `capture`, verifies the purchase as complete by the merchant. After capture, the amount is transferred to the merchant within T+3 days where T is the day on which payment is captured. The captured amount must be same as authorized amount. Any `authorization` not followed by a capture within 5 days is automatically voided and refunded. **REFUND** A successfully `captured` payment can be `refunded` by the merchant. The first two steps (Creation and Authorization) are handled by the checkout form and are client sided. The next two steps (Capture & Refund) are handled using the API and are server side requests.
A payment has following flow: **CREATION** Payment is created when a user (the customer) fills up and submits the payment information and it is sent to the Razorpay API. No processing has been done on the payment at this stage. **AUTHORIZATION** An `authorization` is performed when user’s payment details are successfully authenticated by the bank. The money is deducted from the customer’s account, but will not be transferred to the merchant’s account until it is explicitly captured by merchant. **CAPTURE** The next step, called `capture`, verifies the purchase as complete by the merchant. After capture, the amount is transferred to the merchant within T+3 days where T is the day on which payment is captured. The captured amount must be same as authorized amount. Any `authorization` not followed by a capture within 5 days is automatically voided and refunded. **REFUND** A successfully `captured` payment can be `refunded` by the merchant. The first two steps (Creation and Authorization) are handled by the checkout form and are client sided. The next two steps (Capture & Refund) are handled using the API and are server side requests.
{"__v":10,"_id":"54dec8b7c2b4b70d009c3f15","api":{"auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":""},"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\nMail us in case you face any issues in integration at support@razorpay.com.","category":"54dec8b7c2b4b70d009c3f10","createdAt":"2015-02-13T14:37:10.938Z","excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","next":{"description":"","pages":[]},"order":2,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"libraries","sync_unique":"","title":"Libraries & Integrations","type":"basic","updates":[],"user":"54c83ac1ab706219009e067a","version":"54dec8b6c2b4b70d009c3f0f","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/) Mail us in case you face any issues in integration at support@razorpay.com.
* 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/) Mail us in case you face any issues in integration at support@razorpay.com.
{"__v":1,"_id":"54dec8b7c2b4b70d009c3f16","api":{"auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"url":""},"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]","category":"54dec8b7c2b4b70d009c3f10","createdAt":"2015-02-13T14:40:27.959Z","excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","order":3,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"authentication","sync_unique":"","title":"Authentication","type":"basic","updates":[],"user":"54c83ac1ab706219009e067a","version":"54dec8b6c2b4b70d009c3f0f","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]
{"__v":0,"_id":"574a8cd0d9ec5b0e002053a2","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"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. \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.","category":"54dec8b7c2b4b70d009c3f10","createdAt":"2016-05-29T06:31:44.439Z","excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","order":4,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"notes","sync_unique":"","title":"Notes","type":"basic","updates":[],"user":"54f6ab9009da88170095c103","version":"54dec8b6c2b4b70d009c3f0f","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.
`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.
{"__v":0,"_id":"54dec8b7c2b4b70d009c3f1f","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"auth":"required","params":[],"url":""},"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]","category":"54dec8b7c2b4b70d009c3f10","createdAt":"2015-02-14T02:12:22.402Z","excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","order":5,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"errors","sync_unique":"","title":"Errors","type":"basic","updates":[],"user":"54c83ac1ab706219009e067a","version":"54dec8b6c2b4b70d009c3f0f","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]
{"__v":26,"_id":"54dec8b7c2b4b70d009c3f18","api":{"auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":""},"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  \\\"service_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 Re 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 service tax\",\n    \"15-0\": \"service_tax\",\n    \"15-1\": \"integer\",\n    \"15-2\": \"Service tax 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]","category":"54dec8b7c2b4b70d009c3f10","createdAt":"2015-02-14T02:03:37.492Z","excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","next":{"description":"","pages":[]},"order":7,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"return-objects","sync_unique":"","title":"Entities","type":"basic","updates":["56f7bb29d31f6a0e003223b3","56f8b0c60968110e001f84ec"],"user":"54c83ac1ab706219009e067a","version":"54dec8b6c2b4b70d009c3f0f","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 \"service_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 Re 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 service tax", "15-0": "service_tax", "15-1": "integer", "15-2": "Service tax 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 \"service_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 Re 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 service tax", "15-0": "service_tax", "15-1": "integer", "15-2": "Service tax 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]
{"__v":2,"_id":"574aeb342c552f0e00c6a279","api":{"auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":""},"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]","category":"54dec8b7c2b4b70d009c3f10","createdAt":"2016-05-29T13:14:28.163Z","excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","order":8,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"collection","sync_unique":"","title":"Collection","type":"basic","updates":[],"user":"54f6ab9009da88170095c103","version":"54dec8b6c2b4b70d009c3f0f","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]
{"__v":0,"_id":"5832d31d0752650f00eb5380","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://docs.razorpay.com/v1/page/webhooks](https://docs.razorpay.com/v1/page/webhooks)","category":"54dec8b7c2b4b70d009c3f10","createdAt":"2016-11-21T10:57:33.250Z","excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","next":{"pages":[],"description":""},"order":10,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"webhooks-1","sync_unique":"","title":"Webhooks","type":"basic","updates":[],"user":"54f6ab9009da88170095c103","version":"54dec8b6c2b4b70d009c3f0f","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://docs.razorpay.com/v1/page/webhooks](https://docs.razorpay.com/v1/page/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://docs.razorpay.com/v1/page/webhooks](https://docs.razorpay.com/v1/page/webhooks)
{"__v":47,"_id":"54dec8b7c2b4b70d009c3f17","api":{"auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":""},"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 credit/debit card details or netbanking details or wallets.\n\nThis section only talks about the integration of checkout in your web application, that is, it only covers the `authorization` portion of the [Payment Flow](doc:payment-flow).\n\nTo learn how to `capture` a payment, read our [API Methods](doc:payments).\n\nThere are two ways to integrate checkout: Automatic and Manual.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"You can use any valid card number like 4111 1111 1111 1111 with any future expiry date and CVV in the test mode\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Having Meta-Viewport tag is recommended before integrating checkout form.\",\n  \"body\": \"Add following line to your `<head>` tag, if not already there:\\n```\\n<meta name=\\\"viewport\\\" content=\\\"width=device-width\\\">\\n```\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Automatic Checkout\"\n}\n[/block]\nFor automatic 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\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\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: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=\\\"Harshil Mathur\\\"\\n    data-prefill.email=\\\"support@razorpay.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]\nTo integrate Automatic Checkout:\n\n1. Modify the attributes to suit your needs, [use this table](#checkout-fields) as reference. Modify the form action at top to the url on your server where you want to handle the payment response.\n2. After the payment is done, a form will be submitted to the url specified in previous step with `razorpay_payment_id`. This means, the payment is `authorized` and you can capture it now.\n3. Using the `razorpay_payment_id` and the amount of the order placed, [capture the transaction from your server sided code](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:callout]\n{\n  \"type\": \"success\",\n  \"title\": \"Button customization\",\n  \"body\": \"You can write css rules against `.razorpay-payment-button` to customize the appearance of auto-generated button.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Manual 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 & 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 e.g.).\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\\\": \\\"Harshil Mathur\\\",\\n        \\\"email\\\": \\\"harshil@razorpay.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.\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:callout]\n{\n  \"type\": \"success\",\n  \"body\": \"You must call `open` method of `Razorpay` object on some user driven action, such as a click.\"\n}\n[/block]\n\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\": \"theme.image_padding\",\n    \"12-1\": \"data-theme.image_padding\",\n    \"12-2\": \"No\",\n    \"12-3\": \"Boolean whether to show image inside a white frame. (default: **true**)\",\n    \"13-0\": \"modal.backdropclose\",\n    \"13-1\": \"data-modal.backdropclose\",\n    \"13-2\": \"No\",\n    \"13-3\": \"Boolean indicating whether clicking translucent blank space outside checkout form should close the form. (default: **false**)\",\n    \"15-0\": \"modal.ondismiss\",\n    \"15-1\": \"N/A\",\n    \"15-2\": \"No\",\n    \"15-3\": \"Callback function invoked when form is closed without payment being completed.\",\n    \"16-0\": \"order_id\",\n    \"16-1\": \"data-order_id\",\n    \"16-2\": \"No\",\n    \"16-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    \"14-0\": \"modal.escape\",\n    \"14-1\": \"data-modal.escape\",\n    \"14-2\": \"No\",\n    \"14-3\": \"Boolean indicating whether pressing escape key should close the checkout form. (default: **true**)\"\n  },\n  \"cols\": 4,\n  \"rows\": 17\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Automatic vs Manual Checkout\"\n}\n[/block]\nAutomatic 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\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.","category":"566be10e4db9c60d00c9a82b","createdAt":"2015-02-14T01:44:23.718Z","excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","next":{"description":"","pages":[]},"order":0,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"checkout-form","sync_unique":"","title":"Checkout Form","type":"basic","updates":["55225d95f9996e0d0097ee67"],"user":"54c83ac1ab706219009e067a","version":"54dec8b6c2b4b70d009c3f0f","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 credit/debit card details or netbanking details or wallets. This section only talks about the integration of checkout in your web application, that is, it only covers the `authorization` portion of the [Payment Flow](doc:payment-flow). To learn how to `capture` a payment, read our [API Methods](doc:payments). There are two ways to integrate checkout: Automatic and Manual. [block:callout] { "type": "info", "title": "You can use any valid card number like 4111 1111 1111 1111 with any future expiry date and CVV in the test mode" } [/block] [block:callout] { "type": "warning", "title": "Having Meta-Viewport tag is recommended before integrating checkout form.", "body": "Add following line to your `<head>` tag, if not already there:\n```\n<meta name=\"viewport\" content=\"width=device-width\">\n```" } [/block] [block:api-header] { "type": "basic", "title": "Automatic Checkout" } [/block] For automatic 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. 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. 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: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=\"Harshil Mathur\"\n data-prefill.email=\"support@razorpay.com\"\n data-theme.color=\"#F37254\"\n></script>\n<input type=\"hidden\" value=\"Hidden Element\" name=\"hidden\">\n</form>", "language": "html" } ] } [/block] To integrate Automatic Checkout: 1. Modify the attributes to suit your needs, [use this table](#checkout-fields) as reference. Modify the form action at top to the url on your server where you want to handle the payment response. 2. After the payment is done, a form will be submitted to the url specified in previous step with `razorpay_payment_id`. This means, the payment is `authorized` and you can capture it now. 3. Using the `razorpay_payment_id` and the amount of the order placed, [capture the transaction from your server sided code](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:callout] { "type": "success", "title": "Button customization", "body": "You can write css rules against `.razorpay-payment-button` to customize the appearance of auto-generated button." } [/block] [block:api-header] { "type": "basic", "title": "Manual 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 & 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 e.g.). 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\": \"Harshil Mathur\",\n \"email\": \"harshil@razorpay.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. 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:callout] { "type": "success", "body": "You must call `open` method of `Razorpay` object on some user driven action, such as a click." } [/block] [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": "theme.image_padding", "12-1": "data-theme.image_padding", "12-2": "No", "12-3": "Boolean whether to show image inside a white frame. (default: **true**)", "13-0": "modal.backdropclose", "13-1": "data-modal.backdropclose", "13-2": "No", "13-3": "Boolean indicating whether clicking translucent blank space outside checkout form should close the form. (default: **false**)", "15-0": "modal.ondismiss", "15-1": "N/A", "15-2": "No", "15-3": "Callback function invoked when form is closed without payment being completed.", "16-0": "order_id", "16-1": "data-order_id", "16-2": "No", "16-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.", "14-0": "modal.escape", "14-1": "data-modal.escape", "14-2": "No", "14-3": "Boolean indicating whether pressing escape key should close the checkout form. (default: **true**)" }, "cols": 4, "rows": 17 } [/block] [block:api-header] { "type": "basic", "title": "Automatic vs Manual Checkout" } [/block] Automatic 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] { "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.
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 credit/debit card details or netbanking details or wallets. This section only talks about the integration of checkout in your web application, that is, it only covers the `authorization` portion of the [Payment Flow](doc:payment-flow). To learn how to `capture` a payment, read our [API Methods](doc:payments). There are two ways to integrate checkout: Automatic and Manual. [block:callout] { "type": "info", "title": "You can use any valid card number like 4111 1111 1111 1111 with any future expiry date and CVV in the test mode" } [/block] [block:callout] { "type": "warning", "title": "Having Meta-Viewport tag is recommended before integrating checkout form.", "body": "Add following line to your `<head>` tag, if not already there:\n```\n<meta name=\"viewport\" content=\"width=device-width\">\n```" } [/block] [block:api-header] { "type": "basic", "title": "Automatic Checkout" } [/block] For automatic 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. 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. 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: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=\"Harshil Mathur\"\n data-prefill.email=\"support@razorpay.com\"\n data-theme.color=\"#F37254\"\n></script>\n<input type=\"hidden\" value=\"Hidden Element\" name=\"hidden\">\n</form>", "language": "html" } ] } [/block] To integrate Automatic Checkout: 1. Modify the attributes to suit your needs, [use this table](#checkout-fields) as reference. Modify the form action at top to the url on your server where you want to handle the payment response. 2. After the payment is done, a form will be submitted to the url specified in previous step with `razorpay_payment_id`. This means, the payment is `authorized` and you can capture it now. 3. Using the `razorpay_payment_id` and the amount of the order placed, [capture the transaction from your server sided code](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:callout] { "type": "success", "title": "Button customization", "body": "You can write css rules against `.razorpay-payment-button` to customize the appearance of auto-generated button." } [/block] [block:api-header] { "type": "basic", "title": "Manual 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 & 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 e.g.). 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\": \"Harshil Mathur\",\n \"email\": \"harshil@razorpay.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. 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:callout] { "type": "success", "body": "You must call `open` method of `Razorpay` object on some user driven action, such as a click." } [/block] [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": "theme.image_padding", "12-1": "data-theme.image_padding", "12-2": "No", "12-3": "Boolean whether to show image inside a white frame. (default: **true**)", "13-0": "modal.backdropclose", "13-1": "data-modal.backdropclose", "13-2": "No", "13-3": "Boolean indicating whether clicking translucent blank space outside checkout form should close the form. (default: **false**)", "15-0": "modal.ondismiss", "15-1": "N/A", "15-2": "No", "15-3": "Callback function invoked when form is closed without payment being completed.", "16-0": "order_id", "16-1": "data-order_id", "16-2": "No", "16-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.", "14-0": "modal.escape", "14-1": "data-modal.escape", "14-2": "No", "14-3": "Boolean indicating whether pressing escape key should close the checkout form. (default: **true**)" }, "cols": 4, "rows": 17 } [/block] [block:api-header] { "type": "basic", "title": "Automatic vs Manual Checkout" } [/block] Automatic 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] { "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.
{"__v":3,"_id":"566be0f785dc790d0062c10c","api":{"auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":""},"body":"Android SDK follows semantic versioning. You can find documentation for v1.0.x here: [Android Checkout SDK v1.0.x](page:android-sdk-v10x)  \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","excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","order":0,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"android","sync_unique":"","title":"Android","type":"basic","updates":["57804f989a9ff80e0051bea9"],"user":"55830889ea39a9390022432b","version":"54dec8b6c2b4b70d009c3f0f","childrenPages":[]}

Android


Android SDK follows semantic versioning. You can find documentation for v1.0.x here: [Android Checkout SDK v1.0.x](page:android-sdk-v10x) 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 v1.0.x here: [Android Checkout SDK v1.0.x](page:android-sdk-v10x) 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)
{"__v":32,"_id":"566bdfc57831040d003eb371","api":{"auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":""},"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Integration method changed\",\n  \"body\": \"We have changed the integration method with this release. We highly recommend you to use the latest SDK. Nevertheless if you wish to stick to the older version, you can find the documentation [here](https://docs.razorpay.com/v1/page/ios-sdk-0100).\"\n}\n[/block]\n# v 0.14.1\n### Usage Instructions:\n## Step 1: Import library to your project\n- Download from [here](http://downloads.razorpay.com/Razorpay.framework-0.14.1.zip) and unzip. (For `bitcode` enabled SDK, click [here](http://downloads.razorpay.com/Razorpay.framework-0.14.1-bitcode.zip)). We also have a [CocoaPod](https://cocoapods.org/pods/razorpay-pod) for our SDK (non `bitcode` enabled).\n- Open your project in XCode and select `Add files to \"yourproject\"` from `file` menu.\n- Select Razorpay.framework in the directory you just unzipped.\n- Make sure 'Copy items if needed' is checked.\n- Click 'Add'.\n- In the \"Build Settings\" tab of your project settings, `-ObjC` flag should be present under \"Other Linker Flags\".\n- Under \"Link Binary With Libraries\" in the \"Build Phases\" tab of your project settings, add `CoreTelephony.framework` and `SystemConfiguration.framework`.\n\n## Step 2: Initialize Razorpay SDK\n\nYou'll need your public key and delegate that implements *RazorpayPaymentCompletionProtocol* and view controller where you want to show the checkout form.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"#import <Razorpay/Razorpay.h>\\n\\n@interface ViewController () <RazorpayPaymentCompletionProtocol> {\\n  Razorpay *razorpay;\\n..  \\n..\\n  \\n// Any place before opening the checkout form (eg. viewDidLoad)\\n- (void)viewDidLoad {\\n  [super viewDidLoad];\\n  ..\\n  ..\\n  razorpay = [Razorpay initWithKey:@\\\"YOUR_PUBLIC_KEY\\\" andDelegate:self];\\n}\",\n      \"language\": \"objectivec\",\n      \"name\": \"ViewController.m\"\n    }\n  ]\n}\n[/block]\n## Step 3: Pass payment options and show checkout form\n\nAdd following code to in your ViewController or where ever you want to initialize payments:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"- (void)showPaymentForm { // called by your app\\n  NSDictionary *options = @{\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t@\\\"amount\\\": @\\\"1000\\\", // mandatory, in paise\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t      // all optional other than amount.\\n            \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t@\\\"image\\\": @\\\"https://url-to-image.png\\\",\\n      \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t@\\\"name\\\": @\\\"business or product name\\\",\\n      \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t@\\\"description\\\": @\\\"purchase description\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t@\\\"prefill\\\" : @{ \\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t@\\\"email\\\": @\\\"pranav@razorpay.com\\\",\\n\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t@\\\"contact\\\": @\\\"8879524924\\\"\\n                            \\t\\t},\\n      \\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t@\\\"theme\\\": @{\\n                                  \\t@\\\"color\\\": @\\\"#F37254\\\"\\n                                }\\n                        \\t\\t};\\n\\t\\t[razorpay open:options];\\n}\",\n      \"language\": \"objectivec\",\n      \"name\": \"ViewController.m\"\n    }\n  ]\n}\n[/block]\nThat's pretty much it. You can find the list of all supported options [here](https://docs.razorpay.com/docs/checkout-form#checkout-fields).\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Progress Bar\",\n  \"body\": \"To support theme color in progress bar, please pass HEX color values only.\"\n}\n[/block]\n## Step 4: Handle success/error when payment is done\n\nThis is done by implementing `onPaymentSuccess` and `onPaymentError` methods of the *RazorpayPaymentCompletionProtocol*:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"- (void)onPaymentSuccess:(nonnull NSString*)payment_id {\\n    \\t[[[UIAlertView alloc] initWithTitle:@\\\"Payment Successful\\\" message:payment_id delegate:self cancelButtonTitle:@\\\"OK\\\" otherButtonTitles:nil] show];\\n}\\n\\n- (void)onPaymentError:(int)code description:(nonnull NSString *)str {\\n    \\t[[[UIAlertView alloc] initWithTitle:@\\\"Error\\\" message:str delegate:self cancelButtonTitle:@\\\"OK\\\" otherButtonTitles:nil] show];\\n}\",\n      \"language\": \"objectivec\",\n      \"name\": \"ViewController.m\"\n    }\n  ]\n}\n[/block]\nHere you have to put necessary actions after payment is completed based on success/error.\nPossible values for failure code are:\n* 0: Network error\n* 1: Initialization failure due to invalid options passed\n* 2: Payment cancelled by user\n\nSuccess handler will receive `payment_id` which you can use later for capturing purposes.\n\nYou can call `open` method any number of times. (eg. in case of payment failure, customer might want to retry so you can call the open method with same / different options based on your use case)\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"iOS9 Update\"\n}\n[/block]\niOS 9 has higher requirements for secure URLs. Unfortunately, many of Indian banks do not comply, which leaves you with following workaround for time being:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<key>NSAppTransportSecurity</key>\\n<dict>\\n    <key>NSAllowsArbitraryLoads</key>\\n    <true/>\\n</dict>\",\n      \"language\": \"xml\",\n      \"name\": \"info.plist\"\n    }\n  ]\n}\n[/block]\n Add it to your info.plist file. more info [here](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW33)\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Working with Swift\"\n}\n[/block]\nYou can easily use the SDK with swift using Objective-C Bridging Header. [Apple](https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html) has some nice documentation on subject.\n\nTo begin, create a new file (File > New > File > iOS > Source > Header File) and name it `YourProjectName-Bridging-Header.h`. Open the file and insert following line to it:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"#import <Razorpay/Razorpay.h>\",\n      \"language\": \"objectivec\",\n      \"name\": \"YourProjectName-Bridging-Header.h\"\n    }\n  ]\n}\n[/block]\nNext, go to your project's build settings, and type \"bridging\" to filter options. Look for an option named `Objective-C Bridging Header` and set its value to path of your file. It may look something like this:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/p7EuDSQXTGGEMUotYpEG_swiftexample-settings.png\",\n        \"swiftexample-settings.png\",\n        \"1756\",\n        \"726\",\n        \"#233e65\",\n        \"\"\n      ],\n      \"caption\": \"(swiftexample is the name of your project)\"\n    }\n  ]\n}\n[/block]\nThen in your ViewController, setup the SDK as follows:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"class ViewController: UIViewController, RazorpayPaymentCompletionProtocol.. {\\n\\n    private var razorpay : Razorpay!\\n    ..\\n    ..\\n    \\n    override func viewDidLoad() {\\n        super.viewDidLoad()\\n        ..\\n        ..\\n        razorpay = Razorpay.initWithKey(\\\"YOUR_PUBLIC_KEY\\\", andDelegate: self)\\n    }\",\n      \"language\": \"swift\",\n      \"name\": \"ViewController.swift\"\n    }\n  ]\n}\n[/block]\nWhen you want to open the checkout form:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"func showPaymentForm() {\\n        let options = [\\n            \\\"amount\\\" : \\\"2000\\\" // and all other options\\n        ]\\n        razorpay.open(options)\\n    }\",\n      \"language\": \"swift\",\n      \"name\": \"ViewController.swift\"\n    }\n  ]\n}\n[/block]\nYou'll need to implement necessary success/failure actions too:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"func onPaymentSuccess(payment_id: String) {\\n        UIAlertView.init(title: \\\"Payment Successful\\\", message: payment_id, delegate: self, cancelButtonTitle: \\\"OK\\\")\\n    }\\n    \\n    func onPaymentError(code: Int32, description str: String) {\\n        UIAlertView.init(title: \\\"Error\\\", message: str, delegate: self, cancelButtonTitle: \\\"OK\\\").show()\\n    }\",\n      \"language\": \"swift\",\n      \"name\": \"ViewController.swift\"\n    }\n  ]\n}\n[/block]","category":"566bdfdecb3d040d00abae18","createdAt":"2015-12-12T08:50:13.060Z","excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","order":1,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"ios","sync_unique":"","title":"iOS","type":"basic","updates":["5704e278849f721900f27859","57a9e2f741903b290016c5af","58429fd9da12a90f0085ab85"],"user":"55830889ea39a9390022432b","version":"54dec8b6c2b4b70d009c3f0f","childrenPages":[]}

iOS


[block:callout] { "type": "warning", "title": "Integration method changed", "body": "We have changed the integration method with this release. We highly recommend you to use the latest SDK. Nevertheless if you wish to stick to the older version, you can find the documentation [here](https://docs.razorpay.com/v1/page/ios-sdk-0100)." } [/block] # v 0.14.1 ### Usage Instructions: ## Step 1: Import library to your project - Download from [here](http://downloads.razorpay.com/Razorpay.framework-0.14.1.zip) and unzip. (For `bitcode` enabled SDK, click [here](http://downloads.razorpay.com/Razorpay.framework-0.14.1-bitcode.zip)). We also have a [CocoaPod](https://cocoapods.org/pods/razorpay-pod) for our SDK (non `bitcode` enabled). - Open your project in XCode and select `Add files to "yourproject"` from `file` menu. - Select Razorpay.framework in the directory you just unzipped. - Make sure 'Copy items if needed' is checked. - Click 'Add'. - In the "Build Settings" tab of your project settings, `-ObjC` flag should be present under "Other Linker Flags". - Under "Link Binary With Libraries" in the "Build Phases" tab of your project settings, add `CoreTelephony.framework` and `SystemConfiguration.framework`. ## Step 2: Initialize Razorpay SDK You'll need your public key and delegate that implements *RazorpayPaymentCompletionProtocol* and view controller where you want to show the checkout form. [block:code] { "codes": [ { "code": "#import <Razorpay/Razorpay.h>\n\n@interface ViewController () <RazorpayPaymentCompletionProtocol> {\n Razorpay *razorpay;\n.. \n..\n \n// Any place before opening the checkout form (eg. viewDidLoad)\n- (void)viewDidLoad {\n [super viewDidLoad];\n ..\n ..\n razorpay = [Razorpay initWithKey:@\"YOUR_PUBLIC_KEY\" andDelegate:self];\n}", "language": "objectivec", "name": "ViewController.m" } ] } [/block] ## Step 3: Pass payment options and show checkout form Add following code to in your ViewController or where ever you want to initialize payments: [block:code] { "codes": [ { "code": "- (void)showPaymentForm { // called by your app\n NSDictionary *options = @{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@\"amount\": @\"1000\", // mandatory, in paise\n\t\t\t\t\t\t\t\t\t\t\t\t\t // all optional other than amount.\n \t\t\t\t\t\t\t\t\t\t@\"image\": @\"https://url-to-image.png\",\n \t\t\t\t\t\t\t\t\t\t\t\t\t@\"name\": @\"business or product name\",\n \t\t\t\t\t\t\t\t\t\t\t\t\t@\"description\": @\"purchase description\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@\"prefill\" : @{ \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@\"email\": @\"pranav@razorpay.com\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@\"contact\": @\"8879524924\"\n \t\t},\n \t\t\t\t\t\t\t\t\t\t\t\t\t@\"theme\": @{\n \t@\"color\": @\"#F37254\"\n }\n \t\t};\n\t\t[razorpay open:options];\n}", "language": "objectivec", "name": "ViewController.m" } ] } [/block] That's pretty much it. You can find the list of all supported options [here](https://docs.razorpay.com/docs/checkout-form#checkout-fields). [block:callout] { "type": "warning", "title": "Progress Bar", "body": "To support theme color in progress bar, please pass HEX color values only." } [/block] ## Step 4: Handle success/error when payment is done This is done by implementing `onPaymentSuccess` and `onPaymentError` methods of the *RazorpayPaymentCompletionProtocol*: [block:code] { "codes": [ { "code": "- (void)onPaymentSuccess:(nonnull NSString*)payment_id {\n \t[[[UIAlertView alloc] initWithTitle:@\"Payment Successful\" message:payment_id delegate:self cancelButtonTitle:@\"OK\" otherButtonTitles:nil] show];\n}\n\n- (void)onPaymentError:(int)code description:(nonnull NSString *)str {\n \t[[[UIAlertView alloc] initWithTitle:@\"Error\" message:str delegate:self cancelButtonTitle:@\"OK\" otherButtonTitles:nil] show];\n}", "language": "objectivec", "name": "ViewController.m" } ] } [/block] Here you have to put necessary actions after payment is completed based on success/error. Possible values for failure code are: * 0: Network error * 1: Initialization failure due to invalid options passed * 2: Payment cancelled by user Success handler will receive `payment_id` which you can use later for capturing purposes. You can call `open` method any number of times. (eg. in case of payment failure, customer might want to retry so you can call the open method with same / different options based on your use case) [block:api-header] { "type": "basic", "title": "iOS9 Update" } [/block] iOS 9 has higher requirements for secure URLs. Unfortunately, many of Indian banks do not comply, which leaves you with following workaround for time being: [block:code] { "codes": [ { "code": "<key>NSAppTransportSecurity</key>\n<dict>\n <key>NSAllowsArbitraryLoads</key>\n <true/>\n</dict>", "language": "xml", "name": "info.plist" } ] } [/block] Add it to your info.plist file. more info [here](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW33) [block:api-header] { "type": "basic", "title": "Working with Swift" } [/block] You can easily use the SDK with swift using Objective-C Bridging Header. [Apple](https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html) has some nice documentation on subject. To begin, create a new file (File > New > File > iOS > Source > Header File) and name it `YourProjectName-Bridging-Header.h`. Open the file and insert following line to it: [block:code] { "codes": [ { "code": "#import <Razorpay/Razorpay.h>", "language": "objectivec", "name": "YourProjectName-Bridging-Header.h" } ] } [/block] Next, go to your project's build settings, and type "bridging" to filter options. Look for an option named `Objective-C Bridging Header` and set its value to path of your file. It may look something like this: [block:image] { "images": [ { "image": [ "https://files.readme.io/p7EuDSQXTGGEMUotYpEG_swiftexample-settings.png", "swiftexample-settings.png", "1756", "726", "#233e65", "" ], "caption": "(swiftexample is the name of your project)" } ] } [/block] Then in your ViewController, setup the SDK as follows: [block:code] { "codes": [ { "code": "class ViewController: UIViewController, RazorpayPaymentCompletionProtocol.. {\n\n private var razorpay : Razorpay!\n ..\n ..\n \n override func viewDidLoad() {\n super.viewDidLoad()\n ..\n ..\n razorpay = Razorpay.initWithKey(\"YOUR_PUBLIC_KEY\", andDelegate: self)\n }", "language": "swift", "name": "ViewController.swift" } ] } [/block] When you want to open the checkout form: [block:code] { "codes": [ { "code": "func showPaymentForm() {\n let options = [\n \"amount\" : \"2000\" // and all other options\n ]\n razorpay.open(options)\n }", "language": "swift", "name": "ViewController.swift" } ] } [/block] You'll need to implement necessary success/failure actions too: [block:code] { "codes": [ { "code": "func onPaymentSuccess(payment_id: String) {\n UIAlertView.init(title: \"Payment Successful\", message: payment_id, delegate: self, cancelButtonTitle: \"OK\")\n }\n \n func onPaymentError(code: Int32, description str: String) {\n UIAlertView.init(title: \"Error\", message: str, delegate: self, cancelButtonTitle: \"OK\").show()\n }", "language": "swift", "name": "ViewController.swift" } ] } [/block]
[block:callout] { "type": "warning", "title": "Integration method changed", "body": "We have changed the integration method with this release. We highly recommend you to use the latest SDK. Nevertheless if you wish to stick to the older version, you can find the documentation [here](https://docs.razorpay.com/v1/page/ios-sdk-0100)." } [/block] # v 0.14.1 ### Usage Instructions: ## Step 1: Import library to your project - Download from [here](http://downloads.razorpay.com/Razorpay.framework-0.14.1.zip) and unzip. (For `bitcode` enabled SDK, click [here](http://downloads.razorpay.com/Razorpay.framework-0.14.1-bitcode.zip)). We also have a [CocoaPod](https://cocoapods.org/pods/razorpay-pod) for our SDK (non `bitcode` enabled). - Open your project in XCode and select `Add files to "yourproject"` from `file` menu. - Select Razorpay.framework in the directory you just unzipped. - Make sure 'Copy items if needed' is checked. - Click 'Add'. - In the "Build Settings" tab of your project settings, `-ObjC` flag should be present under "Other Linker Flags". - Under "Link Binary With Libraries" in the "Build Phases" tab of your project settings, add `CoreTelephony.framework` and `SystemConfiguration.framework`. ## Step 2: Initialize Razorpay SDK You'll need your public key and delegate that implements *RazorpayPaymentCompletionProtocol* and view controller where you want to show the checkout form. [block:code] { "codes": [ { "code": "#import <Razorpay/Razorpay.h>\n\n@interface ViewController () <RazorpayPaymentCompletionProtocol> {\n Razorpay *razorpay;\n.. \n..\n \n// Any place before opening the checkout form (eg. viewDidLoad)\n- (void)viewDidLoad {\n [super viewDidLoad];\n ..\n ..\n razorpay = [Razorpay initWithKey:@\"YOUR_PUBLIC_KEY\" andDelegate:self];\n}", "language": "objectivec", "name": "ViewController.m" } ] } [/block] ## Step 3: Pass payment options and show checkout form Add following code to in your ViewController or where ever you want to initialize payments: [block:code] { "codes": [ { "code": "- (void)showPaymentForm { // called by your app\n NSDictionary *options = @{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@\"amount\": @\"1000\", // mandatory, in paise\n\t\t\t\t\t\t\t\t\t\t\t\t\t // all optional other than amount.\n \t\t\t\t\t\t\t\t\t\t@\"image\": @\"https://url-to-image.png\",\n \t\t\t\t\t\t\t\t\t\t\t\t\t@\"name\": @\"business or product name\",\n \t\t\t\t\t\t\t\t\t\t\t\t\t@\"description\": @\"purchase description\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@\"prefill\" : @{ \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@\"email\": @\"pranav@razorpay.com\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@\"contact\": @\"8879524924\"\n \t\t},\n \t\t\t\t\t\t\t\t\t\t\t\t\t@\"theme\": @{\n \t@\"color\": @\"#F37254\"\n }\n \t\t};\n\t\t[razorpay open:options];\n}", "language": "objectivec", "name": "ViewController.m" } ] } [/block] That's pretty much it. You can find the list of all supported options [here](https://docs.razorpay.com/docs/checkout-form#checkout-fields). [block:callout] { "type": "warning", "title": "Progress Bar", "body": "To support theme color in progress bar, please pass HEX color values only." } [/block] ## Step 4: Handle success/error when payment is done This is done by implementing `onPaymentSuccess` and `onPaymentError` methods of the *RazorpayPaymentCompletionProtocol*: [block:code] { "codes": [ { "code": "- (void)onPaymentSuccess:(nonnull NSString*)payment_id {\n \t[[[UIAlertView alloc] initWithTitle:@\"Payment Successful\" message:payment_id delegate:self cancelButtonTitle:@\"OK\" otherButtonTitles:nil] show];\n}\n\n- (void)onPaymentError:(int)code description:(nonnull NSString *)str {\n \t[[[UIAlertView alloc] initWithTitle:@\"Error\" message:str delegate:self cancelButtonTitle:@\"OK\" otherButtonTitles:nil] show];\n}", "language": "objectivec", "name": "ViewController.m" } ] } [/block] Here you have to put necessary actions after payment is completed based on success/error. Possible values for failure code are: * 0: Network error * 1: Initialization failure due to invalid options passed * 2: Payment cancelled by user Success handler will receive `payment_id` which you can use later for capturing purposes. You can call `open` method any number of times. (eg. in case of payment failure, customer might want to retry so you can call the open method with same / different options based on your use case) [block:api-header] { "type": "basic", "title": "iOS9 Update" } [/block] iOS 9 has higher requirements for secure URLs. Unfortunately, many of Indian banks do not comply, which leaves you with following workaround for time being: [block:code] { "codes": [ { "code": "<key>NSAppTransportSecurity</key>\n<dict>\n <key>NSAllowsArbitraryLoads</key>\n <true/>\n</dict>", "language": "xml", "name": "info.plist" } ] } [/block] Add it to your info.plist file. more info [here](https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW33) [block:api-header] { "type": "basic", "title": "Working with Swift" } [/block] You can easily use the SDK with swift using Objective-C Bridging Header. [Apple](https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html) has some nice documentation on subject. To begin, create a new file (File > New > File > iOS > Source > Header File) and name it `YourProjectName-Bridging-Header.h`. Open the file and insert following line to it: [block:code] { "codes": [ { "code": "#import <Razorpay/Razorpay.h>", "language": "objectivec", "name": "YourProjectName-Bridging-Header.h" } ] } [/block] Next, go to your project's build settings, and type "bridging" to filter options. Look for an option named `Objective-C Bridging Header` and set its value to path of your file. It may look something like this: [block:image] { "images": [ { "image": [ "https://files.readme.io/p7EuDSQXTGGEMUotYpEG_swiftexample-settings.png", "swiftexample-settings.png", "1756", "726", "#233e65", "" ], "caption": "(swiftexample is the name of your project)" } ] } [/block] Then in your ViewController, setup the SDK as follows: [block:code] { "codes": [ { "code": "class ViewController: UIViewController, RazorpayPaymentCompletionProtocol.. {\n\n private var razorpay : Razorpay!\n ..\n ..\n \n override func viewDidLoad() {\n super.viewDidLoad()\n ..\n ..\n razorpay = Razorpay.initWithKey(\"YOUR_PUBLIC_KEY\", andDelegate: self)\n }", "language": "swift", "name": "ViewController.swift" } ] } [/block] When you want to open the checkout form: [block:code] { "codes": [ { "code": "func showPaymentForm() {\n let options = [\n \"amount\" : \"2000\" // and all other options\n ]\n razorpay.open(options)\n }", "language": "swift", "name": "ViewController.swift" } ] } [/block] You'll need to implement necessary success/failure actions too: [block:code] { "codes": [ { "code": "func onPaymentSuccess(payment_id: String) {\n UIAlertView.init(title: \"Payment Successful\", message: payment_id, delegate: self, cancelButtonTitle: \"OK\")\n }\n \n func onPaymentError(code: Int32, description str: String) {\n UIAlertView.init(title: \"Error\", message: str, delegate: self, cancelButtonTitle: \"OK\").show()\n }", "language": "swift", "name": "ViewController.swift" } ] } [/block]
{"__v":2,"_id":"54dec8b7c2b4b70d009c3f19","api":{"auth":"required","examples":{"codes":[]},"method":"get","params":[{"_id":"54ddf6e6c4a3570d009d4955","default":"","desc":"The timestamp in seconds after which the payments were created","in":"query","name":"from","ref":"","required":false,"type":"timestamp"},{"_id":"54ddf6e6c4a3570d009d4954","default":"","desc":"The timestamp in seconds before which payments were created","in":"query","name":"to","ref":"","required":false,"type":"timestamp"},{"_id":"54ddf6e6c4a3570d009d4953","default":"10","desc":"The number of payments to fetch","in":"query","name":"count","ref":"","required":false,"type":"int"},{"_id":"54ddf6e6c4a3570d009d4952","default":"0","desc":"The number of payments to be skipped","in":"query","name":"skip","ref":"","required":false,"type":"int"}],"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      \"service_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      \"service_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/"},"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]","category":"54dec8b7c2b4b70d009c3f11","createdAt":"2015-02-13T13:06:46.896Z","editedParams":true,"editedParams2":true,"excerpt":"Retrieve multiple payments","githubsync":"","hidden":false,"isReference":true,"link_external":false,"link_url":"","next":{"description":"","pages":[]},"order":0,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"payments","sync_unique":"","title":"/payments","type":"get","updates":["58368342e958a60f0012e077"],"user":"54c83ac1ab706219009e067a","version":"54dec8b6c2b4b70d009c3f0f","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]
{"__v":2,"_id":"54dec8b7c2b4b70d009c3f1a","api":{"auth":"required","examples":{"codes":[]},"method":"get","params":[{"_id":"54ddfdca45aa9e170051e68c","default":"","desc":"The id of the payment to be retrieved","in":"path","name":"id","ref":"","required":true,"type":"string"}],"results":{"codes":[{"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    \"service_tax\": 188,\n    \"error_code\": null,\n    \"error_description\": null,\n    \"created_at\": 1400826750\n}","language":"json","status":200},{"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":"","url":"/payments/:id"},"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]","category":"54dec8b7c2b4b70d009c3f11","createdAt":"2015-02-13T13:29:49.756Z","editedParams":true,"editedParams2":true,"excerpt":"Retrieve a Payment by ID","githubsync":"","hidden":false,"isReference":true,"link_external":false,"link_url":"","next":{"description":"","pages":[]},"order":1,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"v1paymentsid","sync_unique":"","title":"/payments/:id","type":"get","updates":["562f5b29eed65e0d008deebe"],"user":"54c83ac1ab706219009e067a","version":"54dec8b6c2b4b70d009c3f0f","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]
{"__v":1,"_id":"54dec8b7c2b4b70d009c3f1b","api":{"auth":"required","examples":{"codes":[]},"method":"post","params":[{"_id":"54de07c33a91410d001b16ad","default":"","desc":"The ID of the payment to capture","name":"id","ref":"","required":true,"type":"string","in":"path"},{"_id":"54de07c33a91410d001b16ac","default":"","desc":"The amount to be captured (should be equal to the authorized amount, in paise)","name":"amount","ref":"","required":true,"type":"string","in":"body"}],"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    \"service_tax\": 188,\n    \"error_code\": null,\n    \"error_description\": null,\n    \"created_at\": 1400826750\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},{"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"},"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.\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]","category":"54dec8b7c2b4b70d009c3f11","createdAt":"2015-02-13T14:18:43.845Z","editedParams":true,"editedParams2":true,"excerpt":"Capture a payment","githubsync":"","hidden":false,"isReference":true,"link_external":false,"link_url":"","next":{"description":"","pages":[]},"order":2,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"v1paymentsidcapture","sync_unique":"","title":"/payments/:id/capture","type":"post","updates":[],"user":"54c83ac1ab706219009e067a","version":"54dec8b6c2b4b70d009c3f0f","childrenPages":[]}

post/payments/:id/capture

Capture a payment

Path Params

id:
required
string
The ID of the payment to capture

Body Params

amount:
required
string
The amount to be captured (should be equal to the authorized amount, in paise)
[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. [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]

Definition

{{ api_url }}{{ page_api_url }}

Result Format



[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. [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]
{"__v":2,"_id":"54dec8b7c2b4b70d009c3f1c","api":{"auth":"required","examples":{"codes":[]},"method":"post","params":[{"_id":"54de08cac4a3570d009d4973","ref":"","required":true,"desc":"The ID of the payment to refund.","default":"","type":"string","name":"id","in":"path"},{"_id":"54de08cac4a3570d009d4972","ref":"","required":false,"desc":"Amount to be refunded, whole amount is refunded if not specified.","default":"","type":"string","name":"amount","in":"body"},{"_id":"5731e3943cc3840e0088a192","ref":"","required":false,"desc":"Array of notes fields. This is validated the same way as the payment.notes field","default":"[]","type":"array_string","name":"notes","in":"body"}],"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"},"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 2-5 days.\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\\nrazorpay.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]","category":"54dec8b7c2b4b70d009c3f11","createdAt":"2015-02-13T14:21:32.434Z","editedParams":true,"editedParams2":true,"excerpt":"Refund a payment","githubsync":"","hidden":false,"isReference":true,"link_external":false,"link_url":"","next":{"description":"","pages":[]},"order":3,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"v1paymentsidrefund","sync_unique":"","title":"/payments/:id/refund","type":"post","updates":[],"user":"54c83ac1ab706219009e067a","version":"54dec8b6c2b4b70d009c3f0f","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 2-5 days. [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\nrazorpay.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 2-5 days. [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\nrazorpay.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]
{"__v":1,"_id":"54dec8b7c2b4b70d009c3f1d","api":{"auth":"required","examples":{"codes":[]},"method":"get","params":[{"_id":"54de09dd3a91410d001b16b6","default":"","desc":"The payment id whose refunds are to be fetched","name":"id","ref":"","required":true,"type":"string","in":"path"},{"_id":"54de09dd3a91410d001b16b5","default":"","desc":"The timestamp in seconds after which the refunds were created","in":"query","name":"from","ref":"","required":false,"type":"timestamp"},{"_id":"54de09dd3a91410d001b16b4","default":"","desc":"The timestamp in seconds before which the refunds were created","in":"query","name":"to","ref":"","required":false,"type":"timestamp"},{"_id":"54de09dd3a91410d001b16b3","default":"10","desc":"The number of refunds to fetch","name":"count","ref":"","required":false,"type":"int","in":"query"},{"_id":"54de09dd3a91410d001b16b2","default":"0","desc":"The number of refunds to be skipped","name":"skip","ref":"","required":false,"type":"int","in":"query"}],"results":{"codes":[{"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","status":200},{"name":"","code":"{\n   \"error\": {\n      \"code\": \"BAD_REQUEST_ERROR\",\n      \"description\": \"The paymentid 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":"","url":"/payments/:id/refunds"},"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\\nrazorpay.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","editedParams":true,"editedParams2":true,"excerpt":"Retrieve multiple refunds of a payment","githubsync":"","hidden":false,"isReference":true,"link_external":false,"link_url":"","next":{"description":"","pages":[]},"order":4,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"v1paymentspaymentidrefunds","sync_unique":"","title":"/payments/:id/refunds","type":"get","updates":[],"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\nrazorpay.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\nrazorpay.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]
{"__v":2,"_id":"54dec8b7c2b4b70d009c3f1e","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"},{"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"},{"language":"csharp","code":"RazorpayClient client = new RazorpayClient(\"<api-key>\", \"<api-secret>\");\nPayment payment = client.Payment.Fetch(paymentId);\n\nRefund refund = payment.Refunds.Fetch(refundId);"},{"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.Payments.fetchRefund(\"<payment_id>\", \"<refund_id>\");\n} catch (RazorpayException e) {\n\t// Handle Exception\n\tSystem.out.println(e.getMessage());\n}"}]},"method":"get","params":[{"_id":"54de0a82c48ad90d00c1876a","default":"","desc":"The id of the payment whose refund is to be retrieved","name":"payment_id","ref":"","required":true,"type":"string","in":"path"},{"_id":"54de0a82c48ad90d00c18769","default":"","desc":"The id of the refund to be retrieved","name":"refund_id","ref":"","required":true,"type":"string","in":"path"}],"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"},"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]","category":"54dec8b7c2b4b70d009c3f11","createdAt":"2015-02-13T14:30:26.211Z","editedParams":true,"editedParams2":true,"excerpt":"Retrieve a refund of payment by id","githubsync":"","hidden":false,"isReference":true,"link_external":false,"link_url":"","next":{"description":"","pages":[]},"order":5,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"v1paymentspaymentidrefundsrefundid","sync_unique":"","title":"/payments/:paymentid/refunds/:refundid","type":"get","updates":["56cabd4f6b58fb0b00c6d32f"],"user":"54c83ac1ab706219009e067a","version":"54dec8b6c2b4b70d009c3f0f","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]
{"__v":1,"_id":"574a8ef8d1d1381900b73fcb","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":[{"_id":"574a8ef8d1d1381900b73fcf","default":"","desc":"The timestamp in seconds after which the refunds were created","in":"query","name":"from","ref":"","required":false,"type":"timestamp"},{"_id":"574a8ef8d1d1381900b73fce","default":"","desc":"The timestamp in seconds after which the refunds were created","in":"query","name":"to","ref":"","required":false,"type":"timestamp"},{"_id":"574a8ef8d1d1381900b73fcd","ref":"","required":false,"desc":"The number of refunds to fetch. Maximum: 100","default":"10","type":"int","name":"count","in":"query"},{"_id":"574a8ef8d1d1381900b73fcc","ref":"","required":false,"desc":"The number of refunds to be skipped","default":"0","type":"int","name":"skip","in":"query"}],"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/"},"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.","category":"54dec8b7c2b4b70d009c3f11","createdAt":"2016-05-29T06:40:56.421Z","editedParams":true,"editedParams2":true,"excerpt":"","githubsync":"","hidden":false,"isReference":true,"link_external":false,"link_url":"","next":{"description":"","pages":[]},"order":6,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"refunds","sync_unique":"","title":"/refunds","type":"get","updates":[],"user":"54f6ab9009da88170095c103","version":"54dec8b6c2b4b70d009c3f0f","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.
{"__v":1,"_id":"574a9054bd8f971700399591","api":{"auth":"required","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":[{"_id":"574a9054bd8f971700399592","ref":"","required":true,"desc":"The id of the refund to be retrieved","default":"","type":"string","name":"id","in":"path"}],"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"},"body":"","category":"54dec8b7c2b4b70d009c3f11","createdAt":"2016-05-29T06:46:44.343Z","editedParams":true,"editedParams2":true,"excerpt":"","githubsync":"","hidden":false,"isReference":true,"link_external":false,"link_url":"","next":{"description":"","pages":[]},"order":7,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"refundsid","sync_unique":"","title":"/refunds/:id","type":"get","updates":[],"user":"54f6ab9009da88170095c103","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



{"__v":1,"_id":"57dbaa97b68b500e00d37366","api":{"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)"}]},"method":"post","params":[{"_id":"57dbaa97b68b500e00d3736b","ref":"","in":"body","required":false,"desc":"Amount of the order to be paid","default":"","type":"int","name":"amount"},{"_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"},{"_id":"57dbaa97b68b500e00d37368","ref":"","in":"body","required":false,"desc":"Whether the payment should be captured automatically or not.","default":"0","type":"boolean","name":"payment_capture"},{"_id":"57dbaa97b68b500e00d37367","ref":"","in":"body","required":false,"desc":"A key-value pair dictionary","default":"","type":"mixed","name":"notes"}],"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":""},{"status":400,"language":"json","code":"{\n   \"error\": {\n      \"code\": \"BAD_REQUEST_ERROR\",\n      \"description\": \"The amount is invalid\",\n      \"field\": \"amount\"\n   }\n}","name":""},{"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"},"body":"This endpoint is used for creating an Order in Razorpay system.","category":"54dec8b7c2b4b70d009c3f11","createdAt":"2016-09-16T08:17:27.144Z","excerpt":"Create an order","githubsync":"","hidden":false,"isReference":true,"link_external":false,"link_url":"","next":{"description":"","pages":[]},"order":8,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"orders","sync_unique":"","title":"/orders","type":"post","updates":[],"user":"54f6ab9009da88170095c103","version":"54dec8b6c2b4b70d009c3f0f","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.
{"__v":1,"_id":"57dbbc717b04b40e00a3038a","api":{"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":[{"_id":"57dbbc717b04b40e00a30390","default":"","desc":"The timestamp in seconds after which the orders were created","in":"query","name":"from","ref":"","required":false,"type":"timestamp"},{"_id":"57dbbc717b04b40e00a3038f","default":"","desc":"The timestamp in seconds before which the orders were created","in":"query","name":"to","ref":"","required":false,"type":"timestamp"},{"_id":"57dbbc717b04b40e00a3038e","default":"10","desc":"The number of orders to fetch. Max is 100.","in":"query","name":"count","ref":"","required":false,"type":"int"},{"_id":"57dbbc717b04b40e00a3038d","ref":"","in":"query","required":false,"desc":"The number of orders to be skipped","default":"0","type":"int","name":"skip"},{"_id":"57dbbc717b04b40e00a3038c","ref":"","in":"query","required":false,"desc":"Orders for which payments are currently in authorized state.","default":"0","type":"boolean","name":"authorized"},{"_id":"57dbbc717b04b40e00a3038b","ref":"","in":"query","required":false,"desc":"Orders with the provided value for receipt.","default":"","type":"string","name":"receipt"}],"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":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":"/orders"},"body":"","category":"54dec8b7c2b4b70d009c3f11","createdAt":"2016-09-16T09:33:37.706Z","excerpt":"","githubsync":"","hidden":false,"isReference":true,"link_external":false,"link_url":"","next":{"description":"","pages":[]},"order":9,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"orders-1","sync_unique":"","title":"/orders","type":"get","updates":[],"user":"54f6ab9009da88170095c103","version":"54dec8b6c2b4b70d009c3f0f","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



{"__v":1,"_id":"57dbc48af4da530e00b3b5a2","api":{"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)"}]},"method":"get","params":[{"_id":"57dbc48af4da530e00b3b5a3","ref":"","in":"path","required":false,"desc":"The id of the order to be retrieved","default":"","type":"string","name":"id"}],"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"},"body":"","category":"54dec8b7c2b4b70d009c3f11","createdAt":"2016-09-16T10:08:10.460Z","excerpt":"","githubsync":"","hidden":false,"isReference":true,"link_external":false,"link_url":"","next":{"description":"","pages":[]},"order":10,"parentDoc":null,"project":"54c83b5aab706219009e067b","slug":"ordersid","sync_unique":"","title":"/orders/:id","type":"get","updates":[],"user":"54f6ab9009da88170095c103","version":"54dec8b6c2b4b70d009c3f0f","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