{"__v":13,"_id":"57022d3797e34517001ffe41","api":{"auth":"required","params":[],"results":{"codes":[]},"settings":"","url":""},"body":"**Instamojo payment experience for buyers**\n\nPayment on Instamojo is a 3 step process\n  * Customer chooses online payment\n  * Customer is handed over to instamojo and sees various payment options \n  * Customer chooses a payment option and completes payment\n\n*After payment, customer is redirected back to your app/website.*\n\n**Developer workflow**\nOnce setup is complete, receiving payments via Instamojo is a simple 3 step process. \n  * Create a payment request \n  * Show payment form to buyer in your app/site. \n  * Get payment.","category":"56a1c9c23845200d0066d702","createdAt":"2016-04-04T09:00:39.609Z","excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","order":0,"parentDoc":null,"project":"56a1c9c13845200d0066d6fe","slug":"overview-and-setup-1","sync_unique":"","title":"Instamojo Payment Experience","type":"basic","updates":["579c526cc6625a0e00a887d2"],"user":"56a1c959842b650d0088899c","version":"56a1c9c23845200d0066d701","childrenPages":[]}

Instamojo Payment Experience


**Instamojo payment experience for buyers** Payment on Instamojo is a 3 step process * Customer chooses online payment * Customer is handed over to instamojo and sees various payment options * Customer chooses a payment option and completes payment *After payment, customer is redirected back to your app/website.* **Developer workflow** Once setup is complete, receiving payments via Instamojo is a simple 3 step process. * Create a payment request * Show payment form to buyer in your app/site. * Get payment.
**Instamojo payment experience for buyers** Payment on Instamojo is a 3 step process * Customer chooses online payment * Customer is handed over to instamojo and sees various payment options * Customer chooses a payment option and completes payment *After payment, customer is redirected back to your app/website.* **Developer workflow** Once setup is complete, receiving payments via Instamojo is a simple 3 step process. * Create a payment request * Show payment form to buyer in your app/site. * Get payment.
{"__v":15,"_id":"570c92ce25b79f0e00b0dcd8","api":{"auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":""},"body":"## **Overview**\n\nInstamojo payments work by creating request URLs which can accept payments. Creating a request is as simple as passing an `amount` and a `purpose`. This step generates a *Payment Request ID*.\n\nOnce a request is created, you can use the request URL to accept a payment in your mobile app, website or application.\n\nUsing the *Payment Request ID* you can display a payment form to your customers. Your customer can choose a payment method of their choice and make a payment. Once a payment is made, you will receive a *Payment ID*.\n\n##**Setup**\n\n**Sign up on Instamojo.**  \nSigning up will create your API key and Auth token. You will need these to create requests. \nBase URL: https://www.instamojo.com/api/1.1/payment-requests/","category":"56a1c9c23845200d0066d702","createdAt":"2016-04-12T06:16:46.475Z","excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","order":1,"parentDoc":null,"project":"56a1c9c13845200d0066d6fe","slug":"overview-and-setup-2","sync_unique":"","title":"Overview and Setup","type":"basic","updates":["572bed9373c5671700a7aba2"],"user":"56a1c959842b650d0088899c","version":"56a1c9c23845200d0066d701","childrenPages":[]}

Overview and Setup


## **Overview** Instamojo payments work by creating request URLs which can accept payments. Creating a request is as simple as passing an `amount` and a `purpose`. This step generates a *Payment Request ID*. Once a request is created, you can use the request URL to accept a payment in your mobile app, website or application. Using the *Payment Request ID* you can display a payment form to your customers. Your customer can choose a payment method of their choice and make a payment. Once a payment is made, you will receive a *Payment ID*. ##**Setup** **Sign up on Instamojo.** Signing up will create your API key and Auth token. You will need these to create requests. Base URL: https://www.instamojo.com/api/1.1/payment-requests/
## **Overview** Instamojo payments work by creating request URLs which can accept payments. Creating a request is as simple as passing an `amount` and a `purpose`. This step generates a *Payment Request ID*. Once a request is created, you can use the request URL to accept a payment in your mobile app, website or application. Using the *Payment Request ID* you can display a payment form to your customers. Your customer can choose a payment method of their choice and make a payment. Once a payment is made, you will receive a *Payment ID*. ##**Setup** **Sign up on Instamojo.** Signing up will create your API key and Auth token. You will need these to create requests. Base URL: https://www.instamojo.com/api/1.1/payment-requests/
{"__v":74,"_id":"57021416747d6d0e0076fdf4","api":{"auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":""},"body":"##Integration steps\n\n  * Create a Payment request\n  * Redirect payer to request link\n  * Handle successful/failed payments\n   * Webhook \n   * Redirect \n  * Query status of a Payment requests\n  * Additional features\n   * Refunds\n   * Collecting fees\n   * Hold and Release \n   * Light Checkout\n\n## Create a Payment request\nGet the final amount from your cart total and call the Create a Request endpoint of our API. The values of fields like `amount`, `buyer_name`, `email`, and `phone` are straight-forward. The values of `send_email` and `send_sms` should be `false`. \n\nThe `purpose` field can be used to pass the custom data (unique identifier) created on your end. This is going to be useful later on to identify the order using this custom data (unique identifier) for which a particular payment was made. \n\n##Redirect payer to request link\n\nThe Payment link creation will return a `longurl`, this URL can be used to get the payment from the user. \n\n##Post payment processing\n\n**Redirect**\n\nOnce the payment is done user will be redirected to the `redirect_url` specified during the link creation and we will append two more query arguments with it: `payment_id` and `payment_request_id`. \n\nExample:\n\nIf your `redirect_url` was http://www.example.com then user will be redirected to something like: http://www.example.com?payment_id=MOJO5a06005J21512197&payment_request_id=d66cb29dd059482e8072999f995c4eef \n\nNow using the `payment_request_id` and `payment_id` you can query our Get Payment Details endpoint to get the details related to the Request and Payment.\n\n**Webhook**\n\nWebhook is the URL to which we send the payment details as a POST request. Note that the content type of this request is `application/x-www-form-urlencoded`.\n\nFollowing fields are sent with the webhook request:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Example value\",\n    \"0-0\": \"amount\",\n    \"0-1\": \"Amount related to the payment\",\n    \"0-2\": \"2500.00\",\n    \"1-0\": \"buyer\",\n    \"1-1\": \"Buyer's email\",\n    \"1-2\": \"foo@example.com\",\n    \"2-0\": \"buyer_name\",\n    \"2-1\": \"Buyer's name\",\n    \"2-2\": \"John Doe\",\n    \"3-0\": \"buyer_phone\",\n    \"3-2\": \"9999999999\",\n    \"3-1\": \"Buyer's phone number\",\n    \"4-0\": \"currency\",\n    \"4-1\": \"Currency related to the payment\",\n    \"4-2\": \"INR\",\n    \"5-0\": \"fees\",\n    \"5-1\": \"Fees charged by Instamojo\",\n    \"5-2\": \"125.00\",\n    \"6-0\": \"longurl\",\n    \"6-1\": \"URL related to the payment request\",\n    \"6-2\": \"https://www.instamojo.com/@ashwch/d66cb29dd059482e8072999f995c4eef\",\n    \"7-0\": \"mac\",\n    \"8-0\": \"payment_id\",\n    \"9-0\": \"payment_request_id\",\n    \"10-0\": \"purpose\",\n    \"11-0\": \"shorturl\",\n    \"12-0\": \"status\",\n    \"12-1\": \"Status of the Payment. This can be either \\\"Credit\\\" or \\\"Failed\\\".\",\n    \"12-2\": \"Credit\",\n    \"11-1\": \"Short URL of the payment request\",\n    \"10-1\": \"Purpose of the Payment request\",\n    \"10-2\": \"FIFA 16\",\n    \"8-2\": \"MOJO5a06005J21512197\",\n    \"9-2\": \"d66cb29dd059482e8072999f995c4eef\",\n    \"7-2\": \"1ddf3b78f84d071324c0bf1d3f095898267d60ee\",\n    \"11-2\": \"https://imjo.in/NNxHg\",\n    \"7-1\": \"Message Authentication code of this webhook request\",\n    \"8-1\": \"ID of the payment\",\n    \"9-1\": \"ID of the payment request\"\n  },\n  \"cols\": 3,\n  \"rows\": 13\n}\n[/block]\nFor more information on how to validate the webhook request using `mac` read: [What is the Message Authentication Code in Webhook?](http://support.instamojo.com/support/solutions/articles/139575-what-is-the-message-authentication-code-in-webhook-)\n\n\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\n<?php\\n/*\\nBasic PHP script to handle Instamojo RAP webhook.\\n*/\\n\\n$data = $_POST;\\n$mac_provided = $data['mac'];  // Get the MAC from the POST data\\nunset($data['mac']);  // Remove the MAC key from the data.\\n$ver = explode('.', phpversion());\\n$major = (int) $ver[0];\\n$minor = (int) $ver[1];\\nif($major >= 5 and $minor >= 4){\\n     ksort($data, SORT_STRING | SORT_FLAG_CASE);\\n}\\nelse{\\n     uksort($data, 'strcasecmp');\\n}\\n// You can get the 'salt' from Instamojo's developers page(make sure to log in first): https://www.instamojo.com/developers\\n// Pass the 'salt' without <>\\n$mac_calculated = hash_hmac(\\\"sha1\\\", implode(\\\"|\\\", $data), \\\"<YOUR_SALT>\\\");\\nif($mac_provided == $mac_calculated){\\n    if($data['status'] == \\\"Credit\\\"){\\n        // Payment was successful, mark it as successful in your database.\\n        // You can acess payment_request_id, purpose etc here. \\n    }\\n    else{\\n        // Payment was unsuccessful, mark it as failed in your database.\\n        // You can acess payment_request_id, purpose etc here.\\n    }\\n}\\nelse{\\n    echo \\\"MAC mismatch\\\";\\n}\\n?>\",\n      \"language\": \"php\"\n    },\n    {\n      \"code\": \"import hmac\\nimport hashlib \\nfrom BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler\\nimport urlparse\\n\\n\\nPORT = 8000\\n \\nclass MojoHandler(BaseHTTPRequestHandler):\\n\\n  def do_POST(self):\\n\\n      content_length = int(self.headers['content-length'])\\n      querystring = self.rfile.read(content_length)\\n      data = urlparse.parse_qs(querystring)\\n      mac_provided = data.pop('mac')\\n      message = \\\"|\\\".join(v for k, v in sorted(data.items(), key=lambda x: x[0].lower()))\\n      # Pass the 'salt' without the <>.\\n      mac_calculated = hmac.new(\\\"<YOUR_SALT>\\\", message, hashlib.sha1).hexdigest()\\n      if mac_provided == mac_calculated:\\n          if data['status'] == \\\"Credit\\\":\\n              # Payment was successful, mark it as completed in your database.\\n          else:\\n              # Payment was unsuccessful, mark it as failed in your database.\\n          self.send_response(200)\\n      else:\\n          self.send_response(400)\\n      self.send_header('Content-type', 'text/html')\\n      self.end_headers()\\n\\nhttpd = HTTPServer(('', PORT), MojoHandler)\\nhttpd.serve_forever()\\n\\n\\n\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]\nWe recommend passing both `webhook` and `redirect_url` URLs while creating the Payment link because users sometimes close the tab before redirection can happen and in that case webhook request comes in handy and will save you from manual updation of database.\n\n##**ADDITIONAL FEATURES**\n\n**Light Checkout **\n\t\nWith Light Checkout, the payment form loads faster and takes the payer directly to the final payment page.  The payer is taken to the final payment page only if `buyer_name`, `email` and `phone` were supplied during request creation, else the payer will have to fill these details in before paying.\n\nTo use light checkout, simply append `?embed=form` at the end of your request URL.\n\nStandard request URL: https://www.instamojo.com/@ashwch/d66cb29dd059482e8072999f995c4eef\nLight checkout URL: https://www.instamojo.com/@ashwch/d66cb29dd059482e8072999f995c4eef?embed=form\n\n**Floating Checkout**\n\nAllow customers to pay without leaving your website.\nCreate an embeddable checkout with just a few lines of code.\nJust replace `REQUEST_URL` with your request url in the snippet below and you're good to go.\n\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<a href=\\\"REQUEST_URL\\\" rel=\\\"im-checkout\\\" data-behaviour=\\\"remote\\\" data-style=\\\"light\\\" data-text=\\\"Checkout With Instamojo\\\"></a>\\n<script src=\\\"https://d2xwmjc4uy2hr5.cloudfront.net/im-embed/im-embed.min.js\\\"></script>\",\n      \"language\": \"html\",\n      \"name\": \"Checkout snippet\"\n    }\n  ]\n}\n[/block]\nThe above code stylises the button with the default light green for light backgrounds with (data-style=\"light\")\n\n*All styling options*\nFor light backgrounds (Green button): data-style=\"light\"\nFor dark backgrounds (Yellow button) : data-style=\"dark\"\nFlat button for light backgrounds : data-style=\"flat\"\nFlat button for dark backgrounds : data-style=\"flat-dark\"\nNo styling : data-style=\"no-style\"\n\n**[Marketplace] Collecting fees**\n\nNote: This is applicable to only those creating requests on behalf of others using our Marketplace APIs system.\n\nTo collect fees for payments facilitated by your systems, simply pass the following additional parameters when creating a payment request.\n\nFixed fee - \"partner_fee_type\": \"fixed\", \"partner_fee\": \"XX.YY\"\nPercentage fee - \"partner_fee_type\": \"percent\", \"partner_fee\": \"XX.YY\"\n\n**[Marketplace] Hold and Release**\n\nSuccessful payments are paid out/released automatically within 3 days. \nIn case you want to the hold the release till you get fulfilment of service/confirmation of delivery you can use the below.\n\nIf you wish to ensure that the payment is placed on hold until you explicitly mark the payment as fulfilled, then you need to pass the following additional key and value to the above API call:\n\n`\"mark_fulfilled\" : false`\n\nReleasing the payment:\n\nNow, suppose a payment request has been created and a payment with the payment ID `MOJO0000000X11111111` has been made against that payment request. \n\nAfter some time, if that payment needs to be released, then all that needs to be done is to send a POST request (with no parameters) to the following endpoint: \n\n`/v2/payments/MOJO0000000X11111111/fulfil/`","category":"56a1c9c23845200d0066d702","createdAt":"2016-04-04T07:13:26.162Z","excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","order":2,"parentDoc":null,"project":"56a1c9c13845200d0066d6fe","slug":"payments-api","sync_unique":"","title":"Integration guide","type":"basic","updates":[],"user":"56a1c959842b650d0088899c","version":"56a1c9c23845200d0066d701","childrenPages":[]}

