{"_id":"57022d3797e34517001ffe41","link_url":"","parentDoc":null,"api":{"params":[],"results":{"codes":[]},"settings":"","url":"","auth":"required"},"link_external":false,"githubsync":"","isReference":false,"order":0,"category":"56a1c9c23845200d0066d702","excerpt":"","slug":"overview-and-setup-1","sync_unique":"","title":"Instamojo Payment Experience","type":"basic","user":"56a1c959842b650d0088899c","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.","hidden":false,"project":"56a1c9c13845200d0066d6fe","updates":["579c526cc6625a0e00a887d2","5864a49613dc0d2d0036bbf0","5864a4a39fd39a3b009e8f29","58da2899982c64230088bab5","5a1c245568d4db0028e1b1bf"],"version":"56a1c9c23845200d0066d701","__v":17,"createdAt":"2016-04-04T09:00:39.609Z","next":{"pages":[]},"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.
{"_id":"570c92ce25b79f0e00b0dcd8","project":"56a1c9c13845200d0066d6fe","slug":"overview-and-setup-2","__v":16,"api":{"settings":"","url":"","auth":"required","params":[],"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"code":"{}","name":"","status":400,"language":"json"}]}},"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/\n\n**Note:** If you have signed up on our sandbox environment at https://test.instamojo.com/, the URL needs to be changed to https://test.instamojo.com/api/1.1/ ; The examples use our production URL.","excerpt":"","githubsync":"","isReference":false,"sync_unique":"","title":"Overview and Setup","order":1,"parentDoc":null,"version":"56a1c9c23845200d0066d701","category":"56a1c9c23845200d0066d702","createdAt":"2016-04-12T06:16:46.475Z","hidden":false,"link_url":"","link_external":false,"next":{"description":"","pages":[]},"type":"basic","updates":["572bed9373c5671700a7aba2"],"user":"56a1c959842b650d0088899c","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/ **Note:** If you have signed up on our sandbox environment at https://test.instamojo.com/, the URL needs to be changed to https://test.instamojo.com/api/1.1/ ; The examples use our production URL.
## **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/ **Note:** If you have signed up on our sandbox environment at https://test.instamojo.com/, the URL needs to be changed to https://test.instamojo.com/api/1.1/ ; The examples use our production URL.
{"_id":"57021416747d6d0e0076fdf4","user":"56a1c959842b650d0088899c","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?](https://support.instamojo.com/hc/en-us/articles/207816249-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","parentDoc":null,"updates":[],"slug":"payments-api","githubsync":"","hidden":false,"link_external":false,"link_url":"","project":"56a1c9c13845200d0066d6fe","type":"basic","api":{"auth":"required","params":[],"results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","url":""},"excerpt":"","next":{"description":"","pages":[]},"sync_unique":"","__v":75,"isReference":false,"order":2,"title":"Integration guide","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?](https://support.instamojo.com/hc/en-us/articles/207816249-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?](https://support.instamojo.com/hc/en-us/articles/207816249-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/`
{"_id":"570ca2fa1e76a70e00678f1f","__v":6,"category":"570caa32df099419002fe21a","slug":"create-a-request","title":"Create a Request","type":"post","version":"56a1c9c23845200d0066d701","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`","createdAt":"2016-04-12T07:25:46.636Z","isReference":true,"project":"56a1c9c13845200d0066d6fe","user":"56a1c959842b650d0088899c","api":{"method":"post","params":[{"required":true,"desc":"Amount to be paid  in XX.YY format","default":"","type":"string","name":"amount","_id":"570ca2fa1e76a70e00678f21","ref":"","in":"body"},{"type":"string","name":"purpose","_id":"570ca2fa1e76a70e00678f20","ref":"","in":"body","required":true,"desc":"Purpose of payment","default":""},{"desc":"Name of payer","default":"","type":"string","name":"buyer_name","_id":"570ca4b739ef110e0014f616","ref":"","in":"body","required":false},{"name":"email","_id":"570ca4b739ef110e0014f615","ref":"","in":"body","required":false,"desc":"Email of payer","default":"","type":"string"},{"ref":"","in":"body","required":false,"desc":"Phone number of person paying","default":"","type":"string","name":"phone","_id":"570ca4b739ef110e0014f614"},{"default":"","type":"string","name":"redirect_url","_id":"570ca4b739ef110e0014f613","ref":"","in":"body","required":false,"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."},{"in":"body","required":false,"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","default":"","type":"string","name":"webhook","_id":"570ca4b739ef110e0014f612","ref":""},{"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.","default":"true","type":"boolean","name":"allow_repeated_payments","_id":"570ca4b739ef110e0014f611","ref":"","in":"body","required":false},{"name":"send_email","_id":"570ca6171e76a70e00678f26","ref":"","in":"body","required":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.","default":"false","type":"boolean"},{"ref":"","in":"body","required":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.","default":"false","type":"boolean","name":"send_sms","_id":"570ca6171e76a70e00678f25"},{"ref":"","required":false,"type":"datetime","_id":"58fdefe1c1e51e19004127a3","default":"","desc":"Time after which the payment request will be expired. Max value is 600 seconds. Default is Null","in":"body","name":"expires_at"}],"results":{"codes":[{"name":"","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}"},{"language":"json","code":"{\n    \"success\": false,\n    \"message\": {\n        \"amount\": [\n            \"This field is required.\"\n        ]\n    }\n}","name":"","status":400},{"status":401,"language":"text","code":"{\n    \"success\": false,\n    \"message\": \"Invalid Auth Token.\"\n}"}]},"settings":"","url":"/payment-requests/","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"}]}},"githubsync":"","link_url":"","order":0,"parentDoc":null,"sync_unique":"","editedParams":true,"editedParams2":true,"excerpt":"","hidden":false,"link_external":false,"next":{"description":"","pages":[]},"updates":["57d7c7f325cd460e00826914","5a20f0c828e0cd0012f9d2cb"],"childrenPages":[]}

postCreate a Request


Body Params

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.
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.
expires_at:
datetime
Time after which the payment request will be expired. Max value is 600 seconds. Default is Null
**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`

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

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`
{"_id":"5714c17012b19c0e00ec16d8","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","githubsync":"","link_url":"","next":{"description":"","pages":[]},"user":"56a1c959842b650d0088899c","slug":"get-list-of-payment-requests","api":{"params":[],"results":{"codes":[{"name":"","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}"},{"status":401,"language":"json","code":"{\n    \"success\": false,\n    \"message\": \"Invalid Auth Token.\"\n}","name":""}]},"settings":"","url":"/payment-requests/","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\""},{"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","language":"python"},{"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"}]},"method":"get"},"category":"570caa32df099419002fe21a","createdAt":"2016-04-18T11:13:52.882Z","excerpt":"","hidden":false,"link_external":false,"order":1,"updates":["59e512a5bec93f00108b8789"],"version":"56a1c9c23845200d0066d701","__v":9,"isReference":true,"parentDoc":null,"project":"56a1c9c13845200d0066d6fe","sync_unique":"","title":"List of Requests","type":"get","childrenPages":[]}