Integration guide


##Integration steps * Create a Payment request * Redirect payer to request link * Handle successful/failed payments * Webhook * Redirect * Query status of a Payment requests * Additional features * Refunds * Collecting fees * Hold and Release * Light Checkout ## Create a Payment request Get the final amount from your cart total and call the Create a Request endpoint of our API. The values of fields like `amount`, `buyer_name`, `email`, and `phone` are straight-forward. The values of `send_email` and `send_sms` should be `false`. The `purpose` field can be used to pass the custom data (unique identifier) created on your end. This is going to be useful later on to identify the order using this custom data (unique identifier) for which a particular payment was made. ##Redirect payer to request link The Payment link creation will return a `longurl`, this URL can be used to get the payment from the user. ##Post payment processing **Redirect** Once the payment is done user will be redirected to the `redirect_url` specified during the link creation and we will append two more query arguments with it: `payment_id` and `payment_request_id`. Example: If your `redirect_url` was http://www.example.com then user will be redirected to something like: http://www.example.com?payment_id=MOJO5a06005J21512197&payment_request_id=d66cb29dd059482e8072999f995c4eef Now using the `payment_request_id` and `payment_id` you can query our Get Payment Details endpoint to get the details related to the Request and Payment. **Webhook** Webhook is the URL to which we send the payment details as a POST request. Note that the content type of this request is `application/x-www-form-urlencoded`. Following fields are sent with the webhook request: [block:parameters] { "data": { "h-0": "Field", "h-1": "Description", "h-2": "Example value", "0-0": "amount", "0-1": "Amount related to the payment", "0-2": "2500.00", "1-0": "buyer", "1-1": "Buyer's email", "1-2": "foo@example.com", "2-0": "buyer_name", "2-1": "Buyer's name", "2-2": "John Doe", "3-0": "buyer_phone", "3-2": "9999999999", "3-1": "Buyer's phone number", "4-0": "currency", "4-1": "Currency related to the payment", "4-2": "INR", "5-0": "fees", "5-1": "Fees charged by Instamojo", "5-2": "125.00", "6-0": "longurl", "6-1": "URL related to the payment request", "6-2": "https://www.instamojo.com/@ashwch/d66cb29dd059482e8072999f995c4eef", "7-0": "mac", "8-0": "payment_id", "9-0": "payment_request_id", "10-0": "purpose", "11-0": "shorturl", "12-0": "status", "12-1": "Status of the Payment. This can be either \"Credit\" or \"Failed\".", "12-2": "Credit", "11-1": "Short URL of the payment request", "10-1": "Purpose of the Payment request", "10-2": "FIFA 16", "8-2": "MOJO5a06005J21512197", "9-2": "d66cb29dd059482e8072999f995c4eef", "7-2": "1ddf3b78f84d071324c0bf1d3f095898267d60ee", "11-2": "https://imjo.in/NNxHg", "7-1": "Message Authentication code of this webhook request", "8-1": "ID of the payment", "9-1": "ID of the payment request" }, "cols": 3, "rows": 13 } [/block] For more information on how to validate the webhook request using `mac` read: [What is the Message Authentication Code in Webhook?](http://support.instamojo.com/support/solutions/articles/139575-what-is-the-message-authentication-code-in-webhook-) [block:code] { "codes": [ { "code": "\n<?php\n/*\nBasic PHP script to handle Instamojo RAP webhook.\n*/\n\n$data = $_POST;\n$mac_provided = $data['mac']; // Get the MAC from the POST data\nunset($data['mac']); // Remove the MAC key from the data.\n$ver = explode('.', phpversion());\n$major = (int) $ver[0];\n$minor = (int) $ver[1];\nif($major >= 5 and $minor >= 4){\n ksort($data, SORT_STRING | SORT_FLAG_CASE);\n}\nelse{\n uksort($data, 'strcasecmp');\n}\n// You can get the 'salt' from Instamojo's developers page(make sure to log in first): https://www.instamojo.com/developers\n// Pass the 'salt' without <>\n$mac_calculated = hash_hmac(\"sha1\", implode(\"|\", $data), \"<YOUR_SALT>\");\nif($mac_provided == $mac_calculated){\n if($data['status'] == \"Credit\"){\n // Payment was successful, mark it as successful in your database.\n // You can acess payment_request_id, purpose etc here. \n }\n else{\n // Payment was unsuccessful, mark it as failed in your database.\n // You can acess payment_request_id, purpose etc here.\n }\n}\nelse{\n echo \"MAC mismatch\";\n}\n?>", "language": "php" }, { "code": "import hmac\nimport hashlib \nfrom BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler\nimport urlparse\n\n\nPORT = 8000\n \nclass MojoHandler(BaseHTTPRequestHandler):\n\n def do_POST(self):\n\n content_length = int(self.headers['content-length'])\n querystring = self.rfile.read(content_length)\n data = urlparse.parse_qs(querystring)\n mac_provided = data.pop('mac')\n message = \"|\".join(v for k, v in sorted(data.items(), key=lambda x: x[0].lower()))\n # Pass the 'salt' without the <>.\n mac_calculated = hmac.new(\"<YOUR_SALT>\", message, hashlib.sha1).hexdigest()\n if mac_provided == mac_calculated:\n if data['status'] == \"Credit\":\n # Payment was successful, mark it as completed in your database.\n else:\n # Payment was unsuccessful, mark it as failed in your database.\n self.send_response(200)\n else:\n self.send_response(400)\n self.send_header('Content-type', 'text/html')\n self.end_headers()\n\nhttpd = HTTPServer(('', PORT), MojoHandler)\nhttpd.serve_forever()\n\n\n", "language": "python" } ] } [/block] We recommend passing both `webhook` and `redirect_url` URLs while creating the Payment link because users sometimes close the tab before redirection can happen and in that case webhook request comes in handy and will save you from manual updation of database. ##**ADDITIONAL FEATURES** **Light Checkout ** With Light Checkout, the payment form loads faster and takes the payer directly to the final payment page. The payer is taken to the final payment page only if `buyer_name`, `email` and `phone` were supplied during request creation, else the payer will have to fill these details in before paying. To use light checkout, simply append `?embed=form` at the end of your request URL. Standard request URL: https://www.instamojo.com/@ashwch/d66cb29dd059482e8072999f995c4eef Light checkout URL: https://www.instamojo.com/@ashwch/d66cb29dd059482e8072999f995c4eef?embed=form **Floating Checkout** Allow customers to pay without leaving your website. Create an embeddable checkout with just a few lines of code. Just replace `REQUEST_URL` with your request url in the snippet below and you're good to go. [block:code] { "codes": [ { "code": "<a href=\"REQUEST_URL\" rel=\"im-checkout\" data-behaviour=\"remote\" data-style=\"light\" data-text=\"Checkout With Instamojo\"></a>\n<script src=\"https://d2xwmjc4uy2hr5.cloudfront.net/im-embed/im-embed.min.js\"></script>", "language": "html", "name": "Checkout snippet" } ] } [/block] The above code stylises the button with the default light green for light backgrounds with (data-style="light") *All styling options* For light backgrounds (Green button): data-style="light" For dark backgrounds (Yellow button) : data-style="dark" Flat button for light backgrounds : data-style="flat" Flat button for dark backgrounds : data-style="flat-dark" No styling : data-style="no-style" **[Marketplace] Collecting fees** Note: This is applicable to only those creating requests on behalf of others using our Marketplace APIs system. To collect fees for payments facilitated by your systems, simply pass the following additional parameters when creating a payment request. Fixed fee - "partner_fee_type": "fixed", "partner_fee": "XX.YY" Percentage fee - "partner_fee_type": "percent", "partner_fee": "XX.YY" **[Marketplace] Hold and Release** Successful payments are paid out/released automatically within 3 days. In case you want to the hold the release till you get fulfilment of service/confirmation of delivery you can use the below. If you wish to ensure that the payment is placed on hold until you explicitly mark the payment as fulfilled, then you need to pass the following additional key and value to the above API call: `"mark_fulfilled" : false` Releasing the payment: Now, suppose a payment request has been created and a payment with the payment ID `MOJO0000000X11111111` has been made against that payment request. After some time, if that payment needs to be released, then all that needs to be done is to send a POST request (with no parameters) to the following endpoint: `/v2/payments/MOJO0000000X11111111/fulfil/`
##Integration steps * Create a Payment request * Redirect payer to request link * Handle successful/failed payments * Webhook * Redirect * Query status of a Payment requests * Additional features * Refunds * Collecting fees * Hold and Release * Light Checkout ## Create a Payment request Get the final amount from your cart total and call the Create a Request endpoint of our API. The values of fields like `amount`, `buyer_name`, `email`, and `phone` are straight-forward. The values of `send_email` and `send_sms` should be `false`. The `purpose` field can be used to pass the custom data (unique identifier) created on your end. This is going to be useful later on to identify the order using this custom data (unique identifier) for which a particular payment was made. ##Redirect payer to request link The Payment link creation will return a `longurl`, this URL can be used to get the payment from the user. ##Post payment processing **Redirect** Once the payment is done user will be redirected to the `redirect_url` specified during the link creation and we will append two more query arguments with it: `payment_id` and `payment_request_id`. Example: If your `redirect_url` was http://www.example.com then user will be redirected to something like: http://www.example.com?payment_id=MOJO5a06005J21512197&payment_request_id=d66cb29dd059482e8072999f995c4eef Now using the `payment_request_id` and `payment_id` you can query our Get Payment Details endpoint to get the details related to the Request and Payment. **Webhook** Webhook is the URL to which we send the payment details as a POST request. Note that the content type of this request is `application/x-www-form-urlencoded`. Following fields are sent with the webhook request: [block:parameters] { "data": { "h-0": "Field", "h-1": "Description", "h-2": "Example value", "0-0": "amount", "0-1": "Amount related to the payment", "0-2": "2500.00", "1-0": "buyer", "1-1": "Buyer's email", "1-2": "foo@example.com", "2-0": "buyer_name", "2-1": "Buyer's name", "2-2": "John Doe", "3-0": "buyer_phone", "3-2": "9999999999", "3-1": "Buyer's phone number", "4-0": "currency", "4-1": "Currency related to the payment", "4-2": "INR", "5-0": "fees", "5-1": "Fees charged by Instamojo", "5-2": "125.00", "6-0": "longurl", "6-1": "URL related to the payment request", "6-2": "https://www.instamojo.com/@ashwch/d66cb29dd059482e8072999f995c4eef", "7-0": "mac", "8-0": "payment_id", "9-0": "payment_request_id", "10-0": "purpose", "11-0": "shorturl", "12-0": "status", "12-1": "Status of the Payment. This can be either \"Credit\" or \"Failed\".", "12-2": "Credit", "11-1": "Short URL of the payment request", "10-1": "Purpose of the Payment request", "10-2": "FIFA 16", "8-2": "MOJO5a06005J21512197", "9-2": "d66cb29dd059482e8072999f995c4eef", "7-2": "1ddf3b78f84d071324c0bf1d3f095898267d60ee", "11-2": "https://imjo.in/NNxHg", "7-1": "Message Authentication code of this webhook request", "8-1": "ID of the payment", "9-1": "ID of the payment request" }, "cols": 3, "rows": 13 } [/block] For more information on how to validate the webhook request using `mac` read: [What is the Message Authentication Code in Webhook?](http://support.instamojo.com/support/solutions/articles/139575-what-is-the-message-authentication-code-in-webhook-) [block:code] { "codes": [ { "code": "\n<?php\n/*\nBasic PHP script to handle Instamojo RAP webhook.\n*/\n\n$data = $_POST;\n$mac_provided = $data['mac']; // Get the MAC from the POST data\nunset($data['mac']); // Remove the MAC key from the data.\n$ver = explode('.', phpversion());\n$major = (int) $ver[0];\n$minor = (int) $ver[1];\nif($major >= 5 and $minor >= 4){\n ksort($data, SORT_STRING | SORT_FLAG_CASE);\n}\nelse{\n uksort($data, 'strcasecmp');\n}\n// You can get the 'salt' from Instamojo's developers page(make sure to log in first): https://www.instamojo.com/developers\n// Pass the 'salt' without <>\n$mac_calculated = hash_hmac(\"sha1\", implode(\"|\", $data), \"<YOUR_SALT>\");\nif($mac_provided == $mac_calculated){\n if($data['status'] == \"Credit\"){\n // Payment was successful, mark it as successful in your database.\n // You can acess payment_request_id, purpose etc here. \n }\n else{\n // Payment was unsuccessful, mark it as failed in your database.\n // You can acess payment_request_id, purpose etc here.\n }\n}\nelse{\n echo \"MAC mismatch\";\n}\n?>", "language": "php" }, { "code": "import hmac\nimport hashlib \nfrom BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler\nimport urlparse\n\n\nPORT = 8000\n \nclass MojoHandler(BaseHTTPRequestHandler):\n\n def do_POST(self):\n\n content_length = int(self.headers['content-length'])\n querystring = self.rfile.read(content_length)\n data = urlparse.parse_qs(querystring)\n mac_provided = data.pop('mac')\n message = \"|\".join(v for k, v in sorted(data.items(), key=lambda x: x[0].lower()))\n # Pass the 'salt' without the <>.\n mac_calculated = hmac.new(\"<YOUR_SALT>\", message, hashlib.sha1).hexdigest()\n if mac_provided == mac_calculated:\n if data['status'] == \"Credit\":\n # Payment was successful, mark it as completed in your database.\n else:\n # Payment was unsuccessful, mark it as failed in your database.\n self.send_response(200)\n else:\n self.send_response(400)\n self.send_header('Content-type', 'text/html')\n self.end_headers()\n\nhttpd = HTTPServer(('', PORT), MojoHandler)\nhttpd.serve_forever()\n\n\n", "language": "python" } ] } [/block] We recommend passing both `webhook` and `redirect_url` URLs while creating the Payment link because users sometimes close the tab before redirection can happen and in that case webhook request comes in handy and will save you from manual updation of database. ##**ADDITIONAL FEATURES** **Light Checkout ** With Light Checkout, the payment form loads faster and takes the payer directly to the final payment page. The payer is taken to the final payment page only if `buyer_name`, `email` and `phone` were supplied during request creation, else the payer will have to fill these details in before paying. To use light checkout, simply append `?embed=form` at the end of your request URL. Standard request URL: https://www.instamojo.com/@ashwch/d66cb29dd059482e8072999f995c4eef Light checkout URL: https://www.instamojo.com/@ashwch/d66cb29dd059482e8072999f995c4eef?embed=form **Floating Checkout** Allow customers to pay without leaving your website. Create an embeddable checkout with just a few lines of code. Just replace `REQUEST_URL` with your request url in the snippet below and you're good to go. [block:code] { "codes": [ { "code": "<a href=\"REQUEST_URL\" rel=\"im-checkout\" data-behaviour=\"remote\" data-style=\"light\" data-text=\"Checkout With Instamojo\"></a>\n<script src=\"https://d2xwmjc4uy2hr5.cloudfront.net/im-embed/im-embed.min.js\"></script>", "language": "html", "name": "Checkout snippet" } ] } [/block] The above code stylises the button with the default light green for light backgrounds with (data-style="light") *All styling options* For light backgrounds (Green button): data-style="light" For dark backgrounds (Yellow button) : data-style="dark" Flat button for light backgrounds : data-style="flat" Flat button for dark backgrounds : data-style="flat-dark" No styling : data-style="no-style" **[Marketplace] Collecting fees** Note: This is applicable to only those creating requests on behalf of others using our Marketplace APIs system. To collect fees for payments facilitated by your systems, simply pass the following additional parameters when creating a payment request. Fixed fee - "partner_fee_type": "fixed", "partner_fee": "XX.YY" Percentage fee - "partner_fee_type": "percent", "partner_fee": "XX.YY" **[Marketplace] Hold and Release** Successful payments are paid out/released automatically within 3 days. In case you want to the hold the release till you get fulfilment of service/confirmation of delivery you can use the below. If you wish to ensure that the payment is placed on hold until you explicitly mark the payment as fulfilled, then you need to pass the following additional key and value to the above API call: `"mark_fulfilled" : false` Releasing the payment: Now, suppose a payment request has been created and a payment with the payment ID `MOJO0000000X11111111` has been made against that payment request. After some time, if that payment needs to be released, then all that needs to be done is to send a POST request (with no parameters) to the following endpoint: `/v2/payments/MOJO0000000X11111111/fulfil/`
{"__v":2,"_id":"570ca2fa1e76a70e00678f1f","api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl https://www.instamojo.com/api/1.1/payment-requests/ \\\n  --header \"X-Api-Key: d82016f839e13cd0a79afc0ef5b288b3\" \\\n  --header \"X-Auth-Token: 3827881f669c11e8dad8a023fd1108c2\" \\\n  --data \"allow_repeated_payments=False&amount=2500&buyer_name=John+Doe&purpose=FIFA+16&redirect_url=http%3A%2F%2Fwww.example.com%2Fredirect%2F&phone=9999999999&send_email=True&webhook=http%3A%2F%2Fwww.example.com%2Fwebhook%2F&send_sms=True&email=foo%40example.com\""},{"language":"python","code":"import requests\n\nheaders = { \"X-Api-Key\": \"d82016f839e13cd0a79afc0ef5b288b3\", \"X-Auth-Token\": \"3827881f669c11e8dad8a023fd1108c2\"}\npayload = {\n  'purpose': 'FIFA 16',\n  'amount': '2500',\n  'buyer_name': 'John Doe',\n  'email': 'foo@example.com',\n  'phone': '9999999999',\n  'redirect_url': 'http://www.example.com/redirect/',\n  'send_email': 'True',\n  'send_sms': 'True',\n  'webhook': 'http://www.example.com/webhook/',\n  'allow_repeated_payments': 'False',\n}\nresponse = requests.post(\"https://www.instamojo.com/api/1.1/payment-requests/\", data=payload, headers=headers)\n\nprint response.text"},{"name":"Node","language":"javascript","code":"var request= require('request');\n\nvar headers = { 'X-Api-Key': 'd82016f839e13cd0a79afc0ef5b288b3', 'X-Auth-Token': '3827881f669c11e8dad8a023fd1108c2'}\nvar payload = {\n  purpose: 'FIFA 16',\n  amount: '2500',\n  phone: '9999999999',\n  buyer_name: 'John Doe',\n  redirect_url: 'http://www.example.com/redirect/',\n  send_email: true,\n  webhook: 'http://www.example.com/webhook/',\n  send_sms: true,\n  email: 'foo@example.com',\n  allow_repeated_payments: false}\n\nrequest.post('https://www.instamojo.com/api/1.1/payment-requests/', {form: payload,  headers: headers}, function(error, response, body){\n  if(!error && response.statusCode == 201){\n    console.log(body);\n  }\n})"},{"code":"<?php\n\n$ch = curl_init();\n\ncurl_setopt($ch, CURLOPT_URL, 'https://www.instamojo.com/api/1.1/payment-requests/');\ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\ncurl_setopt($ch, CURLOPT_HTTPHEADER,\n            array(\"X-Api-Key:d82016f839e13cd0a79afc0ef5b288b3\",\n                  \"X-Auth-Token:3827881f669c11e8dad8a023fd1108c2\"));\n$payload = Array(\n    'purpose' => 'FIFA 16',\n    'amount' => '2500',\n    'phone' => '9999999999',\n    'buyer_name' => 'John Doe',\n    'redirect_url' => 'http://www.example.com/redirect/',\n    'send_email' => true,\n    'webhook' => 'http://www.example.com/webhook/',\n    'send_sms' => true,\n    'email' => 'foo@example.com',\n    'allow_repeated_payments' => false\n);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($payload));\n$response = curl_exec($ch);\ncurl_close($ch); \n\necho $response;\n\n?>","language":"php","name":null},{"language":"ruby","code":"require 'faraday'\n\nheaders = {\"X-Api-Key\" => \"d82016f839e13cd0a79afc0ef5b288b3\", \"X-Auth-Token\" => \"3827881f669c11e8dad8a023fd1108c2\"}\npayload = {\n  purpose: 'FIFA 16',\n  amount: '2500',\n  buyer_name: 'John Doe',\n  email: 'foo@example.com',\n  phone: '9999999999',\n  redirect_url: 'http://www.example.com/redirect/',\n  send_email: true,\n  send_sms: true,\n  webhook: 'http://www.example.com/webhook/',\n  allow_repeated_payments: false,\n}\nconn = Faraday.new(:url => 'https://www.instamojo.com/api/1.1/', :headers => headers)\nresponse = conn.post 'payment-requests/', payload\nputs response.body"}]},"params":[{"_id":"570ca2fa1e76a70e00678f21","default":"","desc":"Amount to be paid  in XX.YY format","name":"amount","ref":"","required":true,"type":"string","in":"body"},{"_id":"570ca2fa1e76a70e00678f20","default":"","desc":"Purpose of payment","name":"purpose","ref":"","required":true,"type":"string","in":"body"},{"_id":"570ca4b739ef110e0014f616","ref":"","required":false,"desc":"Name of payer","default":"","type":"string","name":"buyer_name","in":"body"},{"_id":"570ca4b739ef110e0014f615","ref":"","required":false,"desc":"Email of payer","default":"","type":"string","name":"email","in":"body"},{"_id":"570ca4b739ef110e0014f614","default":"","desc":"Phone number of person paying","name":"phone","ref":"","required":false,"type":"string","in":"body"},{"_id":"570ca4b739ef110e0014f613","default":"","desc":"URL where we redirect the user after a payment. If provided, we will redirect the user to `redirect_url` immediately after the payment has been processed. Two additional query arguments `payment_request_id` and `payment_id` are also sent with the redirect URL.","name":"redirect_url","ref":"","required":false,"type":"string","in":"body"},{"_id":"570ca4b739ef110e0014f612","default":"","desc":"URL where our server do POST request after a payment  If provided, we will do a the POST request to the webhook (url) with full details of the payment","name":"webhook","ref":"","required":false,"type":"string","in":"body"},{"_id":"570ca4b739ef110e0014f611","default":"true","desc":"If `allow_repeated_payments` is `false`, only one payment can be paid on a payment request link. `allow_repeated_payments` is `true` by default.","name":"allow_repeated_payments","ref":"","required":false,"type":"boolean","in":"body"},{"_id":"570ca6171e76a70e00678f27","default":"","desc":"[Marketplace] Allows you to receive a cut from from payments you facilitate. For fixed fee `partner_fee_type` = `\"fixed\"`, `partner_fee` = `\"XX.YY\"`.  For Percentage fee `partner_fee_type` =  `\"percent\"`, `partner_fee` =  `\"XX.YY\"`.","name":"partner_fee_type","ref":"","required":false,"type":"string","in":"body"},{"_id":"570ca6171e76a70e00678f26","default":"false","desc":"Flag to send request link via email.  If `send_email` is `true`, a request email will be sent to the email supplied. If `send_email` is `true` but no email is supplied, request creation will throw an error.","name":"send_email","ref":"","required":false,"type":"boolean","in":"body"},{"_id":"570ca6171e76a70e00678f25","default":"false","desc":"Flag to send request link via SMS.  If `send_sms` is `true`, a request SMS will be sent to the phone number supplied. If `send_sms` is `true` but no phone number is supplied, request creation will throw an error.","name":"send_sms","ref":"","required":false,"type":"boolean","in":"body"}],"results":{"codes":[{"status":201,"language":"json","code":"{\n    \"payment_request\": {\n        \"id\": \"d66cb29dd059482e8072999f995c4eef\",\n        \"phone\": \"+919999999999\",\n        \"email\": \"foo@example.com\",\n        \"buyer_name\": \"John Doe\",\n        \"amount\": \"2500\",\n        \"purpose\": \"FIFA 16\",\n        \"status\": \"Pending\",\n        \"send_sms\": true,\n        \"send_email\": true,\n        \"sms_status\": \"Pending\",\n        \"email_status\": \"Pending\",\n        \"shorturl\": null,\n        \"longurl\": \"https://www.instamojo.com/@ashwch/d66cb29dd059482e8072999f995c4eef/\",\n        \"redirect_url\": \"http://www.example.com/redirect/\",\n        \"webhook\": \"http://www.example.com/webhook/\",\n        \"created_at\": \"2015-10-07T21:36:34.665Z\",\n        \"modified_at\": \"2015-10-07T21:36:34.665Z\",\n        \"allow_repeated_payments\": false\n    },\n    \"success\": true\n}","name":""},{"status":400,"language":"json","code":"{\n    \"success\": false,\n    \"message\": {\n        \"amount\": [\n            \"This field is required.\"\n        ]\n    }\n}","name":""},{"status":401,"language":"text","code":"{\n    \"success\": false,\n    \"message\": \"Invalid Auth Token.\"\n}"}]},"settings":"","url":"/payment-requests/"},"body":"**Required Headers:**\n - X-Api-Key\n - X-Auth-Token\n\n\n**Highly Recommended fields:**\n\nThe following 3 fields are details of the person making the payment. If not sent when creating a payment request, the payer will have to fill it in while paying. Supplying these fields will speed up the payment process for your customers \n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"buyer_name\",\n    \"0-1\": \"Name of payer\",\n    \"1-0\": \"email\",\n    \"1-1\": \"Email of the payer\",\n    \"2-0\": \"phone\",\n    \"2-1\": \"Phone number of payer\"\n  },\n  \"cols\": 2,\n  \"rows\": 3\n}\n[/block]\nNote that the `shorturl` is not available right away, hence to get its value you can query our Get Request Info endpoint. \n\nFew other fields that can change with this request are:\n\n - `status`\n - `sms_status`\n - `email_status`\n\n`status` field can have one of these values:\n - `Pending`: Both email and SMS(whichever applicable) are not yet sent.\n - `Sent`: Either email or SMS(whichever applicable) is sent to the payer.\n - `Failed`: Both email and SMS(whichever applicable) failed to deliver to the user.\n - `Completed`: Payment was made by a payer.\n \n`sms_status` and `email_status` fields can have one of these values:\n - `Pending`: Request not yet sent from our end.\n - `Failed`: Request failed.\n - `Sent`: Request sent to the payer.\n - `Null`: Field not applicable, i.e when `send_email` and/or `send_sms` is set to `false`","category":"570caa32df099419002fe21a","createdAt":"2016-04-12T07:25:46.636Z","editedParams":true,"editedParams2":true,"excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","order":0,"parentDoc":null,"project":"56a1c9c13845200d0066d6fe","slug":"create-a-request","sync_unique":"","title":"Create a Request","type":"post","updates":[],"user":"56a1c959842b650d0088899c","version":"56a1c9c23845200d0066d701","childrenPages":[]}

postCreate a Request


amount:
required
string
Amount to be paid in XX.YY format
purpose:
required
string
Purpose of payment
buyer_name:
string
Name of payer
email:
string
Email of payer
phone:
string
Phone number of person paying
redirect_url:
string
URL where we redirect the user after a payment. If provided, we will redirect the user to `redirect_url` immediately after the payment has been processed. Two additional query arguments `payment_request_id` and `payment_id` are also sent with the redirect URL.
webhook:
string
URL where our server do POST request after a payment If provided, we will do a the POST request to the webhook (url) with full details of the payment
allow_repeated_payments:
booleantrue
If `allow_repeated_payments` is `false`, only one payment can be paid on a payment request link. `allow_repeated_payments` is `true` by default.
partner_fee_type:
string
[Marketplace] Allows you to receive a cut from from payments you facilitate. For fixed fee `partner_fee_type` = `"fixed"`, `partner_fee` = `"XX.YY"`. For Percentage fee `partner_fee_type` = `"percent"`, `partner_fee` = `"XX.YY"`.
send_email:
booleanfalse
Flag to send request link via email. If `send_email` is `true`, a request email will be sent to the email supplied. If `send_email` is `true` but no email is supplied, request creation will throw an error.
send_sms:
booleanfalse
Flag to send request link via SMS. If `send_sms` is `true`, a request SMS will be sent to the phone number supplied. If `send_sms` is `true` but no phone number is supplied, request creation will throw an error.
**Required Headers:** - X-Api-Key - X-Auth-Token **Highly Recommended fields:** The following 3 fields are details of the person making the payment. If not sent when creating a payment request, the payer will have to fill it in while paying. Supplying these fields will speed up the payment process for your customers [block:parameters] { "data": { "0-0": "buyer_name", "0-1": "Name of payer", "1-0": "email", "1-1": "Email of the payer", "2-0": "phone", "2-1": "Phone number of payer" }, "cols": 2, "rows": 3 } [/block] Note that the `shorturl` is not available right away, hence to get its value you can query our Get Request Info endpoint. Few other fields that can change with this request are: - `status` - `sms_status` - `email_status` `status` field can have one of these values: - `Pending`: Both email and SMS(whichever applicable) are not yet sent. - `Sent`: Either email or SMS(whichever applicable) is sent to the payer. - `Failed`: Both email and SMS(whichever applicable) failed to deliver to the user. - `Completed`: Payment was made by a payer. `sms_status` and `email_status` fields can have one of these values: - `Pending`: Request not yet sent from our end. - `Failed`: Request failed. - `Sent`: Request sent to the payer. - `Null`: Field not applicable, i.e when `send_email` and/or `send_sms` is set to `false`

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