getList of Requests


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

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

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
{"_id":"570c9f6025b79f0e00b0dcf7","next":{"description":"","pages":[]},"slug":"get-details-of-request","updates":[],"user":"56a1c959842b650d0088899c","hidden":false,"isReference":true,"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$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"}]},"method":"get","params":[{"name":"id","_id":"570ca0c3e5f8280e006b1ac2","ref":"","in":"path","required":true,"desc":"ID of the Request","default":"","type":"string"}],"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             {\n                \"payment_id\": \"MOJO7328005J91064462\", \n                \"quantity\": 1, \n                \"status\": \"Credit\", \n                \"link_slug\": null, \n                \"link_title\": null, \n                \"buyer_name\": \"Buyer Name\", \n                \"buyer_phone\": \"9901000000\", \n                \"buyer_email\": \"buyer@instamojo.com\", \n                \"currency\": \"INR\", \n                \"unit_price\": \"100.00\", \n                \"amount\": \"100.00\", \n                \"fees\": \"5.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\": \"2017-03-28T13:57:21.229398Z\", \n                \"payment_request\": \"https://instamojo.com/api/1.1/payment-requests/be65d8abecc549918e8d8e61c801ae6f/\"\n            }\n        ],\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":null},{"status":401,"language":"json","code":"{\n    \"success\": false,\n    \"message\": \"Invalid Auth Token.\"\n}","name":""}]},"settings":"","url":"/payment-requests/:id/"},"excerpt":"","link_external":false,"order":2,"project":"56a1c9c13845200d0066d6fe","title":"Get Payment Request Details","__v":5,"version":"56a1c9c23845200d0066d701","githubsync":"","parentDoc":null,"sync_unique":"","type":"get","createdAt":"2016-04-12T07:10:24.825Z","editedParams":true,"editedParams2":true,"link_url":"","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","childrenPages":[]}

getGet Payment Request Details


Path Params

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

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

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
{"_id":"570cabef5fac770e00b67d9e","parentDoc":null,"type":"post","version":"56a1c9c23845200d0066d701","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.","createdAt":"2016-04-12T08:03:59.984Z","editedParams2":true,"project":"56a1c9c13845200d0066d6fe","user":"56a1c959842b650d0088899c","category":"570caa32df099419002fe21a","githubsync":"","link_external":false,"hidden":false,"isReference":true,"link_url":"","slug":"creating-a-refund","title":"Creating a Refund","__v":2,"api":{"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"}]},"method":"post","params":[{"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":"570cabef5fac770e00b67da0"},{"type":"string","name":"type","in":"body","_id":"570cabef5fac770e00b67d9f","ref":"","required":true,"desc":"A three letter short-code identifying the reason for this case.","default":""},{"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":"570cac32df099419002fe220","ref":""},{"desc":"Additonal text explaining the refund.","default":"","type":"string","name":"body","in":"body","_id":"5714c8be12b19c0e00ec16e5","ref":"","required":false}],"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/","auth":"required"},"excerpt":"","sync_unique":"","updates":[],"editedParams":true,"order":4,"childrenPages":[]}

postCreating a Refund


Body Params

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.

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

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.
{"_id":"570cacdc8c9c351900d187c3","updates":[],"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"}]},"method":"get","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","createdAt":"2016-04-12T08:07:56.177Z","link_external":false,"link_url":"","project":"56a1c9c13845200d0066d6fe","type":"get","user":"56a1c959842b650d0088899c","isReference":true,"sync_unique":"","category":"570caa32df099419002fe21a","excerpt":"","githubsync":"","slug":"get-list-of-refunds","title":"List of refunds","__v":7,"hidden":false,"order":5,"parentDoc":null,"version":"56a1c9c23845200d0066d701","childrenPages":[]}

getList of refunds


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

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