**Required Headers:** - X-Api-Key - X-Auth-Token **Highly Recommended fields:** The following 3 fields are details of the person making the payment. If not sent when creating a payment request, the payer will have to fill it in while paying. Supplying these fields will speed up the payment process for your customers [block:parameters] { "data": { "0-0": "buyer_name", "0-1": "Name of payer", "1-0": "email", "1-1": "Email of the payer", "2-0": "phone", "2-1": "Phone number of payer" }, "cols": 2, "rows": 3 } [/block] Note that the `shorturl` is not available right away, hence to get its value you can query our Get Request Info endpoint. Few other fields that can change with this request are: - `status` - `sms_status` - `email_status` `status` field can have one of these values: - `Pending`: Both email and SMS(whichever applicable) are not yet sent. - `Sent`: Either email or SMS(whichever applicable) is sent to the payer. - `Failed`: Both email and SMS(whichever applicable) failed to deliver to the user. - `Completed`: Payment was made by a payer. `sms_status` and `email_status` fields can have one of these values: - `Pending`: Request not yet sent from our end. - `Failed`: Request failed. - `Sent`: Request sent to the payer. - `Null`: Field not applicable, i.e when `send_email` and/or `send_sms` is set to `false`
{"__v":7,"_id":"5714c17012b19c0e00ec16d8","api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl https://www.instamojo.com/api/1.1/payment-requests/ --header \"X-Api-Key: d82016f839e13cd0a79afc0ef5b288b3\" --header \"X-Auth-Token: 3827881f669c11e8dad8a023fd1108c2\""},{"language":"python","code":"import requests\n\nheaders = { \"X-Api-Key\": \"d82016f839e13cd0a79afc0ef5b288b3\", \"X-Auth-Token\": \"3827881f669c11e8dad8a023fd1108c2\"}\n\nresponse = requests.get(\"https://www.instamojo.com/api/1.1/payment-requests/\", headers=headers)\n\nprint response.text"},{"name":"Node","language":"javascript","code":"var request= require('request');\n\nvar headers = { 'X-Api-Key': 'd82016f839e13cd0a79afc0ef5b288b3', 'X-Auth-Token': '3827881f669c11e8dad8a023fd1108c2'}\n\nrequest.get('https://www.instamojo.com/api/1.1/payment-requests/', {headers: headers}, function(error, response, body){\n  if(!error && response.statusCode == 200){\n    console.log(body);\n  }\n})"},{"language":"php","code":"<?php\n\n$ch = curl_init();\n\ncurl_setopt($ch, CURLOPT_URL, 'https://www.instamojo.com/api/1.1/payment-requests/');\ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\ncurl_setopt($ch, CURLOPT_HTTPHEADER,\n            array(\"X-Api-Key:d82016f839e13cd0a79afc0ef5b288b3\",\n                  \"X-Auth-Token:3827881f669c11e8dad8a023fd1108c2\"));\n$payload = Array(\n    'purpose' => 'FIFA 16',\n    'amount' => '2500',\n    'phone' => '9999999999',\n    'buyer_name' => 'John Doe',\n    'redirect_url' => 'http://www.example.com/redirect/',\n    'send_email' => true,\n    'webhook' => 'http://www.example.com/webhook/',\n    'send_sms' => true,\n    'email' => 'foo@example.com',\n    'allow_repeated_payments' => false\n);\n$response = curl_exec($ch);\ncurl_close($ch); \n\necho $response;\n\n?>"},{"language":"ruby","code":"require 'faraday'\n\nheaders = {\"X-Api-Key\" => \"d82016f839e13cd0a79afc0ef5b288b3\", \"X-Auth-Token\" => \"3827881f669c11e8dad8a023fd1108c2\"}\nconn = Faraday.new(:url => 'https://www.instamojo.com/api/1.1/', :headers => headers)\nresponse = conn.get 'payment-requests/'\nputs response.body"}]},"params":[],"results":{"codes":[{"status":200,"language":"json","code":"{\n    \"success\": true,\n    \"payment_requests\": [\n        {\n        \"id\": \"d66cb29dd059482e8072999f995c4eef\",\n        \"phone\": \"+919999999999\",\n        \"email\": \"foo@example.com\",\n        \"buyer_name\": \"John Doe\",\n        \"amount\": \"2500\",\n        \"purpose\": \"FIFA 16\",\n        \"status\": \"Pending\",\n        \"send_sms\": true,\n        \"send_email\": true,\n        \"sms_status\": \"Pending\",\n        \"email_status\": \"Pending\",\n        \"shorturl\": null,\n        \"longurl\": \"https://www.instamojo.com/@ashwch/d66cb29dd059482e8072999f995c4eef/\",\n        \"redirect_url\": \"http://www.example.com/redirect/\",\n        \"webhook\": \"http://www.example.com/webhook/\",\n        \"created_at\": \"2015-10-07T21:36:34.665Z\",\n        \"modified_at\": \"2015-10-07T21:36:34.665Z\",\n        \"allow_repeated_payments\": false\n        }\n    ]\n}","name":""},{"status":401,"language":"json","code":"{\n    \"success\": false,\n    \"message\": \"Invalid Auth Token.\"\n}","name":""}]},"settings":"","url":"/payment-requests/"},"body":"This endpoint returns a list of all payment requests created so far.\n\n**Required Headers:**\n - X-Api-Key\n - X-Auth-Token","category":"570caa32df099419002fe21a","createdAt":"2016-04-18T11:13:52.882Z","excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","order":1,"parentDoc":null,"project":"56a1c9c13845200d0066d6fe","slug":"get-list-of-payment-requests","sync_unique":"","title":"List of Requests","type":"get","updates":[],"user":"56a1c959842b650d0088899c","version":"56a1c9c23845200d0066d701","childrenPages":[]}

getList of Requests


This endpoint returns a list of all payment requests created so far. **Required Headers:** - X-Api-Key - X-Auth-Token

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



This endpoint returns a list of all payment requests created so far. **Required Headers:** - X-Api-Key - X-Auth-Token
{"__v":3,"_id":"570c9f6025b79f0e00b0dcf7","api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl https://www.instamojo.com/api/1.1/payment-requests/92e58bd771414d05a5e443b0a85f8b43/ --header \"X-Api-Key: d82016f839e13cd0a79afc0ef5b288b3\" --header \"X-Auth-Token: 3827881f669c11e8dad8a023fd1108c2\""},{"name":"Python","language":"python","code":"import requests\n\nheaders = { \"X-Api-Key\": \"d82016f839e13cd0a79afc0ef5b288b3\", \"X-Auth-Token\": \"3827881f669c11e8dad8a023fd1108c2\"}\nresponse = requests.get(\n  \"https://www.instamojo.com/api/1.1/payment-requests/d66cb29dd059482e8072999f995c4eef/\",\n  headers=headers)\n\nprint response.text"},{"name":"Node","language":"javascript","code":"var request = require('request');\n\nvar headers = { 'X-Api-Key': 'd82016f839e13cd0a79afc0ef5b288b3', 'X-Auth-Token': '3827881f669c11e8dad8a023fd1108c2'}\n\nrequest.get('https://www.instamojo.com/api/1.1/payment-requests/d66cb29dd059482e8072999f995c4eef/', {headers: headers}, function(error, response, body){\n  if(!error && response.statusCode == 200){\n    console.log(body);\n  }\n})"},{"language":"php","code":"<?php\n\n$ch = curl_init();\n\ncurl_setopt($ch, CURLOPT_URL, 'https://www.instamojo.com/api/1.1/payment-requests/d66cb29dd059482e8072999f995c4eef/');\ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\ncurl_setopt($ch, CURLOPT_HTTPHEADER,\n            array(\"X-Api-Key:d82016f839e13cd0a79afc0ef5b288b3\",\n                  \"X-Auth-Token:3827881f669c11e8dad8a023fd1108c2\"));\n$payload = Array(\n    'purpose' => 'FIFA 16',\n    'amount' => '2500',\n    'phone' => '9999999999',\n    'buyer_name' => 'John Doe',\n    'redirect_url' => 'http://www.example.com/redirect/',\n    'send_email' => true,\n    'webhook' => 'http://www.example.com/webhook/',\n    'send_sms' => true,\n    'email' => 'foo@example.com',\n    'allow_repeated_payments' => false\n);\n$response = curl_exec($ch);\ncurl_close($ch); \n\necho $response;\n\n?>"},{"language":"ruby","code":"require 'faraday'\n\nheaders = {\"X-Api-Key\" => \"d82016f839e13cd0a79afc0ef5b288b3\", \"X-Auth-Token\" => \"3827881f669c11e8dad8a023fd1108c2\"}\nconn = Faraday.new(:url => 'https://www.instamojo.com/api/1.1/', :headers => headers)\nresponse = conn.get 'payment-requests/d66cb29dd059482e8072999f995c4eef/'\nputs response.body\n"}]},"params":[{"_id":"570ca0c3e5f8280e006b1ac2","default":"","desc":"ID of the Request","name":"id","ref":"","required":true,"type":"string","in":"path"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n    \"payment_request\": {\n        \"id\": \"d66cb29dd059482e8072999f995c4eef\",\n        \"phone\": \"+919999999999\",\n        \"email\": \"foo@example.com\",\n        \"buyer_name\": \"John Doe\",\n        \"amount\": \"2500.00\",\n        \"purpose\": \"FIFA 16\",\n        \"status\": \"Sent\",\n        \"send_sms\": true,\n        \"send_email\": true,\n        \"sms_status\": \"Pending\",\n        \"email_status\": \"Sent\",\n        \"shorturl\": \"https://imjo.in/NNxHg\",\n        \"longurl\": \"https://www.instamojo.com/@ashwini/d66cb29dd059482e8072999f995c4eef\",\n        \"redirect_url\": \"http://www.example.com/redirect/\",\n        \"webhook\": \"http://www.example.com/webhook/\",\n        \"payments\": [],\n        \"created_at\": \"2015-10-07T21:36:34.665Z\",\n        \"modified_at\": \"2015-10-07T21:36:37.572Z\",\n        \"allow_repeated_payments\": false\n    },\n    \"success\": true\n}","name":""},{"status":401,"language":"json","code":"{\n    \"success\": false,\n    \"message\": \"Invalid Auth Token.\"\n}","name":""}]},"settings":"","url":"/payment-requests/:id/"},"body":"Use this endpoint to get the details of a particular payment request.\n\n**Required Headers:**\n - X-Api-Key\n - X-Auth-Token","category":"570caa32df099419002fe21a","createdAt":"2016-04-12T07:10:24.825Z","editedParams":true,"editedParams2":true,"excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","order":2,"parentDoc":null,"project":"56a1c9c13845200d0066d6fe","slug":"get-details-of-request","sync_unique":"","title":"Get Request Details","type":"get","updates":[],"user":"56a1c959842b650d0088899c","version":"56a1c9c23845200d0066d701","childrenPages":[]}