**Required Headers:** - X-Api-Key - X-Auth-Token
{"_id":"570cad2a39ef110e0014f633","sync_unique":"","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\""},{"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","language":"python"},{"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})","name":"Node","language":"javascript"},{"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"}]},"method":"get","params":[{"in":"path","_id":"571543c83b689d20001d2174","ref":"","required":true,"desc":"ID of the refund.","default":"","type":"string","name":"id"}],"results":{"codes":[{"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":200,"language":"json"},{"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","githubsync":"","parentDoc":null,"slug":"get-details-of-a-refund","isReference":true,"order":6,"user":"56a1c959842b650d0088899c","version":"56a1c9c23845200d0066d701","__v":3,"createdAt":"2016-04-12T08:09:14.316Z","excerpt":"","hidden":false,"title":"Details of a refund","type":"get","updates":[],"category":"570caa32df099419002fe21a","editedParams":true,"editedParams2":true,"link_external":false,"link_url":"","project":"56a1c9c13845200d0066d6fe","childrenPages":[]}

getDetails of a refund


Path Params

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

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



**Required Headers:** - X-Api-Key - X-Auth-Token
{"_id":"58ef4ad614ab683100de144e","__v":0,"createdAt":"2017-04-13T09:54:30.837Z","excerpt":"","link_url":"","order":7,"type":"get","version":"56a1c9c23845200d0066d701","parentDoc":null,"title":"Get Payment Details","user":"56a1c959842b650d0088899c","api":{"examples":{"codes":[{"language":"curl","code":"curl https://www.instamojo.com/api/1.1/payments/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/payments/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/payments/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/payments/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\n$response = curl_exec($ch);\ncurl_close($ch); \n\necho $response;\n\n?>"},{"language":"ruby","code":"require 'faraday'\n\nheaders = {\"X-Api-Key\" => \"d82016f839e13cd0a79afc0ef5b288b3\", \n           \"X-Auth-Token\" => \"3827881f669c11e8dad8a023fd1108c2\"}\nconn = Faraday.new(:url => 'https://www.instamojo.com/api/1.1/', :headers => headers)\nresponse = conn.get 'payments/MOJO5a06005J21512197/'\nputs response.body\n"}]},"method":"get","params":[{"desc":"ID of the payment","default":"","type":"string","name":"id","_id":"5714bd5eb9061c0e00d122c1","ref":"","in":"path","required":true}],"results":{"codes":[{"code":"{\n  \"payment\": {\n    \"payment_id\": \"MOJO1412005H64215489\",\n    \"quantity\": 1,\n    \"status\": \"Credit\",\n    \"link_slug\": null,\n    \"link_title\": null,\n    \"buyer_name\": \"John Doe\",\n    \"buyer_phone\": \"9901644400\",\n    \"buyer_email\": \"john.doe@example.com\",\n    \"currency\": \"INR\",\n    \"unit_price\": \"500.00\",\n    \"amount\": \"500.00\",\n    \"fees\": \"0.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      \n    ],\n    \"custom_fields\": {\n      \n    },\n    \"affiliate_id\": null,\n    \"affiliate_commission\": \"0\",\n    \"created_at\": \"2017-04-12T17:09:09.903733Z\",\n    \"payment_request\": null\n  },\n  \"success\": true\n}","language":"json","status":200,"name":""},{"language":"json","status":401,"name":"","code":"{\n    \"success\": false,\n    \"message\": \"Invalid Auth Token.\"\n}"}]},"settings":"","url":"/payments/:id","auth":"required"},"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","githubsync":"","link_external":false,"project":"56a1c9c13845200d0066d6fe","sync_unique":"","updates":[],"category":"570caa32df099419002fe21a","hidden":false,"isReference":true,"next":{"pages":[],"description":""},"slug":"get-payment-details","childrenPages":[]}

getGet Payment Details


Path Params

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

User Information

Try It Out

get
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

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
{"_id":"590b32aeb5f9ab23009dc53b","link_url":"","order":8,"title":"Disable a Request","version":"56a1c9c23845200d0066d701","slug":"disable-a-request","type":"post","__v":0,"api":{"settings":"","url":"/payment-requests/:id/disable/","auth":"required","examples":{"codes":[{"language":"python","code":"import requests\nheaders = { \"X-Api-Key\": \"4efa6d93e5dfaf5eba4d1e33f848076d\", \"X-Auth-Token\": \"be5d9677ced4ece3691d9d4b0318c159\"}\nresponse = requests.post(\"http://local.instamojo.com:5000/api/1.1/payment-requests/90c489ba8c9349cfadd2639e5590ee8d/disable/\",  headers=headers)"}]},"method":"post","params":[{"required":true,"type":"string","_id":"590b32aeb5f9ab23009dc53c","default":"","desc":"","in":"path","name":"id","ref":""}],"results":{"codes":[{"status":200,"language":"json","code":"{\n    \"success\": true\n}\n","name":""}]}},"createdAt":"2017-05-04T13:54:54.890Z","link_external":false,"next":{"pages":[],"description":""},"project":"56a1c9c13845200d0066d6fe","body":"","isReference":true,"user":"56a1c959842b650d0088899c","category":"570caa32df099419002fe21a","excerpt":"","githubsync":"","hidden":false,"sync_unique":"","updates":[],"parentDoc":null,"childrenPages":[]}

postDisable a Request


Path Params

id:
required
string

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"590b335f13e75d1b00619c67","user":"56a1c959842b650d0088899c","link_external":false,"sync_unique":"","excerpt":"","type":"post","__v":0,"next":{"pages":[],"description":""},"createdAt":"2017-05-04T13:57:51.382Z","link_url":"","api":{"examples":{"codes":[{"language":"python","code":"import requests\nheaders = { \"X-Api-Key\": \"4efa6d93e5dfaf5eba4d1e33f848076d\", \"X-Auth-Token\": \"be5d9677ced4ece3691d9d4b0318c159\"}\nresponse = requests.post(\"http://local.instamojo.com:5000/api/1.1/payment-requests/90c489ba8c9349cfadd2639e5590ee8d/enable/\",  headers=headers)"}]},"results":{"codes":[{"status":200,"language":"json","code":"{\n    \"success\": true\n}","name":""},{"language":"json","code":"{}","name":"","status":400}]},"settings":"","auth":"required","params":[{"in":"path","required":true,"desc":"","default":"","type":"string","name":"id","_id":"590b335f13e75d1b00619c68","ref":""}],"url":"/payment-requests/:id/enable/","method":"post"},"body":"","version":"56a1c9c23845200d0066d701","category":"570caa32df099419002fe21a","githubsync":"","hidden":false,"slug":"enable-a-request","title":"Enable a Request","project":"56a1c9c13845200d0066d6fe","updates":[],"isReference":true,"order":9,"parentDoc":null,"childrenPages":[]}

postEnable a Request


Path Params

id:
required
string

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format



{"_id":"593fb864fd47c90019f1b0c4","project":"56a1c9c13845200d0066d6fe","version":"56a1c9c23845200d0066d701","category":"593fb82befd24600251c83eb","user":"56a1c959842b650d0088899c","updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-06-13T10:03:16.520Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"[block:api-header]\n{\n  \"title\": \"Checkout.js\"\n}\n[/block]\nOnce checkout.js file is loaded in the browser, we have the following methods available in the global scope: \n * [Instamojo.open()](https://docs.instamojo.com/docs/sdk#section-instamojo-open-)\n * [Instamojo.close()](https://docs.instamojo.com/docs/sdk#section-instamojo-close-) \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<script src=\\\"https://js.instamojo.com/v1/checkout.js\\\"></script>\\n<script>\\n\\tInstamojo.open(\\\"YOUR_INSTAMOJO_LINK_HERE\\\"); \\n</script>\",\n      \"language\": \"javascript\",\n      \"name\": null\n    }\n  ]\n}\n[/block]\n### Instamojo.open()\n\nCall this method to open any instamojo link in checkout form. \nIt requires instamojo-payment-url to be passed as the first parameter to render checkout form.\n\n\n### Instamojo.close()\nCall this method to close the checkout form manually.\n\n\n[block:parameters]\n{\n  \"data\": {\n    \"0-0\": \"open\",\n    \"h-0\": \"Method\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Example\",\n    \"0-1\": \"function(link)\\n\\nlink: STRING\",\n    \"0-2\": \"Instamojo.open('https://www.instamojo.com/@ayushya')\",\n    \"1-0\": \"close\",\n    \"1-1\": \"function()\",\n    \"1-2\": \"Instamojo.close()\",\n    \"h-3\": \"\",\n    \"0-3\": \"\",\n    \"1-3\": \"\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]\n\n**You can refer to the checkout demo [here](http://jsbin.com/naxotagosa/edit?html,output)**","excerpt":"Render Instamojo checkout form and collect payments on your webpage with just the instamojo-payment-url.","slug":"sdk","type":"basic","title":"Javascript SDK","__v":0,"parentDoc":null,"childrenPages":[]}

Javascript SDK

Render Instamojo checkout form and collect payments on your webpage with just the instamojo-payment-url.

[block:api-header] { "title": "Checkout.js" } [/block] Once checkout.js file is loaded in the browser, we have the following methods available in the global scope: * [Instamojo.open()](https://docs.instamojo.com/docs/sdk#section-instamojo-open-) * [Instamojo.close()](https://docs.instamojo.com/docs/sdk#section-instamojo-close-) [block:code] { "codes": [ { "code": "<script src=\"https://js.instamojo.com/v1/checkout.js\"></script>\n<script>\n\tInstamojo.open(\"YOUR_INSTAMOJO_LINK_HERE\"); \n</script>", "language": "javascript", "name": null } ] } [/block] ### Instamojo.open() Call this method to open any instamojo link in checkout form. It requires instamojo-payment-url to be passed as the first parameter to render checkout form. ### Instamojo.close() Call this method to close the checkout form manually. [block:parameters] { "data": { "0-0": "open", "h-0": "Method", "h-1": "Type", "h-2": "Example", "0-1": "function(link)\n\nlink: STRING", "0-2": "Instamojo.open('https://www.instamojo.com/@ayushya')", "1-0": "close", "1-1": "function()", "1-2": "Instamojo.close()", "h-3": "", "0-3": "", "1-3": "" }, "cols": 3, "rows": 2 } [/block] **You can refer to the checkout demo [here](http://jsbin.com/naxotagosa/edit?html,output)**
[block:api-header] { "title": "Checkout.js" } [/block] Once checkout.js file is loaded in the browser, we have the following methods available in the global scope: * [Instamojo.open()](https://docs.instamojo.com/docs/sdk#section-instamojo-open-) * [Instamojo.close()](https://docs.instamojo.com/docs/sdk#section-instamojo-close-) [block:code] { "codes": [ { "code": "<script src=\"https://js.instamojo.com/v1/checkout.js\"></script>\n<script>\n\tInstamojo.open(\"YOUR_INSTAMOJO_LINK_HERE\"); \n</script>", "language": "javascript", "name": null } ] } [/block] ### Instamojo.open() Call this method to open any instamojo link in checkout form. It requires instamojo-payment-url to be passed as the first parameter to render checkout form. ### Instamojo.close() Call this method to close the checkout form manually. [block:parameters] { "data": { "0-0": "open", "h-0": "Method", "h-1": "Type", "h-2": "Example", "0-1": "function(link)\n\nlink: STRING", "0-2": "Instamojo.open('https://www.instamojo.com/@ayushya')", "1-0": "close", "1-1": "function()", "1-2": "Instamojo.close()", "h-3": "", "0-3": "", "1-3": "" }, "cols": 3, "rows": 2 } [/block] **You can refer to the checkout demo [here](http://jsbin.com/naxotagosa/edit?html,output)**
{"_id":"58a413ea9859df0f00883ab3","slug":"common-api-response-codes","sync_unique":"","title":"Common API Response codes","updates":[],"body":"* `200` : The API request was successful and you can find the API response in the body. \n\n* `201` : The API request successfully created a resource on our server. You will see this response when you create a new signup or a new payment request.\n\n* `301` : The API responded with a redirect request. You are most likely missing a trailing slash at the end of your request URL.\n\n* `400` : The API request you sent failed the validation requirements. You should look into the response body for more details about the error(s).\n\n* `401` : The API request you are sending does not have authentication headers or has incorrect authentication header names or the authentication token is expired or invalid. Also if you are using https://test.instamojo.com as your base URL, ensure that you are using the authentication credentials from https://test.instamojo.com/integrations. Similarly, if you are using https://www.instamojo.com as your base URL, use the authentication credentials from https://www.instamojo.com/integrations\n\n* `403` : You are using incorrect tokens or your token does not have the necessary permissions for performing the action. Check if you are using a [User Based Authentication](doc:user-based-authentication) on an API that requires you to use an [Application Based Authentication](doc:application-based-authentication)\n\n* `404` : The request URL is incorrect or does not exist.\n\n* `500` : There was an error on one of our servers with your request. Please reach out to us via [support@instamojo.com](mailto:support@instamojo.com)\n\n* `502` : There was an error on one of our servers with your request. Please reach out to us via [support@instamojo.com](mailto:support@instamojo.com)\n\n* `504` : There was an error on one of our servers with your request. Please reach out to us via [support@instamojo.com](mailto:support@instamojo.com)\n\n\nYou can also find a more comprehensive list of HTTP response codes here: http://httpstatuses.com/","createdAt":"2017-02-15T08:40:10.773Z","hidden":false,"isReference":false,"user":"56a1c959842b650d0088899c","next":{"pages":[],"description":""},"order":0,"parentDoc":null,"version":"56a1c9c23845200d0066d701","__v":0,"category":"58a413b423b12b0f00dc359e","link_url":"","link_external":false,"type":"basic","api":{"results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"excerpt":"","githubsync":"","project":"56a1c9c13845200d0066d6fe","childrenPages":[]}

Common API Response codes


* `200` : The API request was successful and you can find the API response in the body. * `201` : The API request successfully created a resource on our server. You will see this response when you create a new signup or a new payment request. * `301` : The API responded with a redirect request. You are most likely missing a trailing slash at the end of your request URL. * `400` : The API request you sent failed the validation requirements. You should look into the response body for more details about the error(s). * `401` : The API request you are sending does not have authentication headers or has incorrect authentication header names or the authentication token is expired or invalid. Also if you are using https://test.instamojo.com as your base URL, ensure that you are using the authentication credentials from https://test.instamojo.com/integrations. Similarly, if you are using https://www.instamojo.com as your base URL, use the authentication credentials from https://www.instamojo.com/integrations * `403` : You are using incorrect tokens or your token does not have the necessary permissions for performing the action. Check if you are using a [User Based Authentication](doc:user-based-authentication) on an API that requires you to use an [Application Based Authentication](doc:application-based-authentication) * `404` : The request URL is incorrect or does not exist. * `500` : There was an error on one of our servers with your request. Please reach out to us via [support@instamojo.com](mailto:support@instamojo.com) * `502` : There was an error on one of our servers with your request. Please reach out to us via [support@instamojo.com](mailto:support@instamojo.com) * `504` : There was an error on one of our servers with your request. Please reach out to us via [support@instamojo.com](mailto:support@instamojo.com) You can also find a more comprehensive list of HTTP response codes here: http://httpstatuses.com/
* `200` : The API request was successful and you can find the API response in the body. * `201` : The API request successfully created a resource on our server. You will see this response when you create a new signup or a new payment request. * `301` : The API responded with a redirect request. You are most likely missing a trailing slash at the end of your request URL. * `400` : The API request you sent failed the validation requirements. You should look into the response body for more details about the error(s). * `401` : The API request you are sending does not have authentication headers or has incorrect authentication header names or the authentication token is expired or invalid. Also if you are using https://test.instamojo.com as your base URL, ensure that you are using the authentication credentials from https://test.instamojo.com/integrations. Similarly, if you are using https://www.instamojo.com as your base URL, use the authentication credentials from https://www.instamojo.com/integrations * `403` : You are using incorrect tokens or your token does not have the necessary permissions for performing the action. Check if you are using a [User Based Authentication](doc:user-based-authentication) on an API that requires you to use an [Application Based Authentication](doc:application-based-authentication) * `404` : The request URL is incorrect or does not exist. * `500` : There was an error on one of our servers with your request. Please reach out to us via [support@instamojo.com](mailto:support@instamojo.com) * `502` : There was an error on one of our servers with your request. Please reach out to us via [support@instamojo.com](mailto:support@instamojo.com) * `504` : There was an error on one of our servers with your request. Please reach out to us via [support@instamojo.com](mailto:support@instamojo.com) You can also find a more comprehensive list of HTTP response codes here: http://httpstatuses.com/
{"_id":"58a414209859df0f00883ab4","__v":0,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"name":"","status":400,"language":"json","code":"{}"}]},"settings":"","auth":"required","params":[],"url":""},"createdAt":"2017-02-15T08:41:04.648Z","next":{"pages":[],"description":""},"parentDoc":null,"project":"56a1c9c13845200d0066d6fe","excerpt":"","order":1,"sync_unique":"","version":"56a1c9c23845200d0066d701","hidden":false,"isReference":false,"link_external":false,"type":"basic","updates":[],"user":"56a1c959842b650d0088899c","body":"1. [Create a Payment Request](doc:create-a-payment-request) with the buyer's name, email, and phone number. \n2. Fetch the `longurl` from the response body of the API request.\n3. Redirect the user to the `longurl` to complete the payment.\n4. If you are using Light Checkout, append `?embed=form` to the `longurl` before rendering the URL.","category":"58a413b423b12b0f00dc359e","githubsync":"","link_url":"","slug":"how-can-i-prefill-buyer-details-on-payment-forms","title":"How can I prefill buyer details on payment forms?","childrenPages":[]}

How can I prefill buyer details on payment forms?


1. [Create a Payment Request](doc:create-a-payment-request) with the buyer's name, email, and phone number. 2. Fetch the `longurl` from the response body of the API request. 3. Redirect the user to the `longurl` to complete the payment. 4. If you are using Light Checkout, append `?embed=form` to the `longurl` before rendering the URL.
1. [Create a Payment Request](doc:create-a-payment-request) with the buyer's name, email, and phone number. 2. Fetch the `longurl` from the response body of the API request. 3. Redirect the user to the `longurl` to complete the payment. 4. If you are using Light Checkout, append `?embed=form` to the `longurl` before rendering the URL.
{"_id":"58a4149423b12b0f00dc35a0","excerpt":"","slug":"can-instamojo-save-the-creditdebit-card-numbers-of-my-customers","updates":[],"version":"56a1c9c23845200d0066d701","next":{"pages":[],"description":""},"parentDoc":null,"sync_unique":"","body":"No. Not yet.","link_external":false,"link_url":"","isReference":false,"order":2,"type":"basic","user":"56a1c959842b650d0088899c","__v":0,"category":"58a413b423b12b0f00dc359e","createdAt":"2017-02-15T08:43:00.881Z","githubsync":"","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"code":"{}","name":"","status":400,"language":"json"}]},"settings":"","auth":"required","params":[],"url":""},"hidden":false,"project":"56a1c9c13845200d0066d6fe","title":"Can Instamojo save the credit/debit card numbers of my customers?","childrenPages":[]}

Can Instamojo save the credit/debit card numbers of my customers?


No. Not yet.
{"_id":"58a414b6b26c4a0f00fe5833","__v":0,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"code":"{}","name":"","status":400,"language":"json"}]},"settings":"","auth":"required","params":[],"url":""},"project":"56a1c9c13845200d0066d6fe","updates":[],"githubsync":"","isReference":false,"order":3,"body":"Webhooks allow you to get notified of events that happen on Instamojo.\n\nFor example, when a buyer makes payment, Instamojo can send an HTTP POST request to your server. This avoids the need to keep polling Instamojo servers for updates.\n\nA webhook is not a redirect. The buyer or the browser will never see it. Its a communication channel between Instamojo servers and your servers.\n\nHere are some use cases where a webhook might be useful:\n\n1. Sending a custom email from your server at the end of every transaction\n2. Activation of a user's account on your service\n3. Sending a user the license key to your software\n4. Adding a user to your CRM software\n5. Adding the transaction to your accounting software\n\nBy default, a webhook is sent only on successful payments, but can be enabled\nfor failures too. Please get in touch with [support@instamojo.com](mailto:support@instamojo.com) for the same.\n\nA webhook URL should be an internet facing publicly accessible URL on your server, which accepts a POST request from instamojo.com. CSRF checks should be disabled and if the server is hosted over HTTPS, the SSL certificate should be valid and not expired. The URL should not have any kind of authentication.\n\nWe have a handy [https://www.instamojo.com/webhook-testing-tool/](webhook testing tool) which can be used to test your server. [https://requestb.in/](Request bin) is a useful service to explore the request sent by the server.\n\nThe webhook request is request with content-type `application/www-form-urlencoded`. Don't try to handle it like a JSON request.\n\nThe parameters for Payment requests are\n\n| Key                | Description                                                     |\n|--------------------|-----------------------------------------------------------------|\n| amount             | Amount related to the payment                                   |\n| buyer              | Buyer's email                                                   |\n| buyer_name         | Buyer's name                                                    |\n| buyer_phone        | Buyer's phone number                                            |\n| currency           | Currency related to the payment                                 |\n| fees               | Fees charged by Instamojo                                       |\n| longurl            | URL related to the payment request                              |\n| mac                | Message Authentication code of this webhook request             |\n| payment_id         | ID of the payment                                               |\n| payment_request_id | ID of the payment request                                       |\n| purpose            | Purpose of the Payment request                                  |\n| shorturl           | Short URL of the payment request                                |\n| status             | Status of the Payment. This can be either \"Credit\" or \"Failed\". |\n\nNOTE: This list of keys will get updated over time. So when you are integrating,\nwe recommend you to account for new keys that will be added to this.","category":"58a413b423b12b0f00dc359e","createdAt":"2017-02-15T08:43:34.549Z","excerpt":"","slug":"what-is-a-webhook","user":"56a1c959842b650d0088899c","title":"What is a webhook?","version":"56a1c9c23845200d0066d701","sync_unique":"","type":"basic","hidden":false,"link_external":false,"link_url":"","next":{"pages":[],"description":""},"parentDoc":null,"childrenPages":[]}

What is a webhook?


Webhooks allow you to get notified of events that happen on Instamojo. For example, when a buyer makes payment, Instamojo can send an HTTP POST request to your server. This avoids the need to keep polling Instamojo servers for updates. A webhook is not a redirect. The buyer or the browser will never see it. Its a communication channel between Instamojo servers and your servers. Here are some use cases where a webhook might be useful: 1. Sending a custom email from your server at the end of every transaction 2. Activation of a user's account on your service 3. Sending a user the license key to your software 4. Adding a user to your CRM software 5. Adding the transaction to your accounting software By default, a webhook is sent only on successful payments, but can be enabled for failures too. Please get in touch with [support@instamojo.com](mailto:support@instamojo.com) for the same. A webhook URL should be an internet facing publicly accessible URL on your server, which accepts a POST request from instamojo.com. CSRF checks should be disabled and if the server is hosted over HTTPS, the SSL certificate should be valid and not expired. The URL should not have any kind of authentication. We have a handy [https://www.instamojo.com/webhook-testing-tool/](webhook testing tool) which can be used to test your server. [https://requestb.in/](Request bin) is a useful service to explore the request sent by the server. The webhook request is request with content-type `application/www-form-urlencoded`. Don't try to handle it like a JSON request. The parameters for Payment requests are | Key | Description | |--------------------|-----------------------------------------------------------------| | amount | Amount related to the payment | | buyer | Buyer's email | | buyer_name | Buyer's name | | buyer_phone | Buyer's phone number | | currency | Currency related to the payment | | fees | Fees charged by Instamojo | | longurl | URL related to the payment request | | mac | Message Authentication code of this webhook request | | payment_id | ID of the payment | | payment_request_id | ID of the payment request | | purpose | Purpose of the Payment request | | shorturl | Short URL of the payment request | | status | Status of the Payment. This can be either "Credit" or "Failed". | NOTE: This list of keys will get updated over time. So when you are integrating, we recommend you to account for new keys that will be added to this.
Webhooks allow you to get notified of events that happen on Instamojo. For example, when a buyer makes payment, Instamojo can send an HTTP POST request to your server. This avoids the need to keep polling Instamojo servers for updates. A webhook is not a redirect. The buyer or the browser will never see it. Its a communication channel between Instamojo servers and your servers. Here are some use cases where a webhook might be useful: 1. Sending a custom email from your server at the end of every transaction 2. Activation of a user's account on your service 3. Sending a user the license key to your software 4. Adding a user to your CRM software 5. Adding the transaction to your accounting software By default, a webhook is sent only on successful payments, but can be enabled for failures too. Please get in touch with [support@instamojo.com](mailto:support@instamojo.com) for the same. A webhook URL should be an internet facing publicly accessible URL on your server, which accepts a POST request from instamojo.com. CSRF checks should be disabled and if the server is hosted over HTTPS, the SSL certificate should be valid and not expired. The URL should not have any kind of authentication. We have a handy [https://www.instamojo.com/webhook-testing-tool/](webhook testing tool) which can be used to test your server. [https://requestb.in/](Request bin) is a useful service to explore the request sent by the server. The webhook request is request with content-type `application/www-form-urlencoded`. Don't try to handle it like a JSON request. The parameters for Payment requests are | Key | Description | |--------------------|-----------------------------------------------------------------| | amount | Amount related to the payment | | buyer | Buyer's email | | buyer_name | Buyer's name | | buyer_phone | Buyer's phone number | | currency | Currency related to the payment | | fees | Fees charged by Instamojo | | longurl | URL related to the payment request | | mac | Message Authentication code of this webhook request | | payment_id | ID of the payment | | payment_request_id | ID of the payment request | | purpose | Purpose of the Payment request | | shorturl | Short URL of the payment request | | status | Status of the Payment. This can be either "Credit" or "Failed". | NOTE: This list of keys will get updated over time. So when you are integrating, we recommend you to account for new keys that will be added to this.
{"_id":"58c24bff9609c40f004b4b84","sync_unique":"","updates":[],"version":"56a1c9c23845200d0066d701","api":{"settings":"","results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"status":400,"language":"json","code":"{}","name":""}]},"auth":"required","params":[],"url":""},"category":"58a413b423b12b0f00dc359e","project":"56a1c9c13845200d0066d6fe","slug":"what-if-the-webhook-fails","hidden":false,"link_url":"","user":"56a1c959842b650d0088899c","__v":0,"body":"In case your server is down and fails to return an HTTP response or returns a 4xx or 5xx response to our server, we will attempt 4 retries.\n\nThe first retry is attempted after `15 minutes` since the original webhook attempt.\nThe second retry is attempted after `30 minutes` after the first retry.\nThe third retry is attempted after `60 minutes` after the second retry.\nThe fourth retry is attempted after `2 hours` after the third retry.\n\nThis is the last and final attempt, after which the webhook will not be sent anymore.\n\nWebhook retries is disabled by default. In case you want this to be enabled for your account, please send us an email to support@instamojo.com regarding this.","githubsync":"","type":"basic","next":{"pages":[],"description":""},"order":4,"parentDoc":null,"title":"What if the webhook fails?","createdAt":"2017-03-10T06:47:27.354Z","excerpt":"","isReference":false,"link_external":false,"childrenPages":[]}

What if the webhook fails?


In case your server is down and fails to return an HTTP response or returns a 4xx or 5xx response to our server, we will attempt 4 retries. The first retry is attempted after `15 minutes` since the original webhook attempt. The second retry is attempted after `30 minutes` after the first retry. The third retry is attempted after `60 minutes` after the second retry. The fourth retry is attempted after `2 hours` after the third retry. This is the last and final attempt, after which the webhook will not be sent anymore. Webhook retries is disabled by default. In case you want this to be enabled for your account, please send us an email to support@instamojo.com regarding this.
In case your server is down and fails to return an HTTP response or returns a 4xx or 5xx response to our server, we will attempt 4 retries. The first retry is attempted after `15 minutes` since the original webhook attempt. The second retry is attempted after `30 minutes` after the first retry. The third retry is attempted after `60 minutes` after the second retry. The fourth retry is attempted after `2 hours` after the third retry. This is the last and final attempt, after which the webhook will not be sent anymore. Webhook retries is disabled by default. In case you want this to be enabled for your account, please send us an email to support@instamojo.com regarding this.
{"_id":"58a414f6b26c4a0f00fe5835","order":5,"user":"56a1c959842b650d0088899c","__v":0,"api":{"params":[],"url":"","results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"language":"json","code":"{}","name":"","status":400}]},"settings":"","auth":"required"},"createdAt":"2017-02-15T08:44:38.804Z","excerpt":"","isReference":false,"body":"Status of a payment describes the final state of the payment made by the customer. The value of Status can be:\n1. `Credit` : The payment made was successful.\n2. `Failed` : The payment made was not successful.","link_url":"","parentDoc":null,"sync_unique":"","category":"58a413b423b12b0f00dc359e","githubsync":"","title":"What are the values of status of a payment?","version":"56a1c9c23845200d0066d701","slug":"what-are-the-values-of-status-of-a-payment","type":"basic","updates":[],"hidden":false,"link_external":false,"next":{"pages":[],"description":""},"project":"56a1c9c13845200d0066d6fe","childrenPages":[]}

What are the values of status of a payment?


Status of a payment describes the final state of the payment made by the customer. The value of Status can be: 1. `Credit` : The payment made was successful. 2. `Failed` : The payment made was not successful.
Status of a payment describes the final state of the payment made by the customer. The value of Status can be: 1. `Credit` : The payment made was successful. 2. `Failed` : The payment made was not successful.
{"_id":"58a4150c23b12b0f00dc35a2","hidden":false,"order":6,"project":"56a1c9c13845200d0066d6fe","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"language":"json","code":"{}","name":"","status":400}]},"settings":"","auth":"required","params":[],"url":""},"body":"Status of a payment request describes the state of a payment request. \n\n1. `Pending` : This is the default status. The email and/or sms (whichever is applicable) have not been sent out yet.\n2. `Sent` : The email and/or sms (whichever is applicable) has been sent.\n3. `Failed` : The email and/or sms (whichever is applicable) were not sent successfully.\n4. `Completed` : Payment was made by a customer.","createdAt":"2017-02-15T08:45:00.450Z","githubsync":"","isReference":false,"link_external":false,"link_url":"","title":"What are the values of status of a payment request?","category":"58a413b423b12b0f00dc359e","__v":0,"type":"basic","parentDoc":null,"slug":"what-are-the-values-of-status-of-a-payment-request","sync_unique":"","updates":[],"user":"56a1c959842b650d0088899c","version":"56a1c9c23845200d0066d701","excerpt":"","next":{"pages":[],"description":""},"childrenPages":[]}

What are the values of status of a payment request?


Status of a payment request describes the state of a payment request. 1. `Pending` : This is the default status. The email and/or sms (whichever is applicable) have not been sent out yet. 2. `Sent` : The email and/or sms (whichever is applicable) has been sent. 3. `Failed` : The email and/or sms (whichever is applicable) were not sent successfully. 4. `Completed` : Payment was made by a customer.
Status of a payment request describes the state of a payment request. 1. `Pending` : This is the default status. The email and/or sms (whichever is applicable) have not been sent out yet. 2. `Sent` : The email and/or sms (whichever is applicable) has been sent. 3. `Failed` : The email and/or sms (whichever is applicable) were not sent successfully. 4. `Completed` : Payment was made by a customer.
{"_id":"58a415299230160f00910684","category":"58a413b423b12b0f00dc359e","excerpt":"","hidden":false,"order":7,"slug":"how-do-i-verify-the-status-of-a-payment","__v":0,"type":"basic","user":"56a1c959842b650d0088899c","version":"56a1c9c23845200d0066d701","link_external":false,"link_url":"","parentDoc":null,"sync_unique":"","updates":[],"githubsync":"","body":"1. Specify a webhook url while [creating the payment request](doc:create-a-request).\n2. Save the payment request ID in your database when the payment request is created.\n3. On successful payment completion, a webhook is sent which includes the payment request ID and  the payment ID. You can then map the payment request ID and the payment ID in your database accordingly.","createdAt":"2017-02-15T08:45:29.015Z","isReference":false,"next":{"pages":[],"description":""},"project":"56a1c9c13845200d0066d6fe","title":"How do I verify the status of a payment?","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"childrenPages":[]}

How do I verify the status of a payment?


1. Specify a webhook url while [creating the payment request](doc:create-a-request). 2. Save the payment request ID in your database when the payment request is created. 3. On successful payment completion, a webhook is sent which includes the payment request ID and the payment ID. You can then map the payment request ID and the payment ID in your database accordingly.
1. Specify a webhook url while [creating the payment request](doc:create-a-request). 2. Save the payment request ID in your database when the payment request is created. 3. On successful payment completion, a webhook is sent which includes the payment request ID and the payment ID. You can then map the payment request ID and the payment ID in your database accordingly.
{"_id":"58a4153f9230160f00910685","githubsync":"","link_external":false,"link_url":"","project":"56a1c9c13845200d0066d6fe","slug":"what-is-the-difference-between-the-sandbox-and-production-environment","type":"basic","__v":0,"api":{"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"name":"","status":400,"language":"json","code":"{}"}]},"settings":"","auth":"required","params":[]},"next":{"pages":[],"description":""},"title":"What is the difference between the sandbox and production environment?","version":"56a1c9c23845200d0066d701","category":"58a413b423b12b0f00dc359e","excerpt":"","hidden":false,"isReference":false,"order":8,"sync_unique":"","updates":[],"body":"Instamojo provides you with an option to create a sandbox account to test your integration before you go live on your website or application. \n\nYou do not have to submit documents or go through the regular onboarding flow when you create an account on the sandbox environment. You can sign up on the sandbox environment here: [https://test.instamojo.com](https://test.instamojo.com)\n\nThe base URL for all your API requests to the sandbox environment should be:\n`https://test.instamojo.com/`\n\nAll the credentials like API key, Auth Token and Private Salt will be \navailable at: [https://test.instamojo.com/integrations/](https://test.instamojo.com/integrations)\n\nTo test transaction, you can use the test card details, which are:\n```\nCard Number: 4242 4242 4242 4242\nExp MM/YY: 01/20\nCVV: 111\nSecond Factor Authentication code: 1221\n```\n\nThe production environment is the live Instamojo environment where you cannot use the test card details and need to use a valid card to make a transaction. The developer credentials for this environment are will be available at [https://www.instamojo.com/integrations/](https://www.instamojo.com/integrations/)\n\nThe base URL for all your API requests to the sandbox environment should be:\n`https://www.instamojo.com/`","createdAt":"2017-02-15T08:45:51.618Z","parentDoc":null,"user":"56a1c959842b650d0088899c","childrenPages":[]}

What is the difference between the sandbox and production environment?


Instamojo provides you with an option to create a sandbox account to test your integration before you go live on your website or application. You do not have to submit documents or go through the regular onboarding flow when you create an account on the sandbox environment. You can sign up on the sandbox environment here: [https://test.instamojo.com](https://test.instamojo.com) The base URL for all your API requests to the sandbox environment should be: `https://test.instamojo.com/` All the credentials like API key, Auth Token and Private Salt will be available at: [https://test.instamojo.com/integrations/](https://test.instamojo.com/integrations) To test transaction, you can use the test card details, which are: ``` Card Number: 4242 4242 4242 4242 Exp MM/YY: 01/20 CVV: 111 Second Factor Authentication code: 1221 ``` The production environment is the live Instamojo environment where you cannot use the test card details and need to use a valid card to make a transaction. The developer credentials for this environment are will be available at [https://www.instamojo.com/integrations/](https://www.instamojo.com/integrations/) The base URL for all your API requests to the sandbox environment should be: `https://www.instamojo.com/`
Instamojo provides you with an option to create a sandbox account to test your integration before you go live on your website or application. You do not have to submit documents or go through the regular onboarding flow when you create an account on the sandbox environment. You can sign up on the sandbox environment here: [https://test.instamojo.com](https://test.instamojo.com) The base URL for all your API requests to the sandbox environment should be: `https://test.instamojo.com/` All the credentials like API key, Auth Token and Private Salt will be available at: [https://test.instamojo.com/integrations/](https://test.instamojo.com/integrations) To test transaction, you can use the test card details, which are: ``` Card Number: 4242 4242 4242 4242 Exp MM/YY: 01/20 CVV: 111 Second Factor Authentication code: 1221 ``` The production environment is the live Instamojo environment where you cannot use the test card details and need to use a valid card to make a transaction. The developer credentials for this environment are will be available at [https://www.instamojo.com/integrations/](https://www.instamojo.com/integrations/) The base URL for all your API requests to the sandbox environment should be: `https://www.instamojo.com/`
{"_id":"58a4155723b12b0f00dc35a3","updates":[],"__v":0,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"category":"58a413b423b12b0f00dc359e","link_url":"","slug":"can-i-make-api-calls-using-ajax","githubsync":"","isReference":false,"link_external":false,"hidden":false,"order":9,"parentDoc":null,"project":"56a1c9c13845200d0066d6fe","sync_unique":"","body":"No. We do not allow API calls over AJAX because it exposes your API credentials which can be easily misused.\n\nThe recommended way is to send a request to your server with the required data and from\nthere you should make a request to our API instead with the credentials being stored on your server. Once the API returns a response, you may then forward the result to your frontend.","createdAt":"2017-02-15T08:46:15.372Z","excerpt":"","title":"Can I make API calls using AJAX?","type":"basic","user":"56a1c959842b650d0088899c","next":{"pages":[],"description":""},"version":"56a1c9c23845200d0066d701","childrenPages":[]}

Can I make API calls using AJAX?


No. We do not allow API calls over AJAX because it exposes your API credentials which can be easily misused. The recommended way is to send a request to your server with the required data and from there you should make a request to our API instead with the credentials being stored on your server. Once the API returns a response, you may then forward the result to your frontend.
No. We do not allow API calls over AJAX because it exposes your API credentials which can be easily misused. The recommended way is to send a request to your server with the required data and from there you should make a request to our API instead with the credentials being stored on your server. Once the API returns a response, you may then forward the result to your frontend.
{"_id":"58a4156c23b12b0f00dc35a4","slug":"can-i-issue-multiple-partial-refunds-for-a-payment","sync_unique":"","version":"56a1c9c23845200d0066d701","body":"No. This is not supported at the moment. You can only [create one refund](doc:create-a-refund)  per payment.","excerpt":"","isReference":false,"next":{"pages":[],"description":""},"githubsync":"","parentDoc":null,"title":"Can I issue multiple partial refunds for a payment?","order":10,"project":"56a1c9c13845200d0066d6fe","updates":[],"user":"56a1c959842b650d0088899c","__v":0,"api":{"auth":"required","params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"language":"json","code":"{}","name":"","status":400}]},"settings":""},"hidden":false,"link_external":false,"category":"58a413b423b12b0f00dc359e","createdAt":"2017-02-15T08:46:36.241Z","link_url":"","type":"basic","childrenPages":[]}

Can I issue multiple partial refunds for a payment?


No. This is not supported at the moment. You can only [create one refund](doc:create-a-refund) per payment.
No. This is not supported at the moment. You can only [create one refund](doc:create-a-refund) per payment.
{"_id":"58a4158ab26c4a0f00fe5837","link_external":false,"sync_unique":"","version":"56a1c9c23845200d0066d701","api":{"results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"body":"No. This is not supported yet.\n\nHowever, you can use the `purpose` field for any information upto 30 characters regarding the payment request. We recommend you store and maintain any custom fields for a payment request at your end.","category":"58a413b423b12b0f00dc359e","link_url":"","order":11,"project":"56a1c9c13845200d0066d6fe","slug":"can-i-add-custom-fields-to-a-payment-request","type":"basic","excerpt":"","githubsync":"","hidden":false,"user":"56a1c959842b650d0088899c","next":{"pages":[],"description":""},"parentDoc":null,"title":"Can I add custom fields to a payment request?","createdAt":"2017-02-15T08:47:06.797Z","isReference":false,"__v":0,"updates":[],"childrenPages":[]}

Can I add custom fields to a payment request?


No. This is not supported yet. However, you can use the `purpose` field for any information upto 30 characters regarding the payment request. We recommend you store and maintain any custom fields for a payment request at your end.
No. This is not supported yet. However, you can use the `purpose` field for any information upto 30 characters regarding the payment request. We recommend you store and maintain any custom fields for a payment request at your end.
{"_id":"58a415a3b26c4a0f00fe5838","githubsync":"","slug":"i-get-a-failed-to-connect-to-wwwinstamojocom-port-443-connection-timed-out-error-what-is-wrong","type":"basic","__v":0,"category":"58a413b423b12b0f00dc359e","parentDoc":null,"project":"56a1c9c13845200d0066d6fe","title":"I get a \"Failed to connect to www.instamojo.com port 443: Connection timed out\" error. What is wrong?","order":12,"updates":[],"api":{"settings":"","auth":"required","params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]}},"body":"This indicates that the port 443 is blocked on your server. This port should be open for our API to work as we communicate with our servers only over HTTPS.\n\nYou would have to get in touch with your server admin and ask them to open this port.","hidden":false,"isReference":false,"link_url":"","user":"56a1c959842b650d0088899c","version":"56a1c9c23845200d0066d701","createdAt":"2017-02-15T08:47:31.132Z","excerpt":"","link_external":false,"next":{"pages":[],"description":""},"sync_unique":"","childrenPages":[]}

I get a "Failed to connect to www.instamojo.com port 443: Connection timed out" error. What is wrong?


This indicates that the port 443 is blocked on your server. This port should be open for our API to work as we communicate with our servers only over HTTPS. You would have to get in touch with your server admin and ask them to open this port.
This indicates that the port 443 is blocked on your server. This port should be open for our API to work as we communicate with our servers only over HTTPS. You would have to get in touch with your server admin and ask them to open this port.
{"_id":"58ef479cf8c3b00f00011c4d","type":"basic","api":{"auth":"required","params":[],"url":"","results":{"codes":[{"language":"json","code":"{}","name":"","status":200},{"code":"{}","name":"","status":400,"language":"json"}]},"settings":""},"body":"A payment request is an instrument to collect money for a specific purpose and amount from one or many customers. A payment request ID is generated when a new payment request is created. It is a random string of 32 characters and will be simlar to `4ce986c9d9614224bd044d1331c531ff`\n\nA payment ID is generated when a customer makes an actual payment against a payment request. There could be multiple payments (and hence multiple payment IDs) against a single payment request. A payment ID is a 20 character string prefixed with MOJO, for example `MOJO6c09000J31957837`","hidden":false,"project":"56a1c9c13845200d0066d6fe","title":"What is the difference between payment request ID and payment ID?","category":"58a413b423b12b0f00dc359e","next":{"pages":[],"description":""},"parentDoc":null,"slug":"what-is-the-difference-between-payment-request-id-and-payment-id","__v":0,"createdAt":"2017-04-13T09:40:44.423Z","excerpt":"","githubsync":"","link_external":false,"link_url":"","updates":[],"version":"56a1c9c23845200d0066d701","isReference":false,"order":13,"sync_unique":"","user":"56a1c959842b650d0088899c","childrenPages":[]}

What is the difference between payment request ID and payment ID?


A payment request is an instrument to collect money for a specific purpose and amount from one or many customers. A payment request ID is generated when a new payment request is created. It is a random string of 32 characters and will be simlar to `4ce986c9d9614224bd044d1331c531ff` A payment ID is generated when a customer makes an actual payment against a payment request. There could be multiple payments (and hence multiple payment IDs) against a single payment request. A payment ID is a 20 character string prefixed with MOJO, for example `MOJO6c09000J31957837`
A payment request is an instrument to collect money for a specific purpose and amount from one or many customers. A payment request ID is generated when a new payment request is created. It is a random string of 32 characters and will be simlar to `4ce986c9d9614224bd044d1331c531ff` A payment ID is generated when a customer makes an actual payment against a payment request. There could be multiple payments (and hence multiple payment IDs) against a single payment request. A payment ID is a 20 character string prefixed with MOJO, for example `MOJO6c09000J31957837`
{"_id":"58ef47fa24acc10f0096b003","order":14,"project":"56a1c9c13845200d0066d6fe","slug":"how-can-i-get-details-of-all-payments-for-a-payment-request","version":"56a1c9c23845200d0066d701","next":{"pages":[],"description":""},"hidden":false,"link_external":false,"createdAt":"2017-04-13T09:42:18.676Z","api":{"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"name":"","status":400,"language":"json","code":"{}"}]},"settings":"","auth":"required","params":[]},"category":"58a413b423b12b0f00dc359e","githubsync":"","parentDoc":null,"sync_unique":"","title":"How can I get details of all payments for a payment request?","type":"basic","body":"The [Get Payment Details](https://docs.instamojo.com/docs/get-details-of-payment) API can fetch the details of a payment from the payment ID and payment request ID.","excerpt":"","isReference":false,"link_url":"","updates":[],"user":"56a1c959842b650d0088899c","__v":0,"childrenPages":[]}

How can I get details of all payments for a payment request?


The [Get Payment Details](https://docs.instamojo.com/docs/get-details-of-payment) API can fetch the details of a payment from the payment ID and payment request ID.
The [Get Payment Details](https://docs.instamojo.com/docs/get-details-of-payment) API can fetch the details of a payment from the payment ID and payment request ID.
{"_id":"58ef48858646742f0099fe35","category":"58a413b423b12b0f00dc359e","createdAt":"2017-04-13T09:44:37.394Z","githubsync":"","link_external":false,"next":{"description":"","pages":[]},"order":15,"project":"56a1c9c13845200d0066d6fe","title":"How do I debug an Invalid Auth Token error?","user":"56a1c959842b650d0088899c","version":"56a1c9c23845200d0066d701","body":"Auth tokens and private keys can be fetched from https://www.instamojo.com/integrations.\n\nThe keys generated on https://test.instamojo.com and https://www.instamojo.com are not compatible with each other. Keep them separately and use only in the appropriate environment. Please validate and make sure that they don't get mixed up.\n\nAlso see [What is the difference between the sandbox and production environment?](https://docs.instamojo.com/docs/what-is-the-difference-between-the-sandbox-and-production-environment)","hidden":false,"parentDoc":null,"type":"basic","updates":[],"api":{"auth":"required","params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":""},"isReference":false,"link_url":"","slug":"how-to-debug-invalid-auth-token","sync_unique":"","__v":0,"excerpt":"","childrenPages":[]}

How do I debug an Invalid Auth Token error?


Auth tokens and private keys can be fetched from https://www.instamojo.com/integrations. The keys generated on https://test.instamojo.com and https://www.instamojo.com are not compatible with each other. Keep them separately and use only in the appropriate environment. Please validate and make sure that they don't get mixed up. Also see [What is the difference between the sandbox and production environment?](https://docs.instamojo.com/docs/what-is-the-difference-between-the-sandbox-and-production-environment)
Auth tokens and private keys can be fetched from https://www.instamojo.com/integrations. The keys generated on https://test.instamojo.com and https://www.instamojo.com are not compatible with each other. Keep them separately and use only in the appropriate environment. Please validate and make sure that they don't get mixed up. Also see [What is the difference between the sandbox and production environment?](https://docs.instamojo.com/docs/what-is-the-difference-between-the-sandbox-and-production-environment)