getGet Request Details


id:
required
string
ID of the Request
Use this endpoint to get the details of a particular payment request. **Required Headers:** - X-Api-Key - X-Auth-Token

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



Use this endpoint to get the details of a particular payment request. **Required Headers:** - X-Api-Key - X-Auth-Token
{"__v":0,"_id":"5714bd5eb9061c0e00d122bf","api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl https://www.instamojo.com/api/1.1/payment-requests/d66cb29dd059482e8072999f995c4eef/MOJO5a06005J21512197/ \\\n--header \"X-Api-Key: d82016f839e13cd0a79afc0ef5b288b3\" \\\n--header \"X-Auth-Token: 3827881f669c11e8dad8a023fd1108c2\""},{"language":"python","code":"import requests\n\nheaders = { \"X-Api-Key\": \"d82016f839e13cd0a79afc0ef5b288b3\", \"X-Auth-Token\": \"3827881f669c11e8dad8a023fd1108c2\"}\nresponse = requests.get(\n  \"https://www.instamojo.com/api/1.1/payment-requests/d66cb29dd059482e8072999f995c4eef/MOJO5a06005J21512197/\",\n  headers=headers)\n\nprint response.text"},{"name":"Node","language":"javascript","code":"var request= require('request');\n\nvar headers = { 'X-Api-Key': 'd82016f839e13cd0a79afc0ef5b288b3', 'X-Auth-Token': '3827881f669c11e8dad8a023fd1108c2'}\nrequest.get(\n  'https://www.instamojo.com/api/1.1/payment-requests/d66cb29dd059482e8072999f995c4eef/MOJO5a06005J21512197/',\n  {form: payload,  headers: headers}, function(error, response, body){\n      if(!error && response.statusCode == 200)\n          {console.log(body)}\n})"},{"language":"php","code":"<?php\n\n$ch = curl_init();\n\ncurl_setopt($ch, CURLOPT_URL, 'https://www.instamojo.com/api/1.1/payment-requests/d66cb29dd059482e8072999f995c4eef/MOJO5a06005J21512197/');\ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\ncurl_setopt($ch, CURLOPT_HTTPHEADER,\n            array(\"X-Api-Key:d82016f839e13cd0a79afc0ef5b288b3\",\n                  \"X-Auth-Token:3827881f669c11e8dad8a023fd1108c2\"));\n$payload = Array(\n    'purpose' => 'FIFA 16',\n    'amount' => '2500',\n    'phone' => '9999999999',\n    'buyer_name' => 'John Doe',\n    'redirect_url' => 'http://www.example.com/redirect/',\n    'send_email' => true,\n    'webhook' => 'http://www.example.com/webhook/',\n    'send_sms' => true,\n    'email' => 'foo@example.com',\n    'allow_repeated_payments' => false\n);\n$response = curl_exec($ch);\ncurl_close($ch); \n\necho $response;\n\n?>"},{"language":"ruby","code":"require 'faraday'\n\nheaders = {\"X-Api-Key\" => \"d82016f839e13cd0a79afc0ef5b288b3\", \"X-Auth-Token\" => \"3827881f669c11e8dad8a023fd1108c2\"}\nconn = Faraday.new(:url => 'https://www.instamojo.com/api/1.1/', :headers => headers)\nresponse = conn.get 'payment-requests/d66cb29dd059482e8072999f995c4eef/MOJO5a06005J21512197/'\nputs response.body\n"}]},"params":[{"_id":"5714bd5eb9061c0e00d122c1","default":"","desc":"ID of the payment request","name":"id","ref":"","required":true,"type":"string","in":"path"},{"_id":"5714bd5eb9061c0e00d122c0","default":"","desc":"ID of the payment","name":"payment_id","ref":"","required":true,"type":"string","in":"path"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"payment_request\": {\n    \"id\": \"d66cb29dd059482e8072999f995c4eef\",\n    \"phone\": null,\n    \"email\": \"foo@example.com\",\n    \"buyer_name\": \"John Doe\",\n    \"amount\": \"2500.00\",\n    \"purpose\": \"FIFA 16\",\n    \"status\": \"Completed\",\n    \"send_sms\": true,\n    \"send_email\": true,\n    \"sms_status\": \"Pending\",\n    \"email_status\": \"Pending\",\n    \"shorturl\": \"https://imjo.in/NNxHg\",\n    \"longurl\": \"https://www.instamojo.com/@ashwch/d66cb29dd059482e8072999f995c4eef\",\n    \"redirect_url\": \"http://www.example.com/redirect/\",\n    \"webhook\": \"http://www.example.com/webhook/\",\n    \"payment\": {\n      \"payment_id\": \"MOJO5a06005J21512197\",\n      \"quantity\": 1,\n      \"status\": \"Credit\",\n      \"link_slug\": null,\n      \"link_title\": null,\n      \"buyer_name\": \"John Doe\",\n      \"buyer_phone\": \"+919999999999\",\n      \"buyer_email\": \"foo@example.com\",\n      \"currency\": \"INR\",\n      \"unit_price\": \"2500.00\",\n      \"amount\": \"2500.00\",\n      \"fees\": \"125.00\",\n      \"shipping_address\": null,\n      \"shipping_city\": null,\n      \"shipping_state\": null,\n      \"shipping_zip\": null,\n      \"shipping_country\": null,\n      \"discount_code\": null,\n      \"discount_amount_off\": null,\n      \"variants\": [],\n      \"custom_fields\": {},\n      \"affiliate_id\": null,\n      \"affiliate_commission\": \"0\",\n      \"created_at\": \"2015-12-27T21:01:51.879Z\"\n    },\n    \"created_at\": \"2015-10-07T21:36:34.665Z\",\n    \"modified_at\": \"2015-10-07T21:36:34.665Z\",\n    \"allow_repeated_payments\": false\n  },\n  \"success\": true\n}","name":""},{"status":401,"language":"json","code":"{\n    \"success\": false,\n    \"message\": \"Invalid Auth Token.\"\n}","name":""}]},"settings":"","url":"/payment-requests/:id/:payment_id/"},"body":"This endpoint returns the details of a payment related to a particular payment request.\n\nTo check whether the payment was successful or not use the `\"status\"` key inside the `\"payment\"` dictionary. If the status is `\"Credit\"` then the payment was successful otherwise it failed.\n\n**Required Headers:**\n - X-Api-Key\n - X-Auth-Token","category":"570caa32df099419002fe21a","createdAt":"2016-04-18T10:56:30.825Z","editedParams":true,"editedParams2":true,"excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","order":3,"parentDoc":null,"project":"56a1c9c13845200d0066d6fe","slug":"get-details-of-payment","sync_unique":"","title":"Get Payment Details","type":"get","updates":[],"user":"56a1c959842b650d0088899c","version":"56a1c9c23845200d0066d701","childrenPages":[]}

getGet Payment Details


id:
required
string
ID of the payment request
payment_id:
required
string
ID of the payment
This endpoint returns the details of a payment related to a particular payment request. To check whether the payment was successful or not use the `"status"` key inside the `"payment"` dictionary. If the status is `"Credit"` then the payment was successful otherwise it failed. **Required Headers:** - X-Api-Key - X-Auth-Token

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



This endpoint returns the details of a payment related to a particular payment request. To check whether the payment was successful or not use the `"status"` key inside the `"payment"` dictionary. If the status is `"Credit"` then the payment was successful otherwise it failed. **Required Headers:** - X-Api-Key - X-Auth-Token
{"__v":2,"_id":"570cabef5fac770e00b67d9e","api":{"auth":"required","examples":{"codes":[{"code":"curl https://www.instamojo.com/api/1.1/refunds/ \\\n  --header \"X-Api-Key: d82016f839e13cd0a79afc0ef5b288b3\" \\\n  --header \"X-Auth-Token: 3827881f669c11e8dad8a023fd1108c2\" \\\n  --data \"payment_id=MOJO5a06005J21512197&type=QFL\"\n","language":"curl"},{"language":"python","code":"import requests\n\nheaders = { \"X-Api-Key\": \"d82016f839e13cd0a79afc0ef5b288b3\", \"X-Auth-Token\": \"3827881f669c11e8dad8a023fd1108c2\"}\npayload = {\n  \"payment_id\": \"MOJO5a06005J21512197\",\n  \"type\": \"QFL\",\n  \"body\": \"Customer isn't satisfied with the quality\"\n}\nresponse = requests.post(\"https://www.instamojo.com/api/1.1/refunds/\", data=payload, headers=headers)\n\nprint response.text"},{"language":"javascript","code":"var request= require('request');\n\nvar headers = { 'X-Api-Key': 'd82016f839e13cd0a79afc0ef5b288b3', 'X-Auth-Token': '3827881f669c11e8dad8a023fd1108c2'}\npayload = {\n  payment_id: \"MOJO5a06005J21512197\",\n  type: \"QFL\",\n  body: \"Customer isn't satisfied with the quality\"\n}\n\nrequest.post('https://www.instamojo.com/api/1.1/refunds/', {form: payload,  headers: headers}, function(error, response, body){\n  if(!error && response.statusCode == 201){\n    console.log(body);\n  }\n})\n","name":"Node"},{"code":"<?php\n\n$ch = curl_init();\n\ncurl_setopt($ch, CURLOPT_URL, 'https://www.instamojo.com/api/1.1/refunds/');\ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\ncurl_setopt($ch, CURLOPT_HTTPHEADER,\n            array(\"X-Api-Key:d82016f839e13cd0a79afc0ef5b288b3\",\n                  \"X-Auth-Token:3827881f669c11e8dad8a023fd1108c2\"));\n$payload = Array(\n    'payment_id' => 'MOJO5a06005J21512197',\n    'type' => 'QFL',\n    'body' => \"Customer isn't satisfied with the quality\"\n);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($payload));\n$response = curl_exec($ch);\ncurl_close($ch); \n\necho $response;\n\n?>","language":"php"},{"language":"ruby","code":"require 'faraday'\n\nheaders = {\"X-Api-Key\" => \"d82016f839e13cd0a79afc0ef5b288b3\", \"X-Auth-Token\" => \"3827881f669c11e8dad8a023fd1108c2\"}\npayload = {\n  payment_id: \"MOJO5a06005J21512197\",\n  type: \"QFL\",\n  body: \"Customer isn't satisfied with the quality\"\n}\nconn = Faraday.new(:url => 'https://www.instamojo.com/api/1.1/', :headers => headers)\nresponse = conn.post 'refunds/', payload\nputs response.body\n"}]},"params":[{"_id":"570cabef5fac770e00b67da0","ref":"","required":true,"desc":"Payment ID of the payment against which you're initiating the refund.","default":"","type":"int","name":"payment_id","in":"body"},{"_id":"570cabef5fac770e00b67d9f","ref":"","required":true,"desc":"A three letter short-code identifying the reason for this case.","default":"","type":"string","name":"type","in":"body"},{"_id":"570cac32df099419002fe220","ref":"","required":false,"desc":"This field can be used to specify the refund amount. Default is paid amount.","default":"Paid amount","type":"string","name":"refund_amount","in":"body"},{"_id":"5714c8be12b19c0e00ec16e5","ref":"","required":false,"desc":"Additonal text explaining the refund.","default":"","type":"string","name":"body","in":"body"}],"results":{"codes":[{"name":"","code":"{\n   \"refund\": {\n        \"id\": \"C5c0751269\",\n        \"payment_id\": \"MOJO5a06005J21512197\",\n        \"status\": \"Refunded\",\n        \"type\": \"QFL\",\n        \"body\": \"Customer isn't satisfied with the quality\",\n        \"refund_amount\": \"2500.00\",\n        \"total_amount\": \"2500.00\",\n        \"created_at\": \"2015-12-07T11:01:37.640Z\"\n    },\n    \"success\": true\n}","language":"json","status":201},{"name":"","code":"{}","language":"json","status":400},{"status":401,"language":"json","code":"{\n    \"success\": false,\n    \"message\": \"Invalid Auth Token.\"\n}"}]},"settings":"","url":"/refunds/"},"body":"**Required Headers:**\n - X-Api-Key\n - X-Auth-Token\n\n**Valid values for **type** parameter:**\n - `RFD`: Duplicate/delayed payment.\n - `TNR`: Product/service no longer available.\n - `QFL`: Customer not satisfied.\n - `QNR`: Product lost/damaged.\n - `EWN`: Digital download issue.\n - `TAN`: Event was canceled/changed.\n - `PTH`: Problem not described above.","category":"570caa32df099419002fe21a","createdAt":"2016-04-12T08:03:59.984Z","editedParams":true,"editedParams2":true,"excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","order":4,"parentDoc":null,"project":"56a1c9c13845200d0066d6fe","slug":"creating-a-refund","sync_unique":"","title":"Creating a Refund","type":"post","updates":[],"user":"56a1c959842b650d0088899c","version":"56a1c9c23845200d0066d701","childrenPages":[]}

postCreating a Refund


payment_id:
required
integer
Payment ID of the payment against which you're initiating the refund.
type:
required
string
A three letter short-code identifying the reason for this case.
refund_amount:
stringPaid amount
This field can be used to specify the refund amount. Default is paid amount.
body:
string
Additonal text explaining the refund.
**Required Headers:** - X-Api-Key - X-Auth-Token **Valid values for **type** parameter:** - `RFD`: Duplicate/delayed payment. - `TNR`: Product/service no longer available. - `QFL`: Customer not satisfied. - `QNR`: Product lost/damaged. - `EWN`: Digital download issue. - `TAN`: Event was canceled/changed. - `PTH`: Problem not described above.

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



**Required Headers:** - X-Api-Key - X-Auth-Token **Valid values for **type** parameter:** - `RFD`: Duplicate/delayed payment. - `TNR`: Product/service no longer available. - `QFL`: Customer not satisfied. - `QNR`: Product lost/damaged. - `EWN`: Digital download issue. - `TAN`: Event was canceled/changed. - `PTH`: Problem not described above.
{"__v":7,"_id":"570cacdc8c9c351900d187c3","api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl https://www.instamojo.com/api/1.1/refunds/ \\\n  --header \"X-Api-Key: d82016f839e13cd0a79afc0ef5b288b3\" \\\n  --header \"X-Auth-Token: 3827881f669c11e8dad8a023fd1108c2\""},{"language":"python","code":"import requests\n\nheaders = { \"X-Api-Key\": \"d82016f839e13cd0a79afc0ef5b288b3\", \"X-Auth-Token\":  \"3827881f669c11e8dad8a023fd1108c2\"}\n\nresponse = requests.get(\"https://www.instamojo.com/api/1.1/refunds/\", headers=headers)\nprint response.text"},{"name":"Node","language":"javascript","code":"var request= require('request');\n\nvar headers = { 'X-Api-Key': 'd82016f839e13cd0a79afc0ef5b288b3', 'X-Auth-Token': '3827881f669c11e8dad8a023fd1108c2'}\n\nrequest.get('https://www.instamojo.com/api/1.1/refunds/', {headers: headers}, function(error, response, body){\n  if(!error && response.statusCode == 200){\n    console.log(body);\n  }\n})"},{"language":"php","code":"<?php\n\n$ch = curl_init();\n\ncurl_setopt($ch, CURLOPT_URL, 'https://www.instamojo.com/api/1.1/refunds/');\ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\ncurl_setopt($ch, CURLOPT_HTTPHEADER,\n            array(\"X-Api-Key:d82016f839e13cd0a79afc0ef5b288b3\",\n                  \"X-Auth-Token:3827881f669c11e8dad8a023fd1108c2\"));\n$payload = Array(\n    'payment_id' => 'MOJO5a06005J21512197',\n    'type' => 'QFL',\n    'body' => \"Customer isn't satisfied with the quality\"\n);\n$response = curl_exec($ch);\ncurl_close($ch); \n\necho $response;\n\n?>"},{"language":"ruby","code":"require 'faraday'\n\nheaders = {\"X-Api-Key\" => \"d82016f839e13cd0a79afc0ef5b288b3\", \"X-Auth-Token\" => \"3827881f669c11e8dad8a023fd1108c2\"}\nconn = Faraday.new(:url => 'https://www.instamojo.com/api/1.1/', :headers => headers)\nresponse = conn.get 'refunds/'\nputs response.body\n"}]},"params":[],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"refunds\": [\n    {\n      \"id\": \"C5c0751269\",\n      \"payment_id\": \"MOJO5a06005J21512197\",\n      \"status\": \"Refunded\",\n      \"type\": \"QFL\",\n      \"body\": \"Customer isn't satisfied with the quality\",\n      \"refund_amount\": \"2500.00\",\n      \"total_amount\": \"2500.00\",\n      \"created_at\": \"2015-12-07T11:01:37.640Z\"\n    }\n   ]\n  \"success\": true\n}","name":""},{"status":401,"language":"json","code":"{\n    \"success\": false,\n    \"message\": \"Invalid Auth Token.\"\n}","name":""}]},"settings":"","url":"/refunds/"},"body":"**Required Headers:**\n - X-Api-Key\n - X-Auth-Token","category":"570caa32df099419002fe21a","createdAt":"2016-04-12T08:07:56.177Z","excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","order":5,"parentDoc":null,"project":"56a1c9c13845200d0066d6fe","slug":"get-list-of-refunds","sync_unique":"","title":"List of refunds","type":"get","updates":[],"user":"56a1c959842b650d0088899c","version":"56a1c9c23845200d0066d701","childrenPages":[]}

getList of refunds


**Required Headers:** - X-Api-Key - X-Auth-Token

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



**Required Headers:** - X-Api-Key - X-Auth-Token
{"__v":3,"_id":"570cad2a39ef110e0014f633","api":{"auth":"required","examples":{"codes":[{"language":"curl","code":"curl https://www.instamojo.com/api/1.1/refunds/C5c0751272/ \\\n  --header \"X-Api-Key: d82016f839e13cd0a79afc0ef5b288b3\" \\\n  --header \"X-Auth-Token: 3827881f669c11e8dad8a023fd1108c2\""},{"language":"python","code":"import requests\n\nheaders = { \"X-Api-Key\": \"d82016f839e13cd0a79afc0ef5b288b3\", \"X-Auth-Token\": \"3827881f669c11e8dad8a023fd1108c2\"}\n\nresponse = requests.get(\"https://www.instamojo.com/api/1.1/refunds/C5c0751272/\", headers=headers)\nprint response.text"},{"name":"Node","language":"javascript","code":"var request= require('request');\n\nvar headers = { 'X-Api-Key': 'd82016f839e13cd0a79afc0ef5b288b3', 'X-Auth-Token': '3827881f669c11e8dad8a023fd1108c2'}\n\nrequest.get('https://www.instamojo.com/api/1.1/refunds/C5c0751272/', {headers: headers}, function(error, response, body){\n  if(!error && response.statusCode == 200){\n    console.log(body);\n  }\n})"},{"language":"php","code":"<?php\n\n$ch = curl_init();\n\ncurl_setopt($ch, CURLOPT_URL, 'https://www.instamojo.com/api/1.1/refunds/C5c0751272/');\ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\ncurl_setopt($ch, CURLOPT_HTTPHEADER,\n            array(\"X-Api-Key:d82016f839e13cd0a79afc0ef5b288b3\",\n                  \"X-Auth-Token:3827881f669c11e8dad8a023fd1108c2\"));\n$payload = Array(\n    'payment_id' => 'MOJO5a06005J21512197',\n    'type' => 'QFL',\n    'body' => \"Customer isn't satisfied with the quality\"\n);\n$response = curl_exec($ch);\ncurl_close($ch); \n\necho $response;\n\n?>"},{"language":"ruby","code":"require 'faraday'\n\nheaders = {\"X-Api-Key\" => \"d82016f839e13cd0a79afc0ef5b288b3\", \"X-Auth-Token\" => \"3827881f669c11e8dad8a023fd1108c2\"}\nconn = Faraday.new(:url => 'https://www.instamojo.com/api/1.1/', :headers => headers)\nresponse = conn.get 'refunds/C5c0751272/'\nputs response.body\n"}]},"params":[{"_id":"571543c83b689d20001d2174","ref":"","required":true,"desc":"ID of the refund.","default":"","type":"string","name":"id","in":"path"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n      \"refund\": {\n          \"id\": \"C5c0751272\",\n          \"payment_id\": \"MOJO5a06005J21512197\",\n          \"status\": \"Refunded\",\n          \"type\": \"QFL\",\n          \"body\": \"Customer isn't satisfied with the quality\",\n          \"refund_amount\": \"2500.00\",\n          \"total_amount\": \"2500.00\",\n          \"created_at\": \"2015-12-07T11:04:09.500Z\"\n      },\n      \"success\": true\n  }","name":""},{"status":401,"language":"json","code":"{\n    \"success\": false,\n    \"message\": \"Invalid Auth Token.\"\n}","name":""}]},"settings":"","url":"/refunds/:id/"},"body":"**Required Headers:**\n - X-Api-Key\n - X-Auth-Token","category":"570caa32df099419002fe21a","createdAt":"2016-04-12T08:09:14.316Z","editedParams":true,"editedParams2":true,"excerpt":"","githubsync":"","hidden":false,"isReference":false,"link_external":false,"link_url":"","order":6,"parentDoc":null,"project":"56a1c9c13845200d0066d6fe","slug":"get-details-of-a-refund","sync_unique":"","title":"Details of a refund","type":"get","updates":[],"user":"56a1c959842b650d0088899c","version":"56a1c9c23845200d0066d701","childrenPages":[]}

getDetails of a refund


id:
required
string
ID of the refund.
**Required Headers:** - X-Api-Key - X-Auth-Token

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



**Required Headers:** - X-Api-Key - X-Auth-Token