{"_id":"571749c3d2a6510e00840a86","__v":1,"api":{"params":[],"url":"","results":{"codes":[{"status":200,"name":"","code":"{}","language":"json"},{"code":"{}","language":"json","status":400,"name":""}]},"settings":"","auth":"required"},"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, the customer is redirected back to your app/website.*\n\n**Developer workflow: **\n\nOnce setup is complete, receiving payments via Instamojo is a simple 3 step process. \n  * Create a payment request \n  * Show payment form to the buyer in your app/site\n  * Get payment into your Instamojo account which gets credited into your registered bank account in T+3 Bank working days","createdAt":"2016-04-04T09:00:39.609Z","isReference":false,"project":"56a1c9c13845200d0066d6fe","type":"basic","category":"571749c2d2a6510e00840a83","githubsync":"","link_external":false,"link_url":"","version":"571749c2d2a6510e00840a82","excerpt":"","parentDoc":null,"title":"Instamojo Payment Experience","user":"56a1c959842b650d0088899c","hidden":false,"order":0,"slug":"overview-and-setup-1","sync_unique":"","updates":[],"metadata":{"title":"","description":"","image":[]},"next":{"description":"","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, the 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 the buyer in your app/site * Get payment into your Instamojo account which gets credited into your registered bank account in T+3 Bank working days
**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, the 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 the buyer in your app/site * Get payment into your Instamojo account which gets credited into your registered bank account in T+3 Bank working days
{"_id":"571749c3d2a6510e00840a87","body":"##  **Overview:**\n\nInstamojo payments work by creating request URLs that 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 payment in your mobile app, website or application.\n\nUsing the *Payment Request ID* you can display a payment form to your customers. Your customers can choose a payment method of their choice and make a payment. Once payment is made, you will receive a *Payment ID*.\n\n##**Setup:**\n\n  * Sign up on [Instamojo](https://www.instamojo.com).\n  * Signing up will create an account on Instamojo, from which you can obtain your Client ID and Client Secret (any will work). You will need these to create requests. \n\n#**IMPORTANT NOTE: **\n\nYou can test all our API endpoints in our [Sandbox (Test) Platform](https://test.instamojo.com). By signing up on our Sandbox platform, you can mock transactions to do end-to-end testing of your Integration flow. \n\nAfter signing up on our sandbox environment at https://test.instamojo.com/, the Base URL needs to be changed to `https://test.instamojo.com/` for all the below-given API calls. \n\nNote that along with the change of the Base URL, you need to use the `Client ID` and `Client Secret` that you have obtained from your Sandbox account for making the API calls.\n\n**The examples use our production URL.**","link_external":false,"order":1,"sync_unique":"","type":"basic","version":"571749c2d2a6510e00840a82","api":{"results":{"codes":[{"status":200,"name":"","code":"{}","language":"json"},{"code":"{}","language":"json","status":400,"name":""}]},"settings":"","auth":"required","params":[],"url":""},"link_url":"","project":"56a1c9c13845200d0066d6fe","updates":[],"hidden":false,"excerpt":"","isReference":false,"title":"Overview and Setup","__v":1,"category":"571749c2d2a6510e00840a83","createdAt":"2016-04-12T06:16:46.475Z","githubsync":"","parentDoc":null,"slug":"overview-and-setup-2","user":"56a1c959842b650d0088899c","metadata":{"title":"","description":"","image":[]},"next":{"description":"","pages":[]},"childrenPages":[]}

Overview and Setup


## **Overview:** Instamojo payments work by creating request URLs that 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 payment in your mobile app, website or application. Using the *Payment Request ID* you can display a payment form to your customers. Your customers can choose a payment method of their choice and make a payment. Once payment is made, you will receive a *Payment ID*. ##**Setup:** * Sign up on [Instamojo](https://www.instamojo.com). * Signing up will create an account on Instamojo, from which you can obtain your Client ID and Client Secret (any will work). You will need these to create requests. #**IMPORTANT NOTE: ** You can test all our API endpoints in our [Sandbox (Test) Platform](https://test.instamojo.com). By signing up on our Sandbox platform, you can mock transactions to do end-to-end testing of your Integration flow. After signing up on our sandbox environment at https://test.instamojo.com/, the Base URL needs to be changed to `https://test.instamojo.com/` for all the below-given API calls. Note that along with the change of the Base URL, you need to use the `Client ID` and `Client Secret` that you have obtained from your Sandbox account for making the API calls. **The examples use our production URL.**
## **Overview:** Instamojo payments work by creating request URLs that 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 payment in your mobile app, website or application. Using the *Payment Request ID* you can display a payment form to your customers. Your customers can choose a payment method of their choice and make a payment. Once payment is made, you will receive a *Payment ID*. ##**Setup:** * Sign up on [Instamojo](https://www.instamojo.com). * Signing up will create an account on Instamojo, from which you can obtain your Client ID and Client Secret (any will work). You will need these to create requests. #**IMPORTANT NOTE: ** You can test all our API endpoints in our [Sandbox (Test) Platform](https://test.instamojo.com). By signing up on our Sandbox platform, you can mock transactions to do end-to-end testing of your Integration flow. After signing up on our sandbox environment at https://test.instamojo.com/, the Base URL needs to be changed to `https://test.instamojo.com/` for all the below-given API calls. Note that along with the change of the Base URL, you need to use the `Client ID` and `Client Secret` that you have obtained from your Sandbox account for making the API calls. **The examples use our production URL.**
{"_id":"571749c3d2a6510e00840a88","githubsync":"","link_url":"","order":2,"title":"Integration guide","type":"basic","user":"56a1c959842b650d0088899c","category":"571749c2d2a6510e00840a83","link_external":false,"project":"56a1c9c13845200d0066d6fe","slug":"payments-api","version":"571749c2d2a6510e00840a82","__v":1,"api":{"auth":"required","params":[],"url":"","results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"code":"{}","language":"json","status":400,"name":""}]},"settings":""},"isReference":false,"parentDoc":null,"sync_unique":"","updates":[],"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 (MarketPlace)\n   * Hold and Release (MarketPlace)\n   * Light Checkout\n\n## Create a Payment Request:\n\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. You need to redirect the buyer to this Payment link programmatically by using redirection statements in your respective programming language.\n\n##Post payment processing:\n\n**1. Redirection:**\n\nOnce the payment is done user will be redirected to the `redirect_url` specified during the link creation and we will append three more query arguments with it: `payment_id`, `payment_request_id` and `payment_status`. \n\nExample:\n\nIf your `redirect_url` was http://www.example.com then the user will be redirected to something like: http://www.example.com?payment_id=MOJO5a06005J21512197&payment_status=Credit&payment_request_id=d66cb29dd059482e8072999f995c4eef \n\nNow using the `payment_request_id` and `payment_id` you can query our [Get Payment Details](https://docs.instamojo.com/docs/get-details-of-payment) endpoint to get the details related to the Request and Payment.\n\n**2. 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\": \"[email protected]\",\n    \"2-0\": \"buyer_name\",\n    \"2-1\": \"Buyer's name\",\n    \"2-2\": \"John Doe\",\n    \"3-0\": \"buyer_phone\",\n    \"3-2\": \"9999999999\",\n    \"3-1\": \"Buyer's phone number\",\n    \"4-0\": \"currency\",\n    \"4-1\": \"Currency related to the payment\",\n    \"4-2\": \"INR\",\n    \"5-0\": \"fees\",\n    \"5-1\": \"Fees charged by Instamojo\",\n    \"5-2\": \"125.00\",\n    \"6-0\": \"longurl\",\n    \"6-1\": \"URL related to the payment request\",\n    \"6-2\": \"https://www.instamojo.com/@ashwch/d66cb29dd059482e8072999f995c4eef\",\n    \"7-0\": \"mac\",\n    \"8-0\": \"payment_id\",\n    \"9-0\": \"payment_request_id\",\n    \"10-0\": \"purpose\",\n    \"11-0\": \"shorturl\",\n    \"12-0\": \"status\",\n    \"12-1\": \"Status of the Payment. This can be either \\\"Credit\\\" or \\\"Failed\\\".\",\n    \"12-2\": \"Credit\",\n    \"11-1\": \"Short URL of the payment request\",\n    \"10-1\": \"Purpose of the Payment request\",\n    \"10-2\": \"FIFA 16\",\n    \"8-2\": \"MOJO5a06005J21512197\",\n    \"9-2\": \"d66cb29dd059482e8072999f995c4eef\",\n    \"7-2\": \"1ddf3b78f84d071324c0bf1d3f095898267d60ee\",\n    \"11-2\": \"https://imjo.in/NNxHg\",\n    \"7-1\": \"Message Authentication code of this webhook request\",\n    \"8-1\": \"ID of the payment\",\n    \"9-1\": \"ID of the payment request\"\n  },\n  \"cols\": 3,\n  \"rows\": 13\n}\n[/block]\nFor more information on how to validate the webhook request using `mac` read: [What is the Message Authentication Code in Webhook?](http://support.instamojo.com/support/solutions/articles/139575-what-is-the-message-authentication-code-in-webhook-)\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\n\\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?>\",\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**1. 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**2. Floating Checkout: **\n\nAllow customers to pay without leaving your website.\n\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[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    }\n  ]\n}\n[/block]\nThe above code stylizes the button with the default light green for light backgrounds with (data-style=\"light\")\n\n**All styling options**\n  * For light backgrounds (Green button): data-style=\"light\"\n  * For dark backgrounds (Yellow button) : data-style=\"dark\"\n  * Flat button for light backgrounds : data-style=\"flat\"\n  * Flat button for dark backgrounds : data-style=\"flat-dark\"\n  * No styling : data-style=\"no-style\"\n\n\n**3. Collecting fees [[Marketplace](https://docs.instamojo.com/v2/docs/create-a-payment-request)]: **\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**4. Hold and Release [[Marketplace](https://docs.instamojo.com/v2/docs/create-a-payment-request)]: **\n\nSuccessful payments are paid out/released automatically within 3 days. \nIn case you want to hold the release till you get the fulfillment 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\n**5. Releasing the payment [[Marketplace]([https://docs.instamojo.com/v2/docs/fulfil-a-payment)]: **\n\nNow, suppose a payment request has been created and 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/`","createdAt":"2016-04-04T07:13:26.162Z","excerpt":"","hidden":false,"metadata":{"title":"","description":"","image":[]},"next":{"description":"","pages":[]},"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 (MarketPlace) * Hold and Release (MarketPlace) * 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. You need to redirect the buyer to this Payment link programmatically by using redirection statements in your respective programming language. ##Post payment processing: **1. Redirection:** Once the payment is done user will be redirected to the `redirect_url` specified during the link creation and we will append three more query arguments with it: `payment_id`, `payment_request_id` and `payment_status`. Example: If your `redirect_url` was http://www.example.com then the user will be redirected to something like: http://www.example.com?payment_id=MOJO5a06005J21512197&payment_status=Credit&payment_request_id=d66cb29dd059482e8072999f995c4eef Now using the `payment_request_id` and `payment_id` you can query our [Get Payment Details](https://docs.instamojo.com/docs/get-details-of-payment) endpoint to get the details related to the Request and Payment. **2. 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": "[email protected]", "2-0": "buyer_name", "2-1": "Buyer's name", "2-2": "John Doe", "3-0": "buyer_phone", "3-2": "9999999999", "3-1": "Buyer's phone number", "4-0": "currency", "4-1": "Currency related to the payment", "4-2": "INR", "5-0": "fees", "5-1": "Fees charged by Instamojo", "5-2": "125.00", "6-0": "longurl", "6-1": "URL related to the payment request", "6-2": "https://www.instamojo.com/@ashwch/d66cb29dd059482e8072999f995c4eef", "7-0": "mac", "8-0": "payment_id", "9-0": "payment_request_id", "10-0": "purpose", "11-0": "shorturl", "12-0": "status", "12-1": "Status of the Payment. This can be either \"Credit\" or \"Failed\".", "12-2": "Credit", "11-1": "Short URL of the payment request", "10-1": "Purpose of the Payment request", "10-2": "FIFA 16", "8-2": "MOJO5a06005J21512197", "9-2": "d66cb29dd059482e8072999f995c4eef", "7-2": "1ddf3b78f84d071324c0bf1d3f095898267d60ee", "11-2": "https://imjo.in/NNxHg", "7-1": "Message Authentication code of this webhook request", "8-1": "ID of the payment", "9-1": "ID of the payment request" }, "cols": 3, "rows": 13 } [/block] For more information on how to validate the webhook request using `mac` read: [What is the Message Authentication Code in Webhook?](http://support.instamojo.com/support/solutions/articles/139575-what-is-the-message-authentication-code-in-webhook-) [block:code] { "codes": [ { "code": "<?php\n\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" }, { "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: ** **1. 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 **2. 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" } ] } [/block] The above code stylizes 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" **3. Collecting fees [[Marketplace](https://docs.instamojo.com/v2/docs/create-a-payment-request)]: ** 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" **4. Hold and Release [[Marketplace](https://docs.instamojo.com/v2/docs/create-a-payment-request)]: ** Successful payments are paid out/released automatically within 3 days. In case you want to hold the release till you get the fulfillment 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` **5. Releasing the payment [[Marketplace]([https://docs.instamojo.com/v2/docs/fulfil-a-payment)]: ** Now, suppose a payment request has been created and 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 (MarketPlace) * Hold and Release (MarketPlace) * 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. You need to redirect the buyer to this Payment link programmatically by using redirection statements in your respective programming language. ##Post payment processing: **1. Redirection:** Once the payment is done user will be redirected to the `redirect_url` specified during the link creation and we will append three more query arguments with it: `payment_id`, `payment_request_id` and `payment_status`. Example: If your `redirect_url` was http://www.example.com then the user will be redirected to something like: http://www.example.com?payment_id=MOJO5a06005J21512197&payment_status=Credit&payment_request_id=d66cb29dd059482e8072999f995c4eef Now using the `payment_request_id` and `payment_id` you can query our [Get Payment Details](https://docs.instamojo.com/docs/get-details-of-payment) endpoint to get the details related to the Request and Payment. **2. 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": "[email protected]", "2-0": "buyer_name", "2-1": "Buyer's name", "2-2": "John Doe", "3-0": "buyer_phone", "3-2": "9999999999", "3-1": "Buyer's phone number", "4-0": "currency", "4-1": "Currency related to the payment", "4-2": "INR", "5-0": "fees", "5-1": "Fees charged by Instamojo", "5-2": "125.00", "6-0": "longurl", "6-1": "URL related to the payment request", "6-2": "https://www.instamojo.com/@ashwch/d66cb29dd059482e8072999f995c4eef", "7-0": "mac", "8-0": "payment_id", "9-0": "payment_request_id", "10-0": "purpose", "11-0": "shorturl", "12-0": "status", "12-1": "Status of the Payment. This can be either \"Credit\" or \"Failed\".", "12-2": "Credit", "11-1": "Short URL of the payment request", "10-1": "Purpose of the Payment request", "10-2": "FIFA 16", "8-2": "MOJO5a06005J21512197", "9-2": "d66cb29dd059482e8072999f995c4eef", "7-2": "1ddf3b78f84d071324c0bf1d3f095898267d60ee", "11-2": "https://imjo.in/NNxHg", "7-1": "Message Authentication code of this webhook request", "8-1": "ID of the payment", "9-1": "ID of the payment request" }, "cols": 3, "rows": 13 } [/block] For more information on how to validate the webhook request using `mac` read: [What is the Message Authentication Code in Webhook?](http://support.instamojo.com/support/solutions/articles/139575-what-is-the-message-authentication-code-in-webhook-) [block:code] { "codes": [ { "code": "<?php\n\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" }, { "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: ** **1. 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 **2. 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" } ] } [/block] The above code stylizes 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" **3. Collecting fees [[Marketplace](https://docs.instamojo.com/v2/docs/create-a-payment-request)]: ** 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" **4. Hold and Release [[Marketplace](https://docs.instamojo.com/v2/docs/create-a-payment-request)]: ** Successful payments are paid out/released automatically within 3 days. In case you want to hold the release till you get the fulfillment 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` **5. Releasing the payment [[Marketplace]([https://docs.instamojo.com/v2/docs/fulfil-a-payment)]: ** Now, suppose a payment request has been created and 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":"5e4279da383a0a00449c1bc7","project":"56a1c9c13845200d0066d6fe","version":"571749c2d2a6510e00840a82","category":"571749c2d2a6510e00840a84","user":"5c45a4f06cf9350c77afa79c","updates":[],"next":{"pages":[],"description":""},"createdAt":"2020-02-11T09:54:34.013Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"settings":"5729f56e7f34182900ce9d55","results":{"codes":[{"code":"{\n  \"access_token\": \"y70kak2K0Rg7J4PAL8sdW0MutnGJEl\",\n  \"token_type\": \"Bearer\",\n  \"expires_in\": 36000,\n  \"scope\": \"read write\"\n}","language":"json","status":200,"name":""},{"name":"","code":"{\n  \"error\": \"unsupported_grant_type\"\n}","language":"json","status":400},{"status":401,"language":"json","code":"{\n  \"error\": \"invalid_client\"\n}"}]},"method":"post","examples":{"codes":[{"code":"<?php\n\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, 'https://api.instamojo.com/oauth2/token/');     \ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\n\n$payload = Array(\n    'grant_type' => 'client_credentials',\n    'client_id' => '21fe14a60057ece6c76496175cb0238a2ffd87be',\n    'client_secret' => '-KWPoDO!_l?MZQ-DsZeQ0TXXcvuDn;mxmAtGho8Xijn=iH6F'\n  );\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":"python","code":"import requests\nrequests.post('https://api.instamojo.com/oauth2/token/', data={\n    \t'grant_type': 'client_credentials',\n  \t\t'client_id': '21fe14a60057ece6c76496175cb0238a2ffd87be',\n    \t'client_secret': '-KWPoDO!_l?MZQ-DsZeQ0TXXcvuDn;mxmAtGho8Xijn=iH6F'\n})\n              "},{"language":"curl","code":"curl https://api.instamojo.com/oauth2/token/ \\\n  --data \n\"grant_type=client_credentials&client_id=21fe14a60057ece6c76496175cb0238a2ffd87be&client_secret=-KWPoDO!_l?MZQ-DsZeQ0TXXcvuDn;mxmAtGho8Xijn=iH6F\""}]},"auth":"never","params":[{"_id":"5729f771fcecb90e00b0a9c7","ref":"","in":"body","required":true,"desc":"This describes the type of authentication.","default":"client_credentials","type":"string","name":"grant_type"},{"_id":"5729f771fcecb90e00b0a9c6","ref":"","in":"body","required":true,"desc":"The client_id that is provided to you.","default":"","type":"string","name":"client_id"},{"_id":"5729fe10fcecb90e00b0a9e3","ref":"","in":"body","required":true,"desc":"The client_secret that is provided to you.","default":"","type":"string","name":"client_secret"}],"url":"/oauth2/token/"},"isReference":true,"order":0,"body":"","excerpt":"","slug":"generate-access-token-application-based-authentication","type":"post","title":"Generate Access token (Application Based Authentication)","__v":0,"parentDoc":null,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

postGenerate Access token (Application Based Authentication)


Body Params

grant_type:
required
stringclient_credentials
This describes the type of authentication.
client_id:
required
string
The client_id that is provided to you.
client_secret:
required
string
The client_secret that is provided to you.

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":"5e427a1cdf13b5001b4172d5","project":"56a1c9c13845200d0066d6fe","version":"571749c2d2a6510e00840a82","category":"571749c2d2a6510e00840a84","user":"5c45a4f06cf9350c77afa79c","updates":[],"next":{"pages":[],"description":""},"createdAt":"2020-02-11T09:55:40.774Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"settings":"5729f56e7f34182900ce9d55","results":{"codes":[{"name":"","code":"{\n  \"id\": \"05f317448ad84649aa1a9c7328edb015\",\n  \"user\": \"https://api.instamojo.com/v2/users/90f01dfdacbe4fe7892fc27dbdc30906/\",\n  \"phone\": \"+919999999999\",\n  \"email\": \"[email protected]\",\n  \"buyer_name\": \"John Doe\",\n  \"amount\": \"2500\",\n  \"purpose\": \"FIFA 16\",\n  \"status\": \"Pending\",\n  \"payments\": [],\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/@foo/05f317448ad84649aa1a9c7328edb015\",\n  \"redirect_url\": \"http://www.example.com/redirect/\",\n  \"webhook\": \"http://www.example.com/webhook/\",\n  \"created_at\": \"2016-05-09T16:10:13.786Z\",\n  \"modified_at\": \"2016-05-09T16:10:13.786Z\",\n  \"resource_uri\": \"https://api.instamojo.com/v2/payment_requests/05f317448ad84649aa1a9c7328edb015/\",\n  \"allow_repeated_payments\": false,\n  \"mark_fulfilled\": true\n}","language":"json","status":200},{"name":"","code":"{\n  \"purpose\": [\n    \"This field is required.\"\n  ],\n  \"amount\": [\n    \"This field is required.\"\n  ]\n}","language":"json","status":400},{"code":"{\n  \"success\": false,\n  \"message\": \"Authentication credentials were not provided.\"\n}","status":401,"language":"json"}]},"method":"post","examples":{"codes":[{"language":"php","code":"<?php\n\n$ch = curl_init();\n\ncurl_setopt($ch, CURLOPT_URL, 'https://api.instamojo.com/v2/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,array('Authorization: Bearer y70kak2K0Rg7J4PAL8sdW0MutnGJEl'));\n\n$payload = Array(\n  'purpose' => 'FIFA 16',\n  'amount' => '2500',\n  'buyer_name' => 'John Doe',\n  'email' => '[email protected]',\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}\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\n?>"},{"language":"python","code":"import requests\n\nheaders = { \n\t\"Authorization\": \"Bearer y70kak2K0Rg7J4PAL8sdW0MutnGJEl\"\n}\npayload = {\n  'purpose': 'FIFA 16',\n  'amount': '2500',\n  'buyer_name': 'John Doe',\n  'email': '[email protected]',\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(\n  \"https://api.instamojo.com/v2/payment_requests/\", \n  data=payload, \n  headers=headers\n)              "}]},"auth":"required","params":[{"name":"amount","type":"double","default":"","desc":"The amount for the request. The minimum amount is 9. And the maximum is 200000.","required":true,"in":"body","ref":"","_id":"5730b6f626bd5a3600d337e8"},{"name":"purpose","type":"string","default":"","desc":"Purpose of the payment request.","required":true,"in":"body","ref":"","_id":"5730b6f626bd5a3600d337e7"},{"name":"buyer_name","type":"string","default":"","desc":"Name of payer","required":false,"in":"body","ref":"","_id":"5730b6f626bd5a3600d337e6"},{"name":"email","type":"string","default":"","desc":"Email of payer","required":false,"in":"body","ref":"","_id":"5730b6f626bd5a3600d337e5"},{"name":"phone","type":"string","default":"","desc":"Phone number of payer","required":false,"in":"body","ref":"","_id":"5730b6f626bd5a3600d337e4"},{"name":"redirect_url","type":"string","default":"","desc":"URL where we redirect the user after a payment. If provided, we will redirect the user to `redirect_url` immediately after the payment has been processed. Three additional query arguments `payment_request_id`, `payment_status` and `payment_id` are also sent with the redirect URL.","required":false,"in":"body","ref":"","_id":"5730b6f626bd5a3600d337e3"},{"name":"webhook","type":"string","default":"","desc":"URL where our server do POST request after a payment  If provided, we will do a the POST request to the webhook (url) with full details of the payment","required":false,"in":"body","ref":"","_id":"5730b6f626bd5a3600d337e2"},{"name":"allow_repeated_payments","type":"boolean","default":"True","desc":"If `allow_repeated_payments` is `false`, only one payment can be paid on a payment request link. `allow_repeated_payments` is `true` by default.","required":false,"in":"body","ref":"","_id":"5730b6f626bd5a3600d337e1"},{"name":"send_email","type":"boolean","default":"False","desc":"Flag to send request link via email.  If `send_email` is `true`, a request email will be sent to the email supplied. If `send_email` is `true` but no email is supplied, request creation will throw an error.","required":false,"in":"body","ref":"","_id":"5730b6f626bd5a3600d337df"},{"name":"send_sms","type":"boolean","default":"False","desc":"Flag to send request link via SMS.  If `send_sms` is `true`, a request SMS will be sent to the phone number supplied. If `send_sms` is `true` but no phone number is supplied, request creation will throw an error.","required":false,"in":"body","ref":"","_id":"5730b6f626bd5a3600d337de"},{"name":"expires_at","type":"datetime","default":"","desc":"Time after which the payment request will be expired in UTC timestamp. Max value is 600 seconds. Default is Null","required":false,"in":"body","ref":"","_id":"58fdf14fc1e51e19004127ca"},{"name":"Authorization","type":"string","default":"Bearer <your-token>","desc":"","required":false,"in":"header","ref":"","_id":"612b68d09f8847001077771b"}],"url":"/v2/payment_requests/"},"isReference":true,"order":1,"body":"","excerpt":"This will create a payment request on Instamojo. You need to use a token that is obtained using the Application Based Authentication.","slug":"create-a-payment-request-1","type":"post","title":"Create a Payment Request","__v":4,"parentDoc":null,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

postCreate a Payment Request

This will create a payment request on Instamojo. You need to use a token that is obtained using the Application Based Authentication.

Body Params

amount:
required
double
The amount for the request. The minimum amount is 9. And the maximum is 200000.
purpose:
required
string
Purpose of the payment request.
buyer_name:
string
Name of payer
email:
string
Email of payer
phone:
string
Phone number of payer
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. Three additional query arguments `payment_request_id`, `payment_status` 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 in UTC timestamp. Max value is 600 seconds. Default is Null

Headers

Authorization:
stringBearer <your-token>

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":"5e427a811bc28000181eba20","project":"56a1c9c13845200d0066d6fe","version":"571749c2d2a6510e00840a82","category":"571749c2d2a6510e00840a84","user":"5c45a4f06cf9350c77afa79c","updates":[],"next":{"pages":[],"description":""},"createdAt":"2020-02-11T09:57:21.519Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"language":"php","code":"<?php\n\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, 'https://api.instamojo.com/v2/payment_requests/9ef9b530ff8e440dbbc29f2157bc69ad/');\ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\n\ncurl_setopt($ch, CURLOPT_HTTPHEADER,array('Authorization: Bearer y70kak2K0Rg7J4PAL8sdW0MutnGJEl'));\n\n$response = curl_exec($ch);\ncurl_close($ch); \n\n?>"},{"language":"python","code":"import requests\n\nheaders = { \n\t\"Authorization\": \"Bearer y70kak2K0Rg7J4PAL8sdW0MutnGJEl\"\n}\n\nresponse = requests.get(\n  \"https://api.instamojo.com/v2/payment_requests/9ef9b530ff8e440dbbc29f2157bc69ad/\", \n  headers=headers\n)              "}]},"settings":"5729f56e7f34182900ce9d55","results":{"codes":[{"name":"","code":"{\n  \"id\": \"05f317448ad84649aa1a9c7328edb015\",\n  \"user\": \"https://api.instamojo.com/v2/users/90f01dfdacbe4fe7892fc27dbdc30906/\",\n  \"phone\": \"+919999999999\",\n  \"email\": \"[email protected]\",\n  \"buyer_name\": \"John Doe\",\n  \"amount\": \"2500\",\n  \"purpose\": \"FIFA 16\",\n  \"status\": \"Pending\",\n  \"payments\": [],\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/@foo/05f317448ad84649aa1a9c7328edb015\",\n  \"redirect_url\": \"http://www.example.com/redirect/\",\n  \"webhook\": \"http://www.example.com/webhook/\",\n  \"created_at\": \"2016-05-09T16:10:13.786Z\",\n  \"modified_at\": \"2016-05-09T16:10:13.786Z\",\n  \"resource_uri\": \"https://api.instamojo.com/v2/payment_requests/05f317448ad84649aa1a9c7328edb015/\",\n  \"allow_repeated_payments\": false,\n  \"mark_fulfilled\": true\n}","language":"json","status":200},{"status":401,"language":"json","code":"{\n  \"success\": false,\n  \"message\": \"Authentication credentials were not provided.\"\n}"}]},"method":"get","auth":"required","params":[{"name":"id","type":"string","default":"","desc":"","required":false,"in":"path","ref":"","_id":"5800752e039bda2300152195"},{"name":"Authorization","type":"string","default":"Bearer <your-token>","desc":"","required":false,"in":"header","ref":"","_id":"612b6ab9a4b7a700689e3dfc"}],"url":"/v2/payment_requests/:id/"},"isReference":true,"order":2,"body":"","excerpt":"This will fetch the details of a payment request on Instamojo. You need to use a token that is obtained using the Application Based Authentication.","slug":"get-a-payment-request-1","type":"get","title":"Get a Payment Request","__v":3,"parentDoc":null,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

getGet a Payment Request

This will fetch the details of a payment request on Instamojo. You need to use a token that is obtained using the Application Based Authentication.

Path Params

id:
string

Headers

Authorization:
stringBearer <your-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



{"_id":"5e427abe99dd44001f03b082","project":"56a1c9c13845200d0066d6fe","version":"571749c2d2a6510e00840a82","category":"571749c2d2a6510e00840a84","user":"5c45a4f06cf9350c77afa79c","updates":[],"next":{"pages":[],"description":""},"createdAt":"2020-02-11T09:58:22.244Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"name":"","status":200,"language":"json","code":"{\n  \"order_id\": \"3b56d216-74c2-4189-83f3-9c2e93bad1be\",\n  \"name\": \"Vedhavyas\",\n  \"email\": \"[email protected]\",\n  \"phone\": \"+919663445546\",\n  \"amount\": \"100.00\"\n}"},{"status":400,"language":"json","code":"{\n  \"id\": [\n    \"This field is required.\"\n  ]\n}","name":""},{"status":401,"language":"text","code":"{\n  \"success\": false,\n  \"message\": \"Authentication credentials were not provided.\"\n}"}]},"method":"post","examples":{"codes":[{"language":"php","code":"<?php\n\n$ch = curl_init();\n\ncurl_setopt($ch, CURLOPT_URL, 'https://api.instamojo.com/v2/gateway/orders/payment-request/');\ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\ncurl_setopt($ch, CURLOPT_HTTPHEADER,array('Authorization: Bearer y70kak2K0Rg7J4PAL8sdW0MutnGJEl'));\n\n$payload = Array(\n    'id' => '9c337d3c5e3242fca818937366b915b4'\n);\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\n?>"},{"language":"python","code":"import requests\n\nheaders = { \n\t\"Authorization\": \"Bearer y70kak2K0Rg7J4PAL8sdW0MutnGJEl\"\n}\npayload = {\n  'id': '9c337d3c5e3242fca818937366b915b4',\n}\nresponse = requests.post(\n  \"https://api.instamojo.com/v2/gateway/orders/payment-request/\", \n  data=payload, \n  headers=headers\n)      "}]},"settings":"5729f56e7f34182900ce9d55","auth":"required","params":[{"name":"id","type":"string","default":"","desc":"Payment Request ID","required":false,"in":"body","ref":"","_id":"583803120bd5ea190004b72d"},{"name":"Authorization","type":"string","default":"Bearer <your-token>","desc":"","required":false,"in":"header","ref":"","_id":"612b6a9b7b83c700735eec30"}],"url":"/v2/gateway/orders/payment-request/"},"isReference":true,"order":3,"body":"","excerpt":"This will create a Order on Instamojo. You need to use a token that is obtained using the Application Based Authentication.","slug":"create-an-order-using-payment-request-id-1","type":"post","title":"Create an Order using Payment Request ID (For SDK only)","__v":6,"parentDoc":null,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

postCreate an Order using Payment Request ID (For SDK only)

This will create a Order on Instamojo. You need to use a token that is obtained using the Application Based Authentication.

Body Params

id:
string
Payment Request ID

Headers

Authorization:
stringBearer <your-token>

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":"5e427a91ef6bd30026ac058b","project":"56a1c9c13845200d0066d6fe","version":"571749c2d2a6510e00840a82","category":"571749c2d2a6510e00840a84","user":"5c45a4f06cf9350c77afa79c","updates":[],"next":{"pages":[],"description":""},"createdAt":"2020-02-11T09:57:37.529Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"method":"get","results":{"codes":[{"name":"","code":"{\n    \"id\": \"MOJO7726005A06926769\",\n  \t\"title\": \"Sample payment\",\n\t  \"payment_type\": \"instapay\",\n  \t\"payment_request\": null,\n    \"status\": true,\n\t\t\"link\": null,\n\t\t\"product\": null,\n    \"seller\": \"https://api.instamojo.com/v2/users/5b75694e1c1b498c9ceabed9cd5719cf/\",\n    \"currency\": \"INR\",\n    \"amount\": \"13.90\",\n    \"name\": \"Buyer Name\",\n    \"email\": \"[email protected]\",\n    \"phone\": \"+919595959595\",\n\t\t\"payout\": \"https://api.instamojo.com/v2/payouts/MOJO8425001M94982125/\",\n    \"fees\": \"3.30\",\n    \"total_taxes\": \"0.60\",\n  \t\"cases\": [],\n    \"affiliate_id\": null,\n    \"affiliate_commission\": \"0.00\",\n    \"order_info\": {\n  \t    \"link_slug\": null,\n\t      \"link_title\": null,\n        \"shipping_address\": null,\n        \"shipping_city\": null,\n        \"shipping_state\": null,\n        \"shipping_zip\": null,\n        \"shipping_country\": null,\n        \"quantity\": 1,\n        \"unit_price\": \"10.00\",\n        \"discount_code\": null,\n\t      \"discount_amount_off\": null,\t\n        \"custom_fields\": {},\n        \"variants\": []\n    },\n    \"instrument_type\": \"CARD\",\n\t\t\"billing_instrument\": \"Domestic Regular Credit Card (Visa/Mastercard)\",\n    \n    \"failure\": null,\n    \"created_at\": \"2017-07-26T12:45:23.431453Z\",\n    \"updated_at\": \"2017-07-26T23:31:39.020180Z\",\n\t\t\"tax_invoice_id\": \"038193561/000002\",\n    \"resource_uri\": \"https://api.instamojo.com/v2/payments/MOJO7726005A06926769/\"\n}","language":"json","status":200},{"status":401,"language":"json","code":"{\n  \"success\": false,\n  \"message\": \"Authentication credentials were not provided.\"\n}"}]},"settings":"5729f56e7f34182900ce9d55","examples":{"codes":[{"language":"php","code":"<?php\n\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, 'https://api.instamojo.com/v2/payments/MOJO7726005A06926769/');\ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\n\ncurl_setopt($ch, CURLOPT_HTTPHEADER,array('Authorization: Bearer y70kak2K0Rg7J4PAL8sdW0MutnGJEl'));\n\n$response = curl_exec($ch);\ncurl_close($ch); \n\n?>"},{"language":"python","code":"import requests\n\nheaders = { \n\t\"Authorization\": \"Bearer y70kak2K0Rg7J4PAL8sdW0MutnGJEl\"\n}\n\nresponse = requests.get(\n  \"https://api.instamojo.com/v2/payments/MOJO7726005A06926769/\", \n  headers=headers\n)"}]},"auth":"required","params":[{"name":"id","type":"string","default":"","desc":"Payment ID","required":false,"in":"path","ref":"","_id":"5800752e039bda2300152195"},{"name":"Authorization","type":"string","default":"Bearer <your-token>","desc":"","required":false,"in":"header","ref":"","_id":"612b6a89aef82b00634b4611"}],"url":"/v2/payments/:id/"},"isReference":true,"order":4,"body":"[block:api-header]\n{\n  \"title\": \"Response Fields\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field Name\",\n    \"h-1\": \"Possible Values\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"status\",\n    \"0-1\": \"* true\\n* false\\n* null\",\n    \"0-2\": \"Indicates the status of the payment.\\n\\n* **true** => Successful\\n* **false** => Failed\\n* **null** => Initiated\",\n    \"1-0\": \"instrument_type\",\n    \"1-1\": \"* CARD \\n* EMI\\n* NETBANKING\\n* UPI\\n* WALLET\",\n    \"1-2\": \"Indicates the instrument type used for the payment.\",\n    \"2-0\": \"failure\",\n    \"2-1\": \"* null\\n* Object:\\n  * reason\\n  * message\",\n    \"2-2\": \"Gives the failure reason of why the payment failed. This will have non-null values for failed payments only.\\n\\nreason => Type of failure.\\nmessage => Failure message returned by upstream provider.\",\n    \"3-0\": \"billing_instrument\",\n    \"3-1\": \"* null\\n* Unknown card\\n* Domestic Regular Credit Card (Visa/Mastercard)\\n* Domestic Premium Credit/Charge Card (Amex/Diners)\\n* Domestic Regular Debit Card (Visa/Mastercard)\\n* International Regular Credit Card (Visa/Mastercard)\\n* International Premium Credit/Charge Card (Amex/Diners)\\n* International Regular Debit Card\\n* Domestic Netbanking Category A (HDFC/ICICI)\\n* Domestic Netbanking Category B (Other banks)\\n* Wallet\\n* UPI\\n* Unknown netbanking choice\\n* EMI Payment\\n* Bank Transfer\",\n    \"3-2\": \"Gives the subcategory of the 'instrument_type' that was used to make the Payment.\",\n    \"4-0\": \"payout\",\n    \"4-1\": \"* null\\n* Link: v2 API link of payout object.\",\n    \"4-2\": \"Gives you the Payout details once the Payout has been processed. \\n\\nThe response will be 'null' for the cases where the Payout has not been processed yet.\",\n    \"5-0\": \"payment_request\",\n    \"5-1\": \"* null\\n* Link: v2 API link of payment request object.\",\n    \"5-2\": \"Response will be 'null' if payment is not made against a payment request.\\n\\nIf payment is made against a payment request, response will be the v2 API link of payment request object.\",\n    \"6-0\": \"order_info\",\n    \"6-1\": \"Object\",\n    \"6-2\": \"Gives information about the order for which the payment is made.\",\n    \"7-0\": \"\"\n  },\n  \"cols\": 3,\n  \"rows\": 7\n}\n[/block]","excerpt":"This will fetch the details of a payment on Instamojo. You need to use a token that is obtained using the Application Based Authentication.","slug":"get-payment-details-1","type":"get","title":"Get Payment Details","__v":5,"parentDoc":null,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

getGet Payment Details

This will fetch the details of a payment on Instamojo. You need to use a token that is obtained using the Application Based Authentication.

Path Params

id:
string
Payment ID

Headers

Authorization:
stringBearer <your-token>
[block:api-header] { "title": "Response Fields" } [/block] [block:parameters] { "data": { "h-0": "Field Name", "h-1": "Possible Values", "h-2": "Description", "0-0": "status", "0-1": "* true\n* false\n* null", "0-2": "Indicates the status of the payment.\n\n* **true** => Successful\n* **false** => Failed\n* **null** => Initiated", "1-0": "instrument_type", "1-1": "* CARD \n* EMI\n* NETBANKING\n* UPI\n* WALLET", "1-2": "Indicates the instrument type used for the payment.", "2-0": "failure", "2-1": "* null\n* Object:\n * reason\n * message", "2-2": "Gives the failure reason of why the payment failed. This will have non-null values for failed payments only.\n\nreason => Type of failure.\nmessage => Failure message returned by upstream provider.", "3-0": "billing_instrument", "3-1": "* null\n* Unknown card\n* Domestic Regular Credit Card (Visa/Mastercard)\n* Domestic Premium Credit/Charge Card (Amex/Diners)\n* Domestic Regular Debit Card (Visa/Mastercard)\n* International Regular Credit Card (Visa/Mastercard)\n* International Premium Credit/Charge Card (Amex/Diners)\n* International Regular Debit Card\n* Domestic Netbanking Category A (HDFC/ICICI)\n* Domestic Netbanking Category B (Other banks)\n* Wallet\n* UPI\n* Unknown netbanking choice\n* EMI Payment\n* Bank Transfer", "3-2": "Gives the subcategory of the 'instrument_type' that was used to make the Payment.", "4-0": "payout", "4-1": "* null\n* Link: v2 API link of payout object.", "4-2": "Gives you the Payout details once the Payout has been processed. \n\nThe response will be 'null' for the cases where the Payout has not been processed yet.", "5-0": "payment_request", "5-1": "* null\n* Link: v2 API link of payment request object.", "5-2": "Response will be 'null' if payment is not made against a payment request.\n\nIf payment is made against a payment request, response will be the v2 API link of payment request object.", "6-0": "order_info", "6-1": "Object", "6-2": "Gives information about the order for which the payment is made.", "7-0": "" }, "cols": 3, "rows": 7 } [/block]

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



[block:api-header] { "title": "Response Fields" } [/block] [block:parameters] { "data": { "h-0": "Field Name", "h-1": "Possible Values", "h-2": "Description", "0-0": "status", "0-1": "* true\n* false\n* null", "0-2": "Indicates the status of the payment.\n\n* **true** => Successful\n* **false** => Failed\n* **null** => Initiated", "1-0": "instrument_type", "1-1": "* CARD \n* EMI\n* NETBANKING\n* UPI\n* WALLET", "1-2": "Indicates the instrument type used for the payment.", "2-0": "failure", "2-1": "* null\n* Object:\n * reason\n * message", "2-2": "Gives the failure reason of why the payment failed. This will have non-null values for failed payments only.\n\nreason => Type of failure.\nmessage => Failure message returned by upstream provider.", "3-0": "billing_instrument", "3-1": "* null\n* Unknown card\n* Domestic Regular Credit Card (Visa/Mastercard)\n* Domestic Premium Credit/Charge Card (Amex/Diners)\n* Domestic Regular Debit Card (Visa/Mastercard)\n* International Regular Credit Card (Visa/Mastercard)\n* International Premium Credit/Charge Card (Amex/Diners)\n* International Regular Debit Card\n* Domestic Netbanking Category A (HDFC/ICICI)\n* Domestic Netbanking Category B (Other banks)\n* Wallet\n* UPI\n* Unknown netbanking choice\n* EMI Payment\n* Bank Transfer", "3-2": "Gives the subcategory of the 'instrument_type' that was used to make the Payment.", "4-0": "payout", "4-1": "* null\n* Link: v2 API link of payout object.", "4-2": "Gives you the Payout details once the Payout has been processed. \n\nThe response will be 'null' for the cases where the Payout has not been processed yet.", "5-0": "payment_request", "5-1": "* null\n* Link: v2 API link of payment request object.", "5-2": "Response will be 'null' if payment is not made against a payment request.\n\nIf payment is made against a payment request, response will be the v2 API link of payment request object.", "6-0": "order_info", "6-1": "Object", "6-2": "Gives information about the order for which the payment is made.", "7-0": "" }, "cols": 3, "rows": 7 } [/block]
{"_id":"5e427aa068f2450011c7ddc3","project":"56a1c9c13845200d0066d6fe","version":"571749c2d2a6510e00840a82","category":"571749c2d2a6510e00840a84","user":"5c45a4f06cf9350c77afa79c","updates":[],"next":{"pages":[],"description":""},"createdAt":"2020-02-11T09:57:52.976Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[{"name":"","code":"{\n    \"refund\": {\n        \"id\": \"C5c0751269\",\n        \"payment_id\": \"MOJO5c04000J30502939\",\n        \"status\": \"Refunded\",\n        \"type\": \"QFL\",\n        \"body\": \"Customer isn't satisfied with the quality\",\n        \"refund_amount\": \"100\",\n        \"total_amount\": \"100.00\",\n        \"created_at\": \"2015-12-07T11:01:37.640Z\"\n    },\n    \"success\": true\n}","language":"json","status":200},{"status":401,"language":"json","code":"{\n  \"success\": false,\n  \"message\": \"Authentication credentials were not provided.\"\n}"}]},"method":"post","examples":{"codes":[{"language":"php","code":"<?php\n\n$ch = curl_init();\n\ncurl_setopt($ch, CURLOPT_URL, 'https://api.instamojo.com/v2/payments/MOJO5c04000J30502939/refund/');\ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\ncurl_setopt($ch, CURLOPT_HTTPHEADER,array('Authorization: Bearer y70kak2K0Rg7J4PAL8sdW0MutnGJEl'));\n\n$payload = Array(\n    'transaction_id' => 'partial_refund_1',\n    'type' => 'TNR',\n    'body' => 'Need to refund to the buyer.',\n    'refund_amount' => '100'\n);\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\n?>"},{"language":"python","code":"import requests\n\nheaders = { \n\t\"Authorization\": \"Bearer y70kak2K0Rg7J4PAL8sdW0MutnGJEl\"\n}\n\npayload = {\n  'transaction_id': 'partial_refund_1',\n\t'type': 'TNR',\n  'body': 'Need to refund to the buyer.',\n  'refund_amount': '100'\n}\n\nresponse = requests.post(\n  \"https://api.instamojo.com/v2/payments/MOJO5c04000J30502939/refund/\", \n  headers=headers,\n  data=payload\n)              "}]},"settings":"5729f56e7f34182900ce9d55","auth":"required","params":[{"name":"type","type":"string","default":"","desc":"A three letter short-code identifying the reason for this case.","required":true,"in":"body","ref":"","_id":"5730b9f7053a062b00cf464a"},{"name":"body","type":"string","default":"","desc":"Additonal text explaining the refund.","required":true,"in":"body","ref":"","_id":"5730b9f7053a062b00cf4649"},{"name":"refund_amount","type":"string","default":"Paid amount","desc":"This field can be used to specify the refund amount. For instance, you may want to issue a refund for an amount lesser than what was paid. Default is paid amount.","required":false,"in":"body","ref":"","_id":"5730b9f7053a062b00cf4648"},{"name":"payment_id","type":"string","default":"","desc":"","required":false,"in":"path","ref":"","_id":"58007538456c950f000e57f7"},{"name":"transaction_id","type":"string","default":"required","desc":"Mandatory parameter in the body from the second case creation onwards for the payment to prevent duplicate case creations due to replay of APIs","required":true,"in":"body","ref":"","_id":"5cc182f36ad63801ab22c4ab"},{"name":"Authorization","type":"string","default":"Bearer <your-token>","desc":"","required":false,"in":"header","ref":"","_id":"612b6a4c48eae70048d5cb36"}],"url":"/v2/payments/:payment_id/refund/"},"isReference":true,"order":5,"body":"Valid values for type are:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Type\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"RFD\",\n    \"0-1\": \"Duplicate/delayed payment.\",\n    \"1-1\": \"Product/service no longer available.\",\n    \"2-1\": \"Customer not satisfied.\",\n    \"3-1\": \"Product lost/damaged.\",\n    \"4-1\": \"Digital download issue.\",\n    \"5-1\": \"Event was canceled/changed.\",\n    \"6-1\": \"Problem not described above.\",\n    \"1-0\": \"TNR\",\n    \"2-0\": \"QFL\",\n    \"6-0\": \"PTH\",\n    \"5-0\": \"TAN\",\n    \"4-0\": \"EWN\",\n    \"3-0\": \"QNR\"\n  },\n  \"cols\": 2,\n  \"rows\": 7\n}\n[/block]","excerpt":"This will refund a payment made on Instamojo. You need to use a token that is obtained using the Application Based Authentication.","slug":"create-a-refund-1","type":"post","title":"Create a Refund","__v":4,"parentDoc":null,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

postCreate a Refund

This will refund a payment made on Instamojo. You need to use a token that is obtained using the Application Based Authentication.

Path Params

payment_id:
string

Body Params

type:
required
string
A three letter short-code identifying the reason for this case.
body:
required
string
Additonal text explaining the refund.
refund_amount:
stringPaid amount
This field can be used to specify the refund amount. For instance, you may want to issue a refund for an amount lesser than what was paid. Default is paid amount.
transaction_id:
required
stringrequired
Mandatory parameter in the body from the second case creation onwards for the payment to prevent duplicate case creations due to replay of APIs

Headers

Authorization:
stringBearer <your-token>
Valid values for type are: [block:parameters] { "data": { "h-0": "Type", "h-1": "Description", "0-0": "RFD", "0-1": "Duplicate/delayed payment.", "1-1": "Product/service no longer available.", "2-1": "Customer not satisfied.", "3-1": "Product lost/damaged.", "4-1": "Digital download issue.", "5-1": "Event was canceled/changed.", "6-1": "Problem not described above.", "1-0": "TNR", "2-0": "QFL", "6-0": "PTH", "5-0": "TAN", "4-0": "EWN", "3-0": "QNR" }, "cols": 2, "rows": 7 } [/block]

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



Valid values for type are: [block:parameters] { "data": { "h-0": "Type", "h-1": "Description", "0-0": "RFD", "0-1": "Duplicate/delayed payment.", "1-1": "Product/service no longer available.", "2-1": "Customer not satisfied.", "3-1": "Product lost/damaged.", "4-1": "Digital download issue.", "5-1": "Event was canceled/changed.", "6-1": "Problem not described above.", "1-0": "TNR", "2-0": "QFL", "6-0": "PTH", "5-0": "TAN", "4-0": "EWN", "3-0": "QNR" }, "cols": 2, "rows": 7 } [/block]
{"_id":"5fe067e23aaad1006e3813de","metadata":{"image":[],"title":"","description":""},"api":{"url":"/v2/resolutioncenter/cases/:id/","auth":"required","settings":"5729f56e7f34182900ce9d55","results":{"codes":[{"name":"","code":"{\n    \"id\": \"C5c0751272\",\n    \"created_by\": null,\n    \"payment\": \"https://api.instamojo.com/v2/payments/MOJO5a06005J21512197/\",\n    \"status\": \"FINI\",\n    \"resolution_status\": \"FINI_CONC\",\n    \"status_text\": \"Refunded\",\n    \"type\": \"QFL\",\n    \"body\": \"Customer isn't satisfied with the quality\",\n    \"refund_amount\": \"2500.00\",\n    \"references\": [\n        {\n            \"id\": \"MOJO0a22U05M99838558\",\n            \"type\": \"Payment held.\",\n            \"created_at\": \"2020-10-22T11:57:21.477161Z\"\n        },\n        {\n            \"id\": \"MOJO0a22Q05M99854564\",\n            \"type\": \"Held payment reversed.\",\n            \"created_at\": \"2020-10-22T17:07:58.171682Z\"\n        },\n        {\n            \"id\": \"MOJO0a22W05M99854566\",\n            \"type\": \"Payment settled.\",\n            \"created_at\": \"2020-10-22T17:07:58.229600Z\"\n        }\n    ],\n    \"refunds\": [\n        {\n            \"id\": \"7ad3f73f-2a6c-4326-95e6-38381db7e969\",\n            \"status\": \"Completed\",\n            \"bank_reference_number\": \"IGAJRIYGL4\",\n            \"created_at\": \"2020-10-22T17:07:58.272904Z\"\n        }\n    ],\n    \"transaction_id\": \"1603367841023\",\n    \"created_at\": \"2020-10-22T11:57:21.410686Z\",\n    \"updated_at\": \"2020-10-22T17:07:58.322985Z\",\n    \"resource_uri\": \"https://api.instamojo.com/v2/resolutioncenter/cases/C0a2233225/\",\n    \"creator_name\": \"Sample seller\"\n}","language":"json","status":200},{"name":"","code":"{\n  \"success\": false,\n  \"message\": \"Authentication credentials were not provided.\"\n}","language":"json","status":401}]},"params":[{"name":"id","type":"string","default":"","desc":"ID of the refund","required":true,"in":"path","ref":"","_id":"5fe067e23aaad1006e3813df"},{"name":"Authorization","type":"string","default":"Bearer <your-token>","desc":"","required":false,"in":"header","ref":"","_id":"612b6a6f59614d005575b75d"}],"examples":{"codes":[{"code":"import requests\n\nheaders = { \n\t\"Authorization\": \"Bearer y70kak2K0Rg7J4PAL8sdW0MutnGJEl\"\n}\n\nresponse = requests.get(\n  \"https://api.instamojo.com/v2/resolutioncenter/cases/C5c0751272/\", \n  headers=headers\n)","language":"python"},{"code":"<?php\n\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, 'https://api.instamojo.com/v2/resolutioncenter/cases/C5c0751272/');\ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\n\ncurl_setopt($ch, CURLOPT_HTTPHEADER,array('Authorization: Bearer y70kak2K0Rg7J4PAL8sdW0MutnGJEl'));\n\n$response = curl_exec($ch);\ncurl_close($ch); \n\n?>","language":"php"}]},"method":"get"},"next":{"description":"","pages":[]},"title":"Get details of a refund","type":"get","slug":"get-details-of-a-refund-1","excerpt":"This will fetch the details of a refund made on a payment on Instamojo.","body":"**Required token scope** : \"cases:read\"\n[block:api-header]\n{\n  \"title\": \"Response Fields\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field Name\",\n    \"h-1\": \"Possible Values\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"payment\",\n    \"0-1\": \"* v2 link to payment object\",\n    \"0-2\": \"v2 link to payment against which the refund is made\",\n    \"1-0\": \"resolution_status\",\n    \"1-1\": \"* null\\n* FINI_CONC\\n* FINI_DENY\\n* FINI_WITH\\n* FINI_INIT\",\n    \"1-2\": \"Describes the status of the refund. \\n\\n* **null** => case is still not closed\\n* **FINI_CONC** => Refunded\\n* **FINI_DENY** => Case Resolved\\n* **FINI_WITH** => Cancelled\\n* **FINI_INIT** => Case Closed\",\n    \"2-0\": \"refunds['bank_reference_number']\",\n    \"3-0\": \"creator name\",\n    \"2-2\": \"This is the reference number which is used to track status of  refund.\",\n    \"3-2\": \"Name of the creator of the refund case.\"\n  },\n  \"cols\": 3,\n  \"rows\": 4\n}\n[/block]","updates":[],"order":6,"isReference":true,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"createdAt":"2020-12-21T09:16:18.272Z","user":"5fd891969841f400324d36d1","category":"571749c2d2a6510e00840a84","version":"571749c2d2a6510e00840a82","project":"56a1c9c13845200d0066d6fe","__v":1,"parentDoc":null,"childrenPages":[]}

getGet details of a refund

This will fetch the details of a refund made on a payment on Instamojo.

Path Params

id:
required
string
ID of the refund

Headers

Authorization:
stringBearer <your-token>
**Required token scope** : "cases:read" [block:api-header] { "title": "Response Fields" } [/block] [block:parameters] { "data": { "h-0": "Field Name", "h-1": "Possible Values", "h-2": "Description", "0-0": "payment", "0-1": "* v2 link to payment object", "0-2": "v2 link to payment against which the refund is made", "1-0": "resolution_status", "1-1": "* null\n* FINI_CONC\n* FINI_DENY\n* FINI_WITH\n* FINI_INIT", "1-2": "Describes the status of the refund. \n\n* **null** => case is still not closed\n* **FINI_CONC** => Refunded\n* **FINI_DENY** => Case Resolved\n* **FINI_WITH** => Cancelled\n* **FINI_INIT** => Case Closed", "2-0": "refunds['bank_reference_number']", "3-0": "creator name", "2-2": "This is the reference number which is used to track status of refund.", "3-2": "Name of the creator of the refund case." }, "cols": 3, "rows": 4 } [/block]

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 token scope** : "cases:read" [block:api-header] { "title": "Response Fields" } [/block] [block:parameters] { "data": { "h-0": "Field Name", "h-1": "Possible Values", "h-2": "Description", "0-0": "payment", "0-1": "* v2 link to payment object", "0-2": "v2 link to payment against which the refund is made", "1-0": "resolution_status", "1-1": "* null\n* FINI_CONC\n* FINI_DENY\n* FINI_WITH\n* FINI_INIT", "1-2": "Describes the status of the refund. \n\n* **null** => case is still not closed\n* **FINI_CONC** => Refunded\n* **FINI_DENY** => Case Resolved\n* **FINI_WITH** => Cancelled\n* **FINI_INIT** => Case Closed", "2-0": "refunds['bank_reference_number']", "3-0": "creator name", "2-2": "This is the reference number which is used to track status of refund.", "3-2": "Name of the creator of the refund case." }, "cols": 3, "rows": 4 } [/block]
{"_id":"571749c3d2a6510e00840a89","githubsync":"","parentDoc":null,"sync_unique":"","user":"56a1c959842b650d0088899c","__v":30,"createdAt":"2016-04-04T08:58:43.574Z","hidden":false,"isReference":false,"link_external":false,"order":0,"slug":"overview-and-setup","api":{"results":{"codes":[{"name":"","code":"{}","language":"json","status":200},{"name":"","code":"{}","language":"json","status":400}]},"settings":"","url":"","auth":"required","params":[]},"body":"##How Instamojo works\n\nInstamojo works by creating payment requests.\n\nFor example: _Superstore_ wants to accept payments, they create a payment request which looks like this: \n\n`https://www.instamojo.com/@SuperStore/2f89f6a267ad4543a0906ff762481563`\n\nThey can share this link with their customers and receive payments online. \n\nThe Instamojo Marketplace flow is an extension of the above. You can create payment requests on behalf of a merchant in your marketplace/system, facilitate payments and payouts to them. \n\nThe Marketplace API can also be used to debit your commission from your merchants. While creating payment requests on behalf of merchants in your marketplace/system, you can receive a certain commission from each sale, while automatically transferring the rest of the amount to your merchant’s bank account. \n\n##Marketplace API use cases\n\n*Marketplace Model*\n\nThe marketplace API is used by aggregators where sellers are charged a certain commission for each product sold on the platform. This split of commission is automatically done with the marketplace API.\n\n> Eg: _Superstore_ registers on the marketplace _Mojocart_. _Mojocart_ uses the Instamojo marketplace API to create an account for _Superstore_ on Instamojo. _Mojocart_ then proceeds to use Instamojo for all payments, compliance, payouts, security, risk and fraud-protection for _Superstore_.\n\n*Franchisee Model*\n\nThe marketplace API allows the parent to set a commission for each transaction and hence, automates the process of reconciling payments with its branches. \n\n> Eg: _SuperStore HQ_ has branches like _SuperStore Mumbai_, _SuperStore Bangalore_, etc.\nEach branch will collect payments, however a small commission of each transaction should go to _SuperStore HQ_ too. \n\n*Vendor Model*\n\nThe API can also be used by an agency to collect commissions from payments collected by a product/software that was customised and built for a client.\n\n> Eg: _InvoiceWrite_ has an invoicing solution where they would like to integrate online payments and also collect a small percentage of each transaction processed.","category":"571749c2d2a6510e00840a85","type":"basic","version":"571749c2d2a6510e00840a82","excerpt":"An introduction","link_url":"","title":"Marketplace API","project":"56a1c9c13845200d0066d6fe","updates":[],"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

Marketplace API

An introduction

##How Instamojo works Instamojo works by creating payment requests. For example: _Superstore_ wants to accept payments, they create a payment request which looks like this: `https://www.instamojo.com/@SuperStore/2f89f6a267ad4543a0906ff762481563` They can share this link with their customers and receive payments online. The Instamojo Marketplace flow is an extension of the above. You can create payment requests on behalf of a merchant in your marketplace/system, facilitate payments and payouts to them. The Marketplace API can also be used to debit your commission from your merchants. While creating payment requests on behalf of merchants in your marketplace/system, you can receive a certain commission from each sale, while automatically transferring the rest of the amount to your merchant’s bank account. ##Marketplace API use cases *Marketplace Model* The marketplace API is used by aggregators where sellers are charged a certain commission for each product sold on the platform. This split of commission is automatically done with the marketplace API. > Eg: _Superstore_ registers on the marketplace _Mojocart_. _Mojocart_ uses the Instamojo marketplace API to create an account for _Superstore_ on Instamojo. _Mojocart_ then proceeds to use Instamojo for all payments, compliance, payouts, security, risk and fraud-protection for _Superstore_. *Franchisee Model* The marketplace API allows the parent to set a commission for each transaction and hence, automates the process of reconciling payments with its branches. > Eg: _SuperStore HQ_ has branches like _SuperStore Mumbai_, _SuperStore Bangalore_, etc. Each branch will collect payments, however a small commission of each transaction should go to _SuperStore HQ_ too. *Vendor Model* The API can also be used by an agency to collect commissions from payments collected by a product/software that was customised and built for a client. > Eg: _InvoiceWrite_ has an invoicing solution where they would like to integrate online payments and also collect a small percentage of each transaction processed.
##How Instamojo works Instamojo works by creating payment requests. For example: _Superstore_ wants to accept payments, they create a payment request which looks like this: `https://www.instamojo.com/@SuperStore/2f89f6a267ad4543a0906ff762481563` They can share this link with their customers and receive payments online. The Instamojo Marketplace flow is an extension of the above. You can create payment requests on behalf of a merchant in your marketplace/system, facilitate payments and payouts to them. The Marketplace API can also be used to debit your commission from your merchants. While creating payment requests on behalf of merchants in your marketplace/system, you can receive a certain commission from each sale, while automatically transferring the rest of the amount to your merchant’s bank account. ##Marketplace API use cases *Marketplace Model* The marketplace API is used by aggregators where sellers are charged a certain commission for each product sold on the platform. This split of commission is automatically done with the marketplace API. > Eg: _Superstore_ registers on the marketplace _Mojocart_. _Mojocart_ uses the Instamojo marketplace API to create an account for _Superstore_ on Instamojo. _Mojocart_ then proceeds to use Instamojo for all payments, compliance, payouts, security, risk and fraud-protection for _Superstore_. *Franchisee Model* The marketplace API allows the parent to set a commission for each transaction and hence, automates the process of reconciling payments with its branches. > Eg: _SuperStore HQ_ has branches like _SuperStore Mumbai_, _SuperStore Bangalore_, etc. Each branch will collect payments, however a small commission of each transaction should go to _SuperStore HQ_ too. *Vendor Model* The API can also be used by an agency to collect commissions from payments collected by a product/software that was customised and built for a client. > Eg: _InvoiceWrite_ has an invoicing solution where they would like to integrate online payments and also collect a small percentage of each transaction processed.
{"_id":"571a0f2ef65d1922005dc0e8","excerpt":"","githubsync":"","next":{"description":"","pages":[]},"order":1,"parentDoc":null,"slug":"overview-and-setup-3","body":"##Basic integration flow\n\n\n1.\tCreate an account for your marketplace on Instamojo\n\n2.\tUse the [Merchant Signup API](doc:signup) to create accounts for your merchants on your marketplace. \n\n3.\tGet access tokens for your merchants.\n\n4.     Add their bank information.\n\n5.\tCreate payment links for your merchants and share them with buyers, or redirect the buyers to these payment links to receive payments. \n\n6.\tOnce a payment is made, it takes 3 business days to transfer the funds into your merchant’s bank account. \n\n##Setup\n\n1.\tIt’s recommended to test your integration in our sandbox environment. Sign up on https://test.instamojo.com and write to us at [email protected] stating your username for us to send your `client_id`, `client_secret` and `referrer`. Note that in the base API endpoint for our sandbox environment is **https://test.instamojo.com/** not **https://api.instamojo.com/**.\n\n2.\tOnce you’re done with testing the API, please signup on https://www.instamojo.com and complete your KYC verification. Please allow our compliance team 48 hours to verify your account. \n3.\tOnce your account has been approved, please get in touch with [email protected] for your `client_id`, `client_secret` and `referrer`. Please note that you must take precautions to safeguard this information, because if exposed, it can be misused.","createdAt":"2016-04-22T11:46:54.995Z","title":"Overview and Setup","category":"571749c2d2a6510e00840a85","hidden":false,"__v":15,"sync_unique":"","updates":[],"user":"56a1c959842b650d0088899c","api":{"settings":"","url":"","auth":"required","params":[],"results":{"codes":[{"code":"{}","name":"","status":200,"language":"json"},{"name":"","status":400,"language":"json","code":"{}"}]}},"link_url":"","project":"56a1c9c13845200d0066d6fe","type":"basic","version":"571749c2d2a6510e00840a82","isReference":false,"link_external":false,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

Overview and Setup


##Basic integration flow 1. Create an account for your marketplace on Instamojo 2. Use the [Merchant Signup API](doc:signup) to create accounts for your merchants on your marketplace. 3. Get access tokens for your merchants. 4. Add their bank information. 5. Create payment links for your merchants and share them with buyers, or redirect the buyers to these payment links to receive payments. 6. Once a payment is made, it takes 3 business days to transfer the funds into your merchant’s bank account. ##Setup 1. It’s recommended to test your integration in our sandbox environment. Sign up on https://test.instamojo.com and write to us at [email protected] stating your username for us to send your `client_id`, `client_secret` and `referrer`. Note that in the base API endpoint for our sandbox environment is **https://test.instamojo.com/** not **https://api.instamojo.com/**. 2. Once you’re done with testing the API, please signup on https://www.instamojo.com and complete your KYC verification. Please allow our compliance team 48 hours to verify your account. 3. Once your account has been approved, please get in touch with [email protected] for your `client_id`, `client_secret` and `referrer`. Please note that you must take precautions to safeguard this information, because if exposed, it can be misused.
##Basic integration flow 1. Create an account for your marketplace on Instamojo 2. Use the [Merchant Signup API](doc:signup) to create accounts for your merchants on your marketplace. 3. Get access tokens for your merchants. 4. Add their bank information. 5. Create payment links for your merchants and share them with buyers, or redirect the buyers to these payment links to receive payments. 6. Once a payment is made, it takes 3 business days to transfer the funds into your merchant’s bank account. ##Setup 1. It’s recommended to test your integration in our sandbox environment. Sign up on https://test.instamojo.com and write to us at [email protected] stating your username for us to send your `client_id`, `client_secret` and `referrer`. Note that in the base API endpoint for our sandbox environment is **https://test.instamojo.com/** not **https://api.instamojo.com/**. 2. Once you’re done with testing the API, please signup on https://www.instamojo.com and complete your KYC verification. Please allow our compliance team 48 hours to verify your account. 3. Once your account has been approved, please get in touch with [email protected] for your `client_id`, `client_secret` and `referrer`. Please note that you must take precautions to safeguard this information, because if exposed, it can be misused.
{"_id":"571749c3d2a6510e00840a8a","__v":34,"createdAt":"2016-04-04T10:53:29.247Z","hidden":false,"title":"Integration Guide","type":"basic","user":"56a1c959842b650d0088899c","excerpt":"","category":"571749c2d2a6510e00840a85","isReference":false,"link_url":"","parentDoc":null,"project":"56a1c9c13845200d0066d6fe","sync_unique":"","api":{"auth":"required","params":[],"results":{"codes":[{"status":200,"name":"","code":"{}","language":"json"},{"name":"","code":"{}","language":"json","status":400}]},"settings":"","url":""},"body":"##Integration Steps\n\n\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Restricted Access\",\n  \"body\": \"The Marketplace API is available only to select customers based on their business needs.\\nRegular Instamojo API credentials will not work for the Marketplace API.\\n\\nFor credentials related to Marketplace API contact [email protected] and specify your platform (production/sandbox).\"\n}\n[/block]\n##Authentication Flow\n\nAll API interactions required you to have a authentication credentials. Use the `client_id` and `client_secret` to authenticate yourself against the API. There are three kinds of authentication:\n\n1. [Application Based](doc:application-based-authentication) - This gives you extra privileges like creating an account on Instamojo.\n\n2. [User Based](doc:user-based-authentication) - This gives you privileges for performing actions on a user's account. For eg: updating their name and location, creating payment links on their behalf, etc.\n\n3. [Refresh Token Based](doc:refresh-token-based-authentication) - An `access_token` obtained via the User Based authentication will expire in `36000` seconds. But it also gives a `refresh_token`, which can be used to obtain a new pair of `access_token` and `refresh_token` without the need for the `username` and `password`.\n\n\n\n## Signup Flow\n\n1. Use **Application Based Authentication** to get an `access_token`.\n\n2. Use this `access_token` to create a user on Instamojo. Here you should use a valid email id and a  password. Ensure that you are not storing the password in your system. On signup, you will receive a unique `id` for the user, which will be used henceforth to identify the user.\n\n3. Use **User Based Authentication** to get an `access_token`. You will need the password for the first time when you are requesting an `access_token` in this step. Going forward, you must store the `access_token` and `refresh_token` safely in your database, and discard the password that you had used. If the current `access_token` expires, you should use the **Refresh Token Based** authentication to get a new pair of `access_token` and `refresh_token`.\n\n4. Use this `access_token` to update the bank account details of the user.\n\n\n\n## Payment flow\n\n1. Use **User Based Authentication** to get an `access_token`.\n\n2. Use this `access_token` to create a payment link.\n\n3. Send the payment link to the buyer.\n\n4. When the payment is complete, we will send you a `webhook` request or redirect the buyer to your `redirect_url` depending on the mode chosen by you while creating the payment link.\n\n\n\n## Additional Features\n\n1. Refunds - Use this feature if you want to refund the complete or partial amount for a payment. \n\n2. Collecting fees - Use this feature if you want to collect a commission fee on each transaction that you drive via your marketplace.\n\n3. Hold and Release - You can specify to hold a payment until you are confident that the buyer has received the services for their payment. Once you tell us to release the payment, only then the merchant will be paid out.\n\n4. Light Checkout - You can use this to display only the payment form. This is useful if you are going to use this in a mobile app or within your website. To use this feature, simply append `?embed` at the end of the payment link.","githubsync":"","link_external":false,"next":{"description":"","pages":[]},"order":2,"slug":"integration-guide","updates":["58412f6e426cf70f006f5054"],"version":"571749c2d2a6510e00840a82","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

Integration Guide


##Integration Steps [block:callout] { "type": "danger", "title": "Restricted Access", "body": "The Marketplace API is available only to select customers based on their business needs.\nRegular Instamojo API credentials will not work for the Marketplace API.\n\nFor credentials related to Marketplace API contact [email protected] and specify your platform (production/sandbox)." } [/block] ##Authentication Flow All API interactions required you to have a authentication credentials. Use the `client_id` and `client_secret` to authenticate yourself against the API. There are three kinds of authentication: 1. [Application Based](doc:application-based-authentication) - This gives you extra privileges like creating an account on Instamojo. 2. [User Based](doc:user-based-authentication) - This gives you privileges for performing actions on a user's account. For eg: updating their name and location, creating payment links on their behalf, etc. 3. [Refresh Token Based](doc:refresh-token-based-authentication) - An `access_token` obtained via the User Based authentication will expire in `36000` seconds. But it also gives a `refresh_token`, which can be used to obtain a new pair of `access_token` and `refresh_token` without the need for the `username` and `password`. ## Signup Flow 1. Use **Application Based Authentication** to get an `access_token`. 2. Use this `access_token` to create a user on Instamojo. Here you should use a valid email id and a password. Ensure that you are not storing the password in your system. On signup, you will receive a unique `id` for the user, which will be used henceforth to identify the user. 3. Use **User Based Authentication** to get an `access_token`. You will need the password for the first time when you are requesting an `access_token` in this step. Going forward, you must store the `access_token` and `refresh_token` safely in your database, and discard the password that you had used. If the current `access_token` expires, you should use the **Refresh Token Based** authentication to get a new pair of `access_token` and `refresh_token`. 4. Use this `access_token` to update the bank account details of the user. ## Payment flow 1. Use **User Based Authentication** to get an `access_token`. 2. Use this `access_token` to create a payment link. 3. Send the payment link to the buyer. 4. When the payment is complete, we will send you a `webhook` request or redirect the buyer to your `redirect_url` depending on the mode chosen by you while creating the payment link. ## Additional Features 1. Refunds - Use this feature if you want to refund the complete or partial amount for a payment. 2. Collecting fees - Use this feature if you want to collect a commission fee on each transaction that you drive via your marketplace. 3. Hold and Release - You can specify to hold a payment until you are confident that the buyer has received the services for their payment. Once you tell us to release the payment, only then the merchant will be paid out. 4. Light Checkout - You can use this to display only the payment form. This is useful if you are going to use this in a mobile app or within your website. To use this feature, simply append `?embed` at the end of the payment link.
##Integration Steps [block:callout] { "type": "danger", "title": "Restricted Access", "body": "The Marketplace API is available only to select customers based on their business needs.\nRegular Instamojo API credentials will not work for the Marketplace API.\n\nFor credentials related to Marketplace API contact [email protected] and specify your platform (production/sandbox)." } [/block] ##Authentication Flow All API interactions required you to have a authentication credentials. Use the `client_id` and `client_secret` to authenticate yourself against the API. There are three kinds of authentication: 1. [Application Based](doc:application-based-authentication) - This gives you extra privileges like creating an account on Instamojo. 2. [User Based](doc:user-based-authentication) - This gives you privileges for performing actions on a user's account. For eg: updating their name and location, creating payment links on their behalf, etc. 3. [Refresh Token Based](doc:refresh-token-based-authentication) - An `access_token` obtained via the User Based authentication will expire in `36000` seconds. But it also gives a `refresh_token`, which can be used to obtain a new pair of `access_token` and `refresh_token` without the need for the `username` and `password`. ## Signup Flow 1. Use **Application Based Authentication** to get an `access_token`. 2. Use this `access_token` to create a user on Instamojo. Here you should use a valid email id and a password. Ensure that you are not storing the password in your system. On signup, you will receive a unique `id` for the user, which will be used henceforth to identify the user. 3. Use **User Based Authentication** to get an `access_token`. You will need the password for the first time when you are requesting an `access_token` in this step. Going forward, you must store the `access_token` and `refresh_token` safely in your database, and discard the password that you had used. If the current `access_token` expires, you should use the **Refresh Token Based** authentication to get a new pair of `access_token` and `refresh_token`. 4. Use this `access_token` to update the bank account details of the user. ## Payment flow 1. Use **User Based Authentication** to get an `access_token`. 2. Use this `access_token` to create a payment link. 3. Send the payment link to the buyer. 4. When the payment is complete, we will send you a `webhook` request or redirect the buyer to your `redirect_url` depending on the mode chosen by you while creating the payment link. ## Additional Features 1. Refunds - Use this feature if you want to refund the complete or partial amount for a payment. 2. Collecting fees - Use this feature if you want to collect a commission fee on each transaction that you drive via your marketplace. 3. Hold and Release - You can specify to hold a payment until you are confident that the buyer has received the services for their payment. Once you tell us to release the payment, only then the merchant will be paid out. 4. Light Checkout - You can use this to display only the payment form. This is useful if you are going to use this in a mobile app or within your website. To use this feature, simply append `?embed` at the end of the payment link.
{"_id":"5729f771fcecb90e00b0a9c5","title":"Application Based Authentication","user":"56a1c959842b650d0088899c","githubsync":"","link_url":"","sync_unique":"","editedParams2":true,"isReference":true,"project":"56a1c9c13845200d0066d6fe","slug":"application-based-authentication","createdAt":"2016-05-04T13:21:53.476Z","editedParams":true,"parentDoc":null,"type":"post","updates":["5926ecfd6c729e0f005963be","59a50906192dba000fc9c932","5a3e2ba8d757ef00120e963e"],"body":"","category":"5729f40a7f34182900ce9d52","order":0,"hidden":false,"link_external":false,"version":"571749c2d2a6510e00840a82","__v":6,"api":{"auth":"never","examples":{"codes":[{"code":"<?php\n\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, 'https://api.instamojo.com/oauth2/token/');     \ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\n\n$payload = Array(\n    'grant_type' => 'client_credentials',\n    'client_id' => '21fe14a60057ece6c76496175cb0238a2ffd87be',\n    'client_secret' => '-KWPoDO!_l?MZQ-DsZeQ0TXXcvuDn;mxmAtGho8Xijn=iH6F'\n  );\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":"python","code":"import requests\nrequests.post('https://api.instamojo.com/oauth2/token/', data={\n    \t'grant_type': 'client_credentials',\n  \t\t'client_id': '21fe14a60057ece6c76496175cb0238a2ffd87be',\n    \t'client_secret': '-KWPoDO!_l?MZQ-DsZeQ0TXXcvuDn;mxmAtGho8Xijn=iH6F'\n})\n              "},{"language":"curl","code":"curl https://api.instamojo.com/oauth2/token/ \\\n  --data \n\"grant_type=client_credentials&client_id=21fe14a60057ece6c76496175cb0238a2ffd87be&client_secret=-KWPoDO!_l?MZQ-DsZeQ0TXXcvuDn;mxmAtGho8Xijn=iH6F\""}]},"method":"post","params":[{"_id":"5729f771fcecb90e00b0a9c7","ref":"","in":"body","required":true,"desc":"This describes the type of authentication.","default":"client_credentials","type":"string","name":"grant_type"},{"_id":"5729f771fcecb90e00b0a9c6","ref":"","in":"body","required":true,"desc":"The client_id that is provided to you.","default":"","type":"string","name":"client_id"},{"_id":"5729fe10fcecb90e00b0a9e3","ref":"","in":"body","required":true,"desc":"The client_secret that is provided to you.","default":"","type":"string","name":"client_secret"}],"results":{"codes":[{"code":"{\n  \"access_token\": \"y70kak2K0Rg7J4PAL8sdW0MutnGJEl\",\n  \"token_type\": \"Bearer\",\n  \"expires_in\": 36000,\n  \"scope\": \"read write\"\n}","language":"json","status":200,"name":""},{"name":"","code":"{\n  \"error\": \"unsupported_grant_type\"\n}","language":"json","status":400},{"status":401,"language":"json","code":"{\n  \"error\": \"invalid_client\"\n}"}]},"settings":"5729f56e7f34182900ce9d55","url":"/oauth2/token/"},"excerpt":"","next":{"pages":[],"description":""},"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

postApplication Based Authentication


Body Params

grant_type:
required
stringclient_credentials
This describes the type of authentication.
client_id:
required
string
The client_id that is provided to you.
client_secret:
required
string
The client_secret that is provided to you.

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":"57309f6d19c1e00e006d2070","excerpt":"","link_url":"","sync_unique":"","title":"User Based Authentication","updates":["579eefa0bf088a0e00b8cfbf"],"body":"","editedParams2":true,"user":"56a1c959842b650d0088899c","type":"post","githubsync":"","link_external":false,"order":1,"category":"5729f40a7f34182900ce9d52","hidden":false,"version":"571749c2d2a6510e00840a82","editedParams":true,"isReference":true,"parentDoc":null,"project":"56a1c9c13845200d0066d6fe","slug":"user-based-authentication","__v":3,"api":{"method":"post","params":[{"_id":"5729f771fcecb90e00b0a9c7","ref":"","in":"body","required":true,"desc":"This describes the type of authentication","default":"password","type":"string","name":"grant_type"},{"_id":"5729f771fcecb90e00b0a9c6","ref":"","in":"body","required":true,"desc":"The client_id that is provided to you.","default":"","type":"string","name":"client_id"},{"_id":"5729fe10fcecb90e00b0a9e3","ref":"","in":"body","required":true,"desc":"The client_secret that is provided to you.","default":"","type":"string","name":"client_secret"},{"_id":"57309f96b16ed73200ddd191","ref":"","in":"body","required":true,"desc":"Email or Username of the user.","default":"","type":"string","name":"username"},{"_id":"57309f96b16ed73200ddd190","ref":"","in":"body","required":true,"desc":"Password of the user.","default":"","type":"string","name":"password"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n  \"access_token\": \"zsUhiZ9aiV1nG9nLRFPSXPS3smDREX\",\n  \"token_type\": \"Bearer\",\n  \"expires_in\": 36000,\n  \"refresh_token\": \"oPorohVcpY5n7v7cS8biUKQZcvV5fT\",\n  \"scope\": \"read write\"\n}","name":""},{"language":"json","code":"{\n  \"error\": \"unsupported_grant_type\"\n}","name":"","status":400},{"code":"{\n  \"error_description\": \"Invalid credentials given.\",\n  \"error\": \"invalid_grant\"\n}","language":"json","status":401}]},"settings":"5729f56e7f34182900ce9d55","url":"/oauth2/token/","auth":"never","examples":{"codes":[{"language":"php","code":"<?php\n\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, 'https://api.instamojo.com/oauth2/token/');     \ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\n\n$payload = Array(\n    'grant_type' => 'password',\n    'client_id' => '21fe14a60057ece6c76496175cb0238a2ffd87be',\n    'client_secret' => '-KWPoDO!_l?MZQ-DsZeQ0TXXcvuDn;mxmAtGho8Xijn=iH6F',\n    'username' => '[email protected]',\n    'password' => 'bar'\n  );\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":"python","code":"import requests\nrequests.post('https://api.instamojo.com/oauth2/token/', data={\n    \t'grant_type': 'password',\n  \t\t'client_id': '21fe14a60057ece6c76496175cb0238a2ffd87be',\n    \t'client_secret': '-KWPoDO!_l?MZQ-DsZeQ0TXXcvuDn;mxmAtGho8Xijn=iH6F',\n      'username': '[email protected]',\n      'password': 'bar',\n})\n              "},{"language":"curl","code":"curl https://api.instamojo.com/oauth2/token/ \\\n  --data \n\"grant_type=client_credentials&client_id=21fe14a60057ece6c76496175cb0238a2ffd87be&client_secret=-KWPoDO!_l?MZQ-DsZeQ0TXXcvuDn;mxmAtGho8Xijn=iH6F&[email protected]&password=bar\""}]}},"createdAt":"2016-05-09T14:32:13.236Z","metadata":{"title":"","description":"","image":[]},"next":{"description":"","pages":[]},"childrenPages":[]}

postUser Based Authentication


Body Params

grant_type:
required
stringpassword
This describes the type of authentication
client_id:
required
string
The client_id that is provided to you.
client_secret:
required
string
The client_secret that is provided to you.
username:
required
string
Email or Username of the user.
password:
required
string
Password of the user.

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":"5730a09864726a2000043188","editedParams":true,"excerpt":"","next":{"description":"","pages":[]},"type":"post","updates":[],"user":"56a1c959842b650d0088899c","sync_unique":"","__v":2,"createdAt":"2016-05-09T14:37:12.755Z","editedParams2":true,"hidden":false,"isReference":true,"parentDoc":null,"body":"","githubsync":"","project":"56a1c9c13845200d0066d6fe","title":"Refresh Token Based Authentication","version":"571749c2d2a6510e00840a82","slug":"refresh-token-based-authentication","api":{"examples":{"codes":[{"language":"php","code":"<?php\n\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, 'https://api.instamojo.com/oauth2/token/');     \ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\n\n$payload = Array(\n    'grant_type' => 'refresh_token',\n    'client_id' => '21fe14a60057ece6c76496175cb0238a2ffd87be',\n    'client_secret' => '-KWPoDO!_l?MZQ-DsZeQ0TXXcvuDn;mxmAtGho8Xijn=iH6F',\n    'refresh_token' => 'oPorohVcpY5n7v7cS8biUKQZcvV5fT'\n  );\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":"python","code":"import requests\nrequests.post('https://api.instamojo.com/oauth2/token/', data={\n    \t'grant_type': 'refresh_token',\n  \t\t'client_id': '21fe14a60057ece6c76496175cb0238a2ffd87be',\n    \t'client_secret': '-KWPoDO!_l?MZQ-DsZeQ0TXXcvuDn;mxmAtGho8Xijn=iH6F',\n      'refresh_token': 'oPorohVcpY5n7v7cS8biUKQZcvV5fT',\n})\n              "},{"language":"curl","code":"curl https://api.instamojo.com/oauth2/token/ \\\n  --data \n\"grant_type=client_credentials&client_id=21fe14a60057ece6c76496175cb0238a2ffd87be&client_secret=-KWPoDO!_l?MZQ-DsZeQ0TXXcvuDn;mxmAtGho8Xijn=iH6F&refresh_token=oPorohVcpY5n7v7cS8biUKQZcvV5fT\""}]},"method":"post","params":[{"_id":"5729f771fcecb90e00b0a9c7","ref":"","in":"body","required":true,"desc":"This describes the type of authentication.","default":"refresh_token","type":"string","name":"grant_type"},{"_id":"5729f771fcecb90e00b0a9c6","ref":"","in":"body","required":true,"desc":"The client_id that is provided to you.","default":"","type":"string","name":"client_id"},{"_id":"5729fe10fcecb90e00b0a9e3","ref":"","in":"body","required":true,"desc":"The client_secret that is provided to you.","default":"","type":"string","name":"client_secret"},{"_id":"5730a09864726a2000043189","ref":"","in":"body","required":true,"desc":"The refresh_token obtained from User Based Authentication.","default":"","type":"string","name":"refresh_token"}],"results":{"codes":[{"code":"{\n  \"access_token\": \"9692b5d5279143058062e0ea6547ee\",\n  \"token_type\": \"Bearer\",\n  \"expires_in\": 36000,\n  \"refresh_token\": \"6bf39817411b4102bff65ab85ef5ea\",\n  \"scope\": \"read write\"\n}","name":"","status":200,"language":"json"},{"name":"","status":400,"language":"json","code":"{\n  \"error\": \"unsupported_grant_type\"\n}"},{"language":"json","status":401,"code":"{\n  \"error\": \"invalid_grant\"\n}"}]},"settings":"5729f56e7f34182900ce9d55","url":"/oauth2/token/","auth":"never"},"category":"5729f40a7f34182900ce9d52","link_external":false,"link_url":"","order":2,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

postRefresh Token Based Authentication


Body Params

grant_type:
required
stringrefresh_token
This describes the type of authentication.
client_id:
required
string
The client_id that is provided to you.
client_secret:
required
string
The client_secret that is provided to you.
refresh_token:
required
string
The refresh_token obtained from User Based Authentication.

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":"5730a1e826bd5a3600d3379f","createdAt":"2016-05-09T14:42:48.103Z","editedParams":true,"type":"post","user":"56a1c959842b650d0088899c","hidden":false,"parentDoc":null,"body":"","editedParams2":true,"githubsync":"","slug":"signup","updates":["58bb805920e8822300b0194a"],"api":{"params":[{"_id":"5730a7346b55e93400b329ea","ref":"","in":"body","required":true,"desc":"Email id for the account.","default":"","type":"string","name":"email"},{"_id":"5730a22864726a200004318d","ref":"","in":"body","required":true,"desc":"The password for the account.","default":"","type":"string","name":"password"},{"_id":"5730a7346b55e93400b329e9","ref":"","in":"body","required":true,"desc":"Phone number for the account","default":"","type":"string","name":"phone"},{"_id":"5730a7346b55e93400b329e8","ref":"","in":"body","required":true,"desc":"The referrer provided to you.","default":"","type":"string","name":"referrer"}],"results":{"codes":[{"code":"{\n  \"id\": \"90f01dfdacbe4fe7892fc27dbdc30906\",\n  \"username\": \"foo\",\n  \"email\": \"[email protected]\",\n  \"phone\": \"+919988776655\",\n  \"resource_uri\": \"https://api.instamojo.com/v2/users/90f01dfdacbe4fe7892fc27dbdc30906/\",\n  \"promo_code\": null\n}","name":"","status":200,"language":"json"},{"status":400,"language":"json","code":"{\n  \"username\": [\n    \"Username is not available.\"\n  ],\n  \"email\": [\n    \"Email already exists.\"\n  ]\n}","name":""},{"code":"{\n  \"success\": false,\n  \"message\": \"Authentication credentials were not provided.\"\n}","language":"json","status":401}]},"settings":"5729f56e7f34182900ce9d55","url":"/v2/users/","auth":"required","examples":{"codes":[{"language":"php","code":"<?php\n\n$ch = curl_init();\n\ncurl_setopt($ch, CURLOPT_URL, 'https://api.instamojo.com/v2/users/');\ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\ncurl_setopt($ch, CURLOPT_HTTPHEADER,array('Authorization: Bearer y70kak2K0Rg7J4PAL8sdW0MutnGJEl'));\n\n$payload = Array(\n    'email' => '[email protected]',\n    'password' => 'bar',\n    'phone' => '919988776655',\n    'referrer' => 'value-provided-to-you-by-instamojo'\n);\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\n?>"},{"language":"python","code":"import requests\nrequests.post(\n  'https://api.instamojo.com/v2/users/', \n  data={\n      'email': '[email protected]',\n      'password': 'bar',\n      'phone': '+919988776655',\n      'referrer': 'value-provided-to-you-by-instamojo',\n  },\n  headers={\n \t\t\t'Authorization': 'Bearer y70kak2K0Rg7J4PAL8sdW0MutnGJEl' \n  }\n)\n              "},{"language":"curl","code":"curl https://api.instamojo.com/v2/users/ \\\n  --header \"Authorization: Bearer y70kak2K0Rg7J4PAL8sdW0MutnGJEl\" \\\n  --data \"[email protected]&password=bar&phone=+919988776655&referrer=value-provided-to-you-by-instamojo\""}]},"method":"post"},"excerpt":"This will create an account on Instamojo. You need to use a token that is obtained using the Application Based Authentication.","link_external":false,"project":"56a1c9c13845200d0066d6fe","order":3,"sync_unique":"","title":"Signup","version":"571749c2d2a6510e00840a82","__v":6,"category":"5729f40a7f34182900ce9d52","isReference":true,"link_url":"","metadata":{"title":"","description":"","image":[]},"next":{"description":"","pages":[]},"childrenPages":[]}

postSignup

This will create an account on Instamojo. You need to use a token that is obtained using the Application Based Authentication.

Body Params

email:
required
string
Email id for the account.
password:
required
string
The password for the account.
phone:
required
string
Phone number for the account
referrer:
required
string
The referrer provided to you.

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":"5730aa7bb16ed73200ddd1bc","type":"patch","user":"56a1c959842b650d0088899c","__v":4,"excerpt":"This will updated the details of an account on Instamojo. You need to use a token that is obtained using the User Based Authentication.","githubsync":"","order":4,"project":"56a1c9c13845200d0066d6fe","sync_unique":"","version":"571749c2d2a6510e00840a82","link_external":false,"parentDoc":null,"slug":"update-details-of-a-user","title":"Update details of a user","updates":[],"link_url":"","api":{"method":"patch","params":[{"_id":"5730a1e826bd5a3600d337a0","ref":"","in":"body","required":false,"desc":"First name of the account.","default":"","type":"string","name":"first_name"},{"_id":"5730a22864726a200004318d","ref":"","in":"body","required":false,"desc":"Last name of the account.","default":"","type":"string","name":"last_name"},{"_id":"5730a7346b55e93400b329ea","ref":"","in":"body","required":false,"desc":"Location of the user.","default":"","type":"string","name":"location"},{"_id":"5730af1219c1e00e006d209f","ref":"","in":"body","required":false,"desc":"Phone number of the user.","default":"","type":"string","name":"phone"},{"_id":"58007494456c950f000e57f6","ref":"","in":"path","required":false,"desc":"","default":"","type":"string","name":"id"}],"results":{"codes":[{"name":"","code":"{\n  \"id\": \"90f01dfdacbe4fe7892fc27dbdc30906\",\n  \"username\": \"foo\",\n  \"first_name\": \"Foo\",\n  \"last_name\": \"Bar\",\n  \"phone\": \"+919988776655\",\n  \"email\": \"[email protected]\",\n  \"date_joined\": \"2016-05-09T15:08:29.060Z\",\n  \"is_email_verified\": false,\n  \"is_phone_verified\": false,\n  \"bio\": \"\",\n  \"location\": \"India\",\n  \"public_phone\": null,\n  \"public_email\": null,\n  \"public_website\": null,\n  \"avatar_image_url\": null,\n  \"profile_image_url\": null,\n  \"tags\": [],\n  \"resource_uri\": \"https://api.instamojo.com/v2/users/90f01dfdacbe4fe7892fc27dbdc30906/\"\n}","language":"json","status":200},{"name":"","code":"{\n  \"phone\": [\n    \"Enter a valid phone number\"\n  ]\n}","language":"json","status":400},{"status":401,"language":"json","code":"{\n  \"success\": false,\n  \"message\": \"Authentication credentials were not provided.\"\n}"},{"code":"{\n  \"success\": false,\n  \"message\": \"Not found\"\n}","language":"json","status":404}]},"settings":"5729f56e7f34182900ce9d55","url":"/v2/users/:id/","auth":"required","examples":{"codes":[{"language":"php","code":"<?php\n\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, 'https://api.instamojo.com/v2/users/90f01dfdacbe4fe7892fc27dbdc30906/');\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\ncurl_setopt($ch, CURLOPT_HTTPHEADER,array('Authorization: Bearer n9kmKzF0DzbP5jIKZk8gJO0mOr4W0t'));\n\n$payload = Array(\n    'first_name' => 'Foo',\n    'last_name' => 'Bar',\n    'location' => 'India',\n    'phone' => '+919988776655'\n);\n\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $payload);\n$response = curl_exec($ch);\ncurl_close($ch);\n\n?>"},{"language":"python","code":"import requests\nrequests.patch(\n  'https://api.instamojo.com/v2/users/90f01dfdacbe4fe7892fc27dbdc30906/', \n  data={\n    \t'first_name': 'Foo',\n      'last_name': 'Bar',\n      'location': 'India'\n    \t'phone': '+919988776655'\n  },\n  headers={\n \t\t\t'Authorization': 'Bearer n9kmKzF0DzbP5jIKZk8gJO0mOr4W0t' \n  }\n)\n              "}]}},"body":"","category":"5729f40a7f34182900ce9d52","createdAt":"2016-05-09T15:19:23.549Z","editedParams":true,"editedParams2":true,"hidden":false,"isReference":true,"metadata":{"title":"","description":"","image":[]},"next":{"description":"","pages":[]},"childrenPages":[]}

patchUpdate details of a user

This will updated the details of an account on Instamojo. You need to use a token that is obtained using the User Based Authentication.

Path Params

id:
string

Body Params

first_name:
string
First name of the account.
last_name:
string
Last name of the account.
location:
string
Location of the user.
phone:
string
Phone number of the user.

User Information

Try It Out

patch
{{ 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":"5730afd16b55e93400b32a00","link_external":false,"order":5,"parentDoc":null,"slug":"update-bank-details-of-a-user","title":"Update bank details of a user","user":"56a1c959842b650d0088899c","body":"","editedParams":true,"hidden":false,"link_url":"","project":"56a1c9c13845200d0066d6fe","sync_unique":"","type":"put","version":"571749c2d2a6510e00840a82","api":{"auth":"required","examples":{"codes":[{"language":"php","code":"<?php\n\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, 'https://api.instamojo.com/v2/users/90f01dfdacbe4fe7892fc27dbdc30906/inrbankaccount/');\ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"PUT\");\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\ncurl_setopt($ch, CURLOPT_HTTPHEADER,array('Authorization: Bearer n9kmKzF0DzbP5jIKZk8gJO0mOr4W0t'));\n\n$payload = Array(\n    'account_holder_name' => 'Foo Bar',\n    'account_number' => '123456789',\n    'ifsc_code' => 'SBIN0000111'\n);\n\ncurl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($payload));\n$response = curl_exec($ch);\ncurl_close($ch); \n\n?>"},{"language":"python","code":"import requests\nrequests.put(\n  'https://api.instamojo.com/v2/users/90f01dfdacbe4fe7892fc27dbdc30906/inrbankaccount/', \n  data={\n    \t'account_holder_name': 'Foo Bar',\n      'account_number': '123456789',\n      'ifsc_code': 'SBIN0000111'\n  },\n  headers={\n \t\t\t'Authorization': 'Bearer n9kmKzF0DzbP5jIKZk8gJO0mOr4W0t' \n  }\n)\n              "}]},"method":"put","params":[{"_id":"5730a1e826bd5a3600d337a0","ref":"","in":"body","required":true,"desc":"Name of account holder.","default":"","type":"string","name":"account_holder_name"},{"_id":"5730a22864726a200004318d","ref":"","in":"body","required":true,"desc":"Bank account number.","default":"","type":"string","name":"account_number"},{"_id":"5730a7346b55e93400b329ea","ref":"","in":"body","required":true,"desc":"IFSC code of the branch.","default":"","type":"string","name":"ifsc_code"},{"_id":"58007520704ea60f0044acda","ref":"","in":"path","required":false,"desc":"","default":"","type":"string","name":"id"}],"results":{"codes":[{"name":"","code":"{\n  \"user\": \"https://api.instamojo.com/v2/users/90f01dfdacbe4fe7892fc27dbdc30906/\",\n  \"account_holder_name\": \"Foo Bar\",\n  \"bank_name\": \"\",\n  \"account_number\": \"123456789\",\n  \"ifsc_code\": \"SBIN0000111\",\n  \"updated_at\": \"2016-05-09T15:40:50.715Z\"\n}","language":"json","status":200},{"name":"","code":"{\n  \"ifsc_code\": [\n    \"This field is required.\"\n  ],\n  \"account_holder_name\": [\n    \"This field is required.\"\n  ],\n  \"account_number\": [\n    \"This field is required.\"\n  ]\n}","language":"json","status":400},{"status":401,"language":"json","code":"{\n  \"success\": false,\n  \"message\": \"Authentication credentials were not provided.\"\n}"},{"code":"{\n  \"success\": false,\n  \"message\": \"Not found\"\n}","language":"json","status":404}]},"settings":"5729f56e7f34182900ce9d55","url":"/v2/users/:id/inrbankaccount/"},"excerpt":"This will update the bank account details of an account on Instamojo. You need to use a token that is obtained using the User Based Authentication.","createdAt":"2016-05-09T15:42:09.464Z","updates":["5dd95c47166d7f003616e04a"],"__v":3,"githubsync":"","isReference":true,"category":"5729f40a7f34182900ce9d52","editedParams2":true,"metadata":{"title":"","description":"","image":[]},"next":{"pages":[],"description":""},"childrenPages":[]}

putUpdate bank details of a user

This will update the bank account details of an account on Instamojo. You need to use a token that is obtained using the User Based Authentication.

Path Params

id:
string

Body Params

account_holder_name:
required
string
Name of account holder.
account_number:
required
string
Bank account number.
ifsc_code:
required
string
IFSC code of the branch.

User Information

Try It Out

put
{{ 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":"5730b6f626bd5a3600d337dd","order":6,"title":"Create a Payment Request","type":"post","link_external":false,"isReference":true,"next":{"description":"","pages":[]},"project":"56a1c9c13845200d0066d6fe","sync_unique":"","parentDoc":null,"slug":"create-a-payment-request","updates":[],"user":"56a1c959842b650d0088899c","version":"571749c2d2a6510e00840a82","editedParams2":true,"api":{"auth":"required","examples":{"codes":[{"language":"php","code":"<?php\n\n$ch = curl_init();\n\ncurl_setopt($ch, CURLOPT_URL, 'https://api.instamojo.com/v2/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,array('Authorization: Bearer n9kmKzFODibP5jIKVk8gJO0NOr4W0t'));\n\n$payload = Array(\n  'purpose' => 'FIFA 16',\n  'amount' => '2500',\n  'buyer_name' => 'John Doe',\n  'email' => '[email protected]',\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}\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\n?>"},{"language":"python","code":"import requests\n\nheaders = { \n\t\"Authorization\": \"Bearer n9kmKzFODibP5jIKVk8gJO0NOr4W0t\"\n}\npayload = {\n  'purpose': 'FIFA 16',\n  'amount': '2500',\n  'buyer_name': 'John Doe',\n  'email': '[email protected]',\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(\n  \"https://api.instamojo.com/v2/payment_requests/\", \n  data=payload, \n  headers=headers\n)              "}]},"method":"post","params":[{"_id":"5730b6f626bd5a3600d337e8","ref":"","in":"body","required":true,"desc":"The amount for the request. The minimum amount is 9. And the maximum is 200000.","default":"","type":"double","name":"amount"},{"_id":"5730b6f626bd5a3600d337e7","ref":"","in":"body","required":true,"desc":"Purpose of the payment request.","default":"","type":"string","name":"purpose"},{"_id":"5730b6f626bd5a3600d337e6","ref":"","in":"body","required":false,"desc":"Name of payer","default":"","type":"string","name":"buyer_name"},{"_id":"5730b6f626bd5a3600d337e5","ref":"","in":"body","required":false,"desc":"Email of payer","default":"","type":"string","name":"email"},{"_id":"5730b6f626bd5a3600d337e4","ref":"","in":"body","required":false,"desc":"Phone number of payer","default":"","type":"string","name":"phone"},{"_id":"5730b6f626bd5a3600d337e3","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. Three additional query arguments `payment_request_id`, `payment_status` and `payment_id` are also sent with the redirect URL.","default":"","type":"string","name":"redirect_url"},{"_id":"5730b6f626bd5a3600d337e2","ref":"","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":"5730b6f626bd5a3600d337e1","ref":"","in":"body","required":false,"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":"5730b6f626bd5a3600d337e0","ref":"","in":"body","required":false,"desc":"Allows you to receive a cut from from payments you facilitate. For fixed fee set this to `fixed`, or for percentage fee set it to `percent`.","default":"","type":"string","name":"partner_fee_type"},{"_id":"573b18576b49be2200c2e1e7","ref":"","in":"body","required":false,"desc":"This describes the fee that you would collect. It can be either a fixed amount, or a percentage of the original amount, depending on the value of `partner_fee_type`.","default":"","type":"double","name":"partner_fee"},{"_id":"5730b6f626bd5a3600d337df","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","name":"send_email"},{"_id":"5730b6f626bd5a3600d337de","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":"57c4259887a1060e00e36cd0","ref":"","in":"body","required":false,"desc":"Flag to determine if you want to put the payment on hold until you explicitly fulfil it. If `mark_fulfilled` is `True` the payment will be paid out to the merchant. If `mark_fulfilled` is `False`, then the payment will be put on hold until you explicitly fulfil the payment. See Fulfil a Payment below on how to fulfil a payment.","default":"True","type":"boolean","name":"mark_fulfilled"},{"_id":"58fdf14fc1e51e19004127ca","ref":"","in":"body","required":false,"desc":"Time after which the payment request will be expired in UTC timestamp. Max value is 600 seconds. Default is Null","default":"","type":"datetime","name":"expires_at"}],"results":{"codes":[{"name":"","code":"{\n  \"id\": \"05f317448ad84649aa1a9c7328edb015\",\n  \"user\": \"https://api.instamojo.com/v2/users/90f01dfdacbe4fe7892fc27dbdc30906/\",\n  \"phone\": \"+919999999999\",\n  \"email\": \"[email protected]\",\n  \"buyer_name\": \"John Doe\",\n  \"amount\": \"2500\",\n  \"purpose\": \"FIFA 16\",\n  \"status\": \"Pending\",\n  \"payments\": [],\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/@foo/05f317448ad84649aa1a9c7328edb015\",\n  \"redirect_url\": \"http://www.example.com/redirect/\",\n  \"webhook\": \"http://www.example.com/webhook/\",\n  \"created_at\": \"2016-05-09T16:10:13.786Z\",\n  \"modified_at\": \"2016-05-09T16:10:13.786Z\",\n  \"resource_uri\": \"https://api.instamojo.com/v2/payment_requests/05f317448ad84649aa1a9c7328edb015/\",\n  \"allow_repeated_payments\": false,\n  \"mark_fulfilled\": true\n}","language":"json","status":200},{"name":"","code":"{\n  \"purpose\": [\n    \"This field is required.\"\n  ],\n  \"amount\": [\n    \"This field is required.\"\n  ]\n}","language":"json","status":400},{"code":"{\n  \"success\": false,\n  \"message\": \"Authentication credentials were not provided.\"\n}","status":401,"language":"json"}]},"settings":"5729f56e7f34182900ce9d55","url":"/v2/payment_requests/"},"body":"","category":"5729f40a7f34182900ce9d52","createdAt":"2016-05-09T16:12:38.478Z","editedParams":true,"excerpt":"This will create a payment request on Instamojo. You need to use a token that is obtained using the User Based Authentication.","githubsync":"","__v":6,"link_url":"","hidden":false,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

postCreate a Payment Request

This will create a payment request on Instamojo. You need to use a token that is obtained using the User Based Authentication.

Body Params

amount:
required
double
The amount for the request. The minimum amount is 9. And the maximum is 200000.
purpose:
required
string
Purpose of the payment request.
buyer_name:
string
Name of payer
email:
string
Email of payer
phone:
string
Phone number of payer
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. Three additional query arguments `payment_request_id`, `payment_status` and `payment_id` are also sent with the redirect URL.
webhook:
string
URL where our server do POST request after a payment If provided, we will do a the POST request to the webhook (url) with full details of the payment
allow_repeated_payments:
booleanTrue
If `allow_repeated_payments` is `false`, only one payment can be paid on a payment request link. `allow_repeated_payments` is `true` by default.
partner_fee_type:
string
Allows you to receive a cut from from payments you facilitate. For fixed fee set this to `fixed`, or for percentage fee set it to `percent`.
partner_fee:
double
This describes the fee that you would collect. It can be either a fixed amount, or a percentage of the original amount, depending on the value of `partner_fee_type`.
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.
mark_fulfilled:
booleanTrue
Flag to determine if you want to put the payment on hold until you explicitly fulfil it. If `mark_fulfilled` is `True` the payment will be paid out to the merchant. If `mark_fulfilled` is `False`, then the payment will be put on hold until you explicitly fulfil the payment. See Fulfil a Payment below on how to fulfil a payment.
expires_at:
datetime
Time after which the payment request will be expired in UTC timestamp. Max value is 600 seconds. Default is Null

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":"5730b7c019c1e00e006d20b2","api":{"method":"get","params":[{"_id":"5800752e039bda2300152195","ref":"","in":"path","required":false,"desc":"","default":"","type":"string","name":"id"}],"results":{"codes":[{"name":"","code":"{\n  \"id\": \"05f317448ad84649aa1a9c7328edb015\",\n  \"user\": \"https://api.instamojo.com/v2/users/90f01dfdacbe4fe7892fc27dbdc30906/\",\n  \"phone\": \"+919999999999\",\n  \"email\": \"[email protected]\",\n  \"buyer_name\": \"John Doe\",\n  \"amount\": \"2500\",\n  \"purpose\": \"FIFA 16\",\n  \"status\": \"Pending\",\n  \"payments\": [],\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/@foo/05f317448ad84649aa1a9c7328edb015\",\n  \"redirect_url\": \"http://www.example.com/redirect/\",\n  \"webhook\": \"http://www.example.com/webhook/\",\n  \"created_at\": \"2016-05-09T16:10:13.786Z\",\n  \"modified_at\": \"2016-05-09T16:10:13.786Z\",\n  \"resource_uri\": \"https://api.instamojo.com/v2/payment_requests/05f317448ad84649aa1a9c7328edb015/\",\n  \"allow_repeated_payments\": false,\n  \"mark_fulfilled\": true\n}","language":"json","status":200},{"status":401,"language":"json","code":"{\n  \"success\": false,\n  \"message\": \"Authentication credentials were not provided.\"\n}"}]},"settings":"5729f56e7f34182900ce9d55","url":"/v2/payment_requests/:id/","auth":"required","examples":{"codes":[{"language":"php","code":"<?php\n\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, 'https://api.instamojo.com/v2/payment_requests/9ef9b530ff8e440dbbc29f2157bc69ad/');\ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\n\ncurl_setopt($ch, CURLOPT_HTTPHEADER,array('Authorization: Bearer n9kmKzFODibP5jIKVk8gJO0NOr4W0t'));\n\n$response = curl_exec($ch);\ncurl_close($ch); \n\n?>"},{"language":"python","code":"import requests\n\nheaders = { \n\t\"Authorization\": \"Bearer n9kmKzFODibP5jIKVk8gJO0NOr4W0t\"\n}\n\nresponse = requests.get(\n  \"https://api.instamojo.com/v2/payment_requests/9ef9b530ff8e440dbbc29f2157bc69ad/\", \n  headers=headers\n)              "}]}},"githubsync":"","isReference":true,"order":7,"project":"56a1c9c13845200d0066d6fe","sync_unique":"","body":"","link_external":false,"parentDoc":null,"type":"get","user":"56a1c959842b650d0088899c","category":"5729f40a7f34182900ce9d52","excerpt":"This will fetch the details of a payment request on Instamojo. You need to use a token that is obtained using the User Based Authentication.","link_url":"","slug":"get-a-payment-request","updates":[],"version":"571749c2d2a6510e00840a82","__v":7,"createdAt":"2016-05-09T16:16:00.073Z","hidden":false,"next":{"description":"","pages":[]},"title":"Get a Payment Request","metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

getGet a Payment Request

This will fetch the details of a payment request on Instamojo. You need to use a token that is obtained using the User Based Authentication.

Path Params

id:
string

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



{"_id":"5982d50cdb33c5002c74d36c","project":"56a1c9c13845200d0066d6fe","version":"571749c2d2a6510e00840a82","category":"5729f40a7f34182900ce9d52","user":"56a1c959842b650d0088899c","updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-08-03T07:47:24.158Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"language":"php","code":"<?php\n\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, 'https://api.instamojo.com/v2/payments/MOJO7726005A06926769/');\ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\n\ncurl_setopt($ch, CURLOPT_HTTPHEADER,array('Authorization: Bearer n9kmKzFODibP5jIKVk8gJO0NOr4W0t'));\n\n$response = curl_exec($ch);\ncurl_close($ch); \n\n?>"},{"language":"python","code":"import requests\n\nheaders = { \n\t\"Authorization\": \"Bearer n9kmKzFODibP5jIKVk8gJO0NOr4W0t\"\n}\n\nresponse = requests.get(\n  \"https://api.instamojo.com/v2/payments/MOJO7726005A06926769/\", \n  headers=headers\n)"}]},"settings":"5729f56e7f34182900ce9d55","results":{"codes":[{"name":"","code":"{\n    \"id\": \"MOJO7726005A06926769\",\n  \t\"title\": \"Sample payment\",\n\t  \"payment_type\": \"instapay\",\n  \t\"payment_request\": null,\n    \"status\": true,\n\t\t\"link\": null,\n\t\t\"product\": null,\n    \"seller\": \"https://api.instamojo.com/v2/users/5b75694e1c1b498c9ceabed9cd5719cf/\",\n    \"currency\": \"INR\",\n    \"amount\": \"13.90\",\n    \"name\": \"Buyer Name\",\n    \"email\": \"[email protected]\",\n    \"phone\": \"+919595959595\",\n\t\t\"payout\": \"https://api.instamojo.com/v2/payouts/MOJO8425001M94982125/\",\n    \"fees\": \"3.30\",\n    \"total_taxes\": \"0.60\",\n  \t\"cases\": [],\n    \"affiliate_id\": null,\n    \"affiliate_commission\": \"0.00\",\n    \"order_info\": {\n  \t    \"link_slug\": null,\n\t      \"link_title\": null,\n        \"shipping_address\": null,\n        \"shipping_city\": null,\n        \"shipping_state\": null,\n        \"shipping_zip\": null,\n        \"shipping_country\": null,\n        \"quantity\": 1,\n        \"unit_price\": \"10.00\",\n        \"discount_code\": null,\n\t      \"discount_amount_off\": null,\t\n        \"custom_fields\": {},\n        \"variants\": []\n    },\n    \"instrument_type\": \"CARD\",\n\t\t\"billing_instrument\": \"Domestic Regular Credit Card (Visa/Mastercard)\",\n    \n    \"failure\": null,\n    \"created_at\": \"2017-07-26T12:45:23.431453Z\",\n    \"updated_at\": \"2017-07-26T23:31:39.020180Z\",\n\t\t\"tax_invoice_id\": \"038193561/000002\",\n    \"resource_uri\": \"https://api.instamojo.com/v2/payments/MOJO7726005A06926769/\"\n}","language":"json","status":200},{"status":401,"language":"json","code":"{\n  \"success\": false,\n  \"message\": \"Authentication credentials were not provided.\"\n}"}]},"method":"get","auth":"required","params":[{"name":"id","type":"string","default":"","desc":"Payment ID","required":false,"in":"path","ref":"","_id":"5800752e039bda2300152195"}],"url":"/v2/payments/:id/"},"isReference":true,"order":8,"body":"[block:api-header]\n{\n  \"title\": \"Response Fields\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field Name\",\n    \"h-1\": \"Possible Values\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"status\",\n    \"0-1\": \"* true\\n* false\\n* null\",\n    \"0-2\": \"Indicates the status of the payment.\\n\\n* **true** => Successful\\n* **false** => Failed\\n* **null** => Initiated\",\n    \"1-0\": \"instrument_type\",\n    \"1-1\": \"* CARD \\n* EMI\\n* NETBANKING\\n* UPI\\n* WALLET\",\n    \"1-2\": \"Indicates the instrument type used for the payment.\",\n    \"2-0\": \"failure\",\n    \"2-1\": \"* null\\n* Object:\\n  * reason\\n  * message\",\n    \"2-2\": \"Gives the failure reason of why the payment failed. This will have non-null values for failed payments only.\\n\\nreason => Type of failure.\\nmessage => Failure message returned by upstream provider.\",\n    \"3-0\": \"billing_instrument\",\n    \"3-1\": \"* null\\n* Unknown card\\n* Domestic Regular Credit Card (Visa/Mastercard)\\n* Domestic Premium Credit/Charge Card (Amex/Diners)\\n* Domestic Regular Debit Card (Visa/Mastercard)\\n* International Regular Credit Card (Visa/Mastercard)\\n* International Premium Credit/Charge Card (Amex/Diners)\\n* International Regular Debit Card\\n* Domestic Netbanking Category A (HDFC/ICICI)\\n* Domestic Netbanking Category B (Other banks)\\n* Wallet\\n* UPI\\n* Unknown netbanking choice\\n* EMI Payment\\n* Bank Transfer\",\n    \"3-2\": \"Gives the subcategory of the 'instrument_type' that was used to make the Payment.\",\n    \"4-0\": \"payout\",\n    \"4-1\": \"* null\\n* Link: v2 API link of payout object.\",\n    \"4-2\": \"Gives you the Payout details once the Payout has been processed. \\n\\nThe response will be 'null' for the cases where the Payout has not been processed yet.\",\n    \"5-0\": \"payment_request\",\n    \"5-1\": \"* null\\n* Link: v2 API link of payment request object.\",\n    \"5-2\": \"Response will be 'null' if payment is not made against a payment request.\\n\\nIf payment is made against a payment request, response will be the v2 API link of payment request object.\",\n    \"6-0\": \"order_info\",\n    \"6-1\": \"Object\",\n    \"6-2\": \"Gives information about the order for which the payment is made.\"\n  },\n  \"cols\": 3,\n  \"rows\": 7\n}\n[/block]","excerpt":"This will fetch the details of a payment on Instamojo. You need to use a token that is obtained using the User Based Authentication.","slug":"get-payment-details","type":"get","title":"Get Payment Details","__v":6,"parentDoc":null,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

getGet Payment Details

This will fetch the details of a payment on Instamojo. You need to use a token that is obtained using the User Based Authentication.

Path Params

id:
string
Payment ID
[block:api-header] { "title": "Response Fields" } [/block] [block:parameters] { "data": { "h-0": "Field Name", "h-1": "Possible Values", "h-2": "Description", "0-0": "status", "0-1": "* true\n* false\n* null", "0-2": "Indicates the status of the payment.\n\n* **true** => Successful\n* **false** => Failed\n* **null** => Initiated", "1-0": "instrument_type", "1-1": "* CARD \n* EMI\n* NETBANKING\n* UPI\n* WALLET", "1-2": "Indicates the instrument type used for the payment.", "2-0": "failure", "2-1": "* null\n* Object:\n * reason\n * message", "2-2": "Gives the failure reason of why the payment failed. This will have non-null values for failed payments only.\n\nreason => Type of failure.\nmessage => Failure message returned by upstream provider.", "3-0": "billing_instrument", "3-1": "* null\n* Unknown card\n* Domestic Regular Credit Card (Visa/Mastercard)\n* Domestic Premium Credit/Charge Card (Amex/Diners)\n* Domestic Regular Debit Card (Visa/Mastercard)\n* International Regular Credit Card (Visa/Mastercard)\n* International Premium Credit/Charge Card (Amex/Diners)\n* International Regular Debit Card\n* Domestic Netbanking Category A (HDFC/ICICI)\n* Domestic Netbanking Category B (Other banks)\n* Wallet\n* UPI\n* Unknown netbanking choice\n* EMI Payment\n* Bank Transfer", "3-2": "Gives the subcategory of the 'instrument_type' that was used to make the Payment.", "4-0": "payout", "4-1": "* null\n* Link: v2 API link of payout object.", "4-2": "Gives you the Payout details once the Payout has been processed. \n\nThe response will be 'null' for the cases where the Payout has not been processed yet.", "5-0": "payment_request", "5-1": "* null\n* Link: v2 API link of payment request object.", "5-2": "Response will be 'null' if payment is not made against a payment request.\n\nIf payment is made against a payment request, response will be the v2 API link of payment request object.", "6-0": "order_info", "6-1": "Object", "6-2": "Gives information about the order for which the payment is made." }, "cols": 3, "rows": 7 } [/block]

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



[block:api-header] { "title": "Response Fields" } [/block] [block:parameters] { "data": { "h-0": "Field Name", "h-1": "Possible Values", "h-2": "Description", "0-0": "status", "0-1": "* true\n* false\n* null", "0-2": "Indicates the status of the payment.\n\n* **true** => Successful\n* **false** => Failed\n* **null** => Initiated", "1-0": "instrument_type", "1-1": "* CARD \n* EMI\n* NETBANKING\n* UPI\n* WALLET", "1-2": "Indicates the instrument type used for the payment.", "2-0": "failure", "2-1": "* null\n* Object:\n * reason\n * message", "2-2": "Gives the failure reason of why the payment failed. This will have non-null values for failed payments only.\n\nreason => Type of failure.\nmessage => Failure message returned by upstream provider.", "3-0": "billing_instrument", "3-1": "* null\n* Unknown card\n* Domestic Regular Credit Card (Visa/Mastercard)\n* Domestic Premium Credit/Charge Card (Amex/Diners)\n* Domestic Regular Debit Card (Visa/Mastercard)\n* International Regular Credit Card (Visa/Mastercard)\n* International Premium Credit/Charge Card (Amex/Diners)\n* International Regular Debit Card\n* Domestic Netbanking Category A (HDFC/ICICI)\n* Domestic Netbanking Category B (Other banks)\n* Wallet\n* UPI\n* Unknown netbanking choice\n* EMI Payment\n* Bank Transfer", "3-2": "Gives the subcategory of the 'instrument_type' that was used to make the Payment.", "4-0": "payout", "4-1": "* null\n* Link: v2 API link of payout object.", "4-2": "Gives you the Payout details once the Payout has been processed. \n\nThe response will be 'null' for the cases where the Payout has not been processed yet.", "5-0": "payment_request", "5-1": "* null\n* Link: v2 API link of payment request object.", "5-2": "Response will be 'null' if payment is not made against a payment request.\n\nIf payment is made against a payment request, response will be the v2 API link of payment request object.", "6-0": "order_info", "6-1": "Object", "6-2": "Gives information about the order for which the payment is made." }, "cols": 3, "rows": 7 } [/block]
{"_id":"5730b9f7053a062b00cf4647","editedParams":true,"excerpt":"This will refund a payment made on Instamojo. You need to use a token that is obtained using the User Based Authentication.","hidden":false,"link_url":"","order":9,"parentDoc":null,"type":"post","editedParams2":true,"isReference":true,"updates":[],"__v":4,"api":{"settings":"5729f56e7f34182900ce9d55","url":"/v2/payments/:payment_id/refund/","auth":"required","examples":{"codes":[{"language":"php","code":"<?php\n\n$ch = curl_init();\n\ncurl_setopt($ch, CURLOPT_URL, 'https://api.instamojo.com/v2/payments/MOJO5c04000J30502939/refund/');\ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\ncurl_setopt($ch, CURLOPT_HTTPHEADER,array('Authorization: Bearer n9kmKzFODibP5jIKVk8gJO0NOr4W0t'));\n\n$payload = Array(\n    'transaction_id' => 'partial_refund_1',\n    'type' => 'TNR',\n    'body' => 'Need to refund to the buyer.',\n    'refund_amount' => '100'\n);\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\n?>"},{"language":"python","code":"import requests\n\nheaders = { \n\t\"Authorization\": \"Bearer n9kmKzFODibP5jIKVk8gJO0NOr4W0t\"\n}\n\npayload = {\n  'transaction_id': 'partial_refund_1',\n\t'type': 'TNR',\n  'body': 'Need to refund to the buyer.',\n  'refund_amount': '100'\n}\n\nresponse = requests.post(\n  \"https://api.instamojo.com/v2/payments/MOJO5c04000J30502939/refund/\", \n  headers=headers,\n  data=payload\n)              "}]},"method":"post","params":[{"_id":"5730b9f7053a062b00cf464a","ref":"","in":"body","required":true,"desc":"A three letter short-code identifying the reason for this case.","default":"","type":"string","name":"type"},{"_id":"5730b9f7053a062b00cf4649","ref":"","in":"body","required":true,"desc":"Additonal text explaining the refund.","default":"","type":"string","name":"body"},{"_id":"5730b9f7053a062b00cf4648","ref":"","in":"body","required":true,"desc":"This field can be used to specify the refund amount. For instance, you may want to issue a refund for an amount lesser than what was paid.","default":"","type":"string","name":"refund_amount"},{"_id":"58007538456c950f000e57f7","ref":"","in":"path","required":false,"desc":"","default":"","type":"string","name":"payment_id"},{"_id":"5cc182f36ad63801ab22c4ab","ref":"","in":"body","required":true,"desc":"Mandatory parameter in the body from the second case creation onwards for the payment to prevent duplicate case creations due to replay of APIs","default":"required","type":"string","name":"transaction_id"}],"results":{"codes":[{"name":"","code":"{\n    \"refund\": {\n        \"id\": \"C5c0751269\",\n        \"payment_id\": \"MOJO5c04000J30502939\",\n        \"status\": \"Refunded\",\n        \"type\": \"QFL\",\n        \"body\": \"Customer isn't satisfied with the quality\",\n        \"refund_amount\": \"100\",\n        \"total_amount\": \"100.00\",\n        \"created_at\": \"2015-12-07T11:01:37.640Z\"\n    },\n    \"success\": true\n}","language":"json","status":200},{"status":401,"language":"json","code":"{\n  \"success\": false,\n  \"message\": \"Authentication credentials were not provided.\"\n}"}]}},"link_external":false,"project":"56a1c9c13845200d0066d6fe","slug":"create-a-refund","title":"Create a Refund","version":"571749c2d2a6510e00840a82","body":"Valid values for type are:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Type\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"RFD\",\n    \"0-1\": \"Duplicate/delayed payment.\",\n    \"1-1\": \"Product/service no longer available.\",\n    \"2-1\": \"Customer not satisfied.\",\n    \"3-1\": \"Product lost/damaged.\",\n    \"4-1\": \"Digital download issue.\",\n    \"5-1\": \"Event was canceled/changed.\",\n    \"6-1\": \"Problem not described above.\",\n    \"1-0\": \"TNR\",\n    \"2-0\": \"QFL\",\n    \"6-0\": \"PTH\",\n    \"5-0\": \"TAN\",\n    \"4-0\": \"EWN\",\n    \"3-0\": \"QNR\"\n  },\n  \"cols\": 2,\n  \"rows\": 7\n}\n[/block]","category":"5729f40a7f34182900ce9d52","createdAt":"2016-05-09T16:25:27.295Z","githubsync":"","sync_unique":"","user":"56a1c959842b650d0088899c","next":{"description":"","pages":[]},"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

postCreate a Refund

This will refund a payment made on Instamojo. You need to use a token that is obtained using the User Based Authentication.

Path Params

payment_id:
string

Body Params

type:
required
string
A three letter short-code identifying the reason for this case.
body:
required
string
Additonal text explaining the refund.
refund_amount:
required
string
This field can be used to specify the refund amount. For instance, you may want to issue a refund for an amount lesser than what was paid.
transaction_id:
required
stringrequired
Mandatory parameter in the body from the second case creation onwards for the payment to prevent duplicate case creations due to replay of APIs
Valid values for type are: [block:parameters] { "data": { "h-0": "Type", "h-1": "Description", "0-0": "RFD", "0-1": "Duplicate/delayed payment.", "1-1": "Product/service no longer available.", "2-1": "Customer not satisfied.", "3-1": "Product lost/damaged.", "4-1": "Digital download issue.", "5-1": "Event was canceled/changed.", "6-1": "Problem not described above.", "1-0": "TNR", "2-0": "QFL", "6-0": "PTH", "5-0": "TAN", "4-0": "EWN", "3-0": "QNR" }, "cols": 2, "rows": 7 } [/block]

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



Valid values for type are: [block:parameters] { "data": { "h-0": "Type", "h-1": "Description", "0-0": "RFD", "0-1": "Duplicate/delayed payment.", "1-1": "Product/service no longer available.", "2-1": "Customer not satisfied.", "3-1": "Product lost/damaged.", "4-1": "Digital download issue.", "5-1": "Event was canceled/changed.", "6-1": "Problem not described above.", "1-0": "TNR", "2-0": "QFL", "6-0": "PTH", "5-0": "TAN", "4-0": "EWN", "3-0": "QNR" }, "cols": 2, "rows": 7 } [/block]
{"_id":"57c429e519b0bb0e00ee1642","__v":2,"body":"","category":"5729f40a7f34182900ce9d52","title":"Fulfil a Payment","type":"post","version":"571749c2d2a6510e00840a82","updates":[],"githubsync":"","isReference":true,"link_url":"","order":10,"parentDoc":null,"project":"56a1c9c13845200d0066d6fe","api":{"method":"post","params":[{"_id":"58007542704ea60f0044acdb","ref":"","in":"path","required":false,"desc":"","default":"","type":"string","name":"payment_id"}],"results":{"codes":[{"code":"{\n  \"fulfil\": true,\n  \"success\": true\n}","language":"json","status":200,"name":""},{"status":401,"language":"json","code":"{\n  \"success\": false,\n  \"message\": \"Authentication credentials were not provided.\"\n}"}]},"settings":"5729f56e7f34182900ce9d55","url":"/v2/payments/:payment_id/fulfil/","auth":"required","examples":{"codes":[{"language":"php","code":"<?php\n\n$ch = curl_init();\n\ncurl_setopt($ch, CURLOPT_URL, 'https://api.instamojo.com/v2/payments/MOJO5c04000J30502939/fulfil/');\ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\ncurl_setopt($ch, CURLOPT_HTTPHEADER,array('Authorization: Bearer y70kak2K0Rg7J4PAL8sdW0MutnGJEl'));\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\n?>"},{"language":"python","code":"import requests\n\nheaders = { \n\t\"Authorization\": \"Bearer y70kak2K0Rg7J4PAL8sdW0MutnGJEl\"\n}\n\nresponse = requests.post(\n  \"https://api.instamojo.com/v2/payments/MOJO5c04000J30502939/fulfil/\", \n  headers=headers\n)              "}]}},"excerpt":"This will fulfil a payment made on Instamojo. You need to use a token that is obtained using the Application Based Authentication.","hidden":false,"link_external":false,"sync_unique":"","createdAt":"2016-08-29T12:26:13.853Z","slug":"fulfil-a-payment","user":"56a1c959842b650d0088899c","metadata":{"title":"","description":"","image":[]},"next":{"description":"","pages":[]},"childrenPages":[]}

postFulfil a Payment

This will fulfil a payment made on Instamojo. You need to use a token that is obtained using the Application Based Authentication.

Path Params

payment_id:
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":"583803120bd5ea190004b72c","type":"post","user":"56a1c959842b650d0088899c","body":"","githubsync":"","hidden":false,"isReference":true,"link_url":"","next":{"description":"","pages":[]},"version":"571749c2d2a6510e00840a82","__v":1,"excerpt":"This will create a Order on Instamojo. You need to use a token that is obtained using the User Based Authentication.","parentDoc":null,"project":"56a1c9c13845200d0066d6fe","sync_unique":"","slug":"create-an-order-using-payment-request-id","title":"Create an Order using Payment Request ID","updates":[],"api":{"settings":"5729f56e7f34182900ce9d55","url":"/v2/gateway/orders/payment-request/","auth":"required","examples":{"codes":[{"language":"php","code":"<?php\n\n$ch = curl_init();\n\ncurl_setopt($ch, CURLOPT_URL, 'https://api.instamojo.com/v2/gateway/orders/payment-request/');\ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\ncurl_setopt($ch, CURLOPT_HTTPHEADER,array('Authorization: Bearer n9kmKzFODibP5jIKVk8gJO0NOr4W0t'));\n\n$payload = Array(\n    'id' => '9c337d3c5e3242fca818937366b915b4'\n);\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\n?>"},{"language":"python","code":"import requests\n\nheaders = { \n\t\"Authorization\": \"Bearer n9kmKzFODibP5jIKVk8gJO0NOr4W0t\"\n}\npayload = {\n  'id': '9c337d3c5e3242fca818937366b915b4',\n}\nresponse = requests.post(\n  \"https://api.instamojo.com/v2/gateway/orders/payment-request/\", \n  data=payload, \n  headers=headers\n)      "}]},"method":"post","params":[{"_id":"583803120bd5ea190004b72d","ref":"","in":"body","required":false,"desc":"Payment Request ID","default":"","type":"string","name":"id"}],"results":{"codes":[{"name":"","status":200,"language":"json","code":"{\n  \"order_id\": \"3b56d216-74c2-4189-83f3-9c2e93bad1be\",\n  \"name\": \"Vedhavyas\",\n  \"email\": \"[email protected]\",\n  \"phone\": \"+919663445546\",\n  \"amount\": \"100.00\"\n}"},{"status":400,"language":"json","code":"{\n  \"id\": [\n    \"This field is required.\"\n  ]\n}","name":""},{"status":401,"language":"text","code":"{\n  \"success\": false,\n  \"message\": \"Authentication credentials were not provided.\"\n}"}]}},"category":"5729f40a7f34182900ce9d52","createdAt":"2016-11-25T09:23:30.720Z","link_external":false,"order":11,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

postCreate an Order using Payment Request ID

This will create a Order on Instamojo. You need to use a token that is obtained using the User Based Authentication.

Body Params

id:
string
Payment Request ID

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":"590b2d5ed0a41e23001aade5","api":{"url":"/v2/payment_requests/:id/disable/","auth":"required","examples":{"codes":[{"language":"php","code":"<?php\n\n$ch = curl_init();\n\ncurl_setopt($ch, CURLOPT_URL, 'https://api.instamojo.com/v2/payment_requests/6a04501b03964ce4874711566e84fabb/disable/');\ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\ncurl_setopt($ch, CURLOPT_HTTPHEADER,array('Authorization: Bearer fRPB9REdsmD7C2qX9uJolWPhsIu4Tc'));\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\n?>"},{"language":"python","code":"import requests\n\nheaders = { \n\t\"Authorization\": \"Bearer fRPB9REdsmD7C2qX9uJolWPhsIu4Tc\"\n}\nresponse = requests.post(\n \"https://api.instamojo.com/v2/payment_requests/6a04501b03964ce4874711566e84fabb/disable/\", headers=headers\n) "}]},"method":"post","params":[{"_id":"590b2d5ed0a41e23001aade6","ref":"","in":"path","required":true,"desc":"","default":"","type":"string","name":"id"}],"results":{"codes":[{"status":200,"language":"json","code":"{\n    \"success\": true\n}","name":""}]},"settings":"5729f56e7f34182900ce9d55"},"body":"","next":{"pages":[],"description":""},"sync_unique":"","user":"56a1c959842b650d0088899c","category":"5729f40a7f34182900ce9d52","createdAt":"2017-05-04T13:32:14.473Z","hidden":false,"isReference":true,"slug":"disable-a-request","title":"Disable a Request","type":"post","version":"571749c2d2a6510e00840a82","__v":1,"excerpt":"This will disable the payment request on Instamojo. You need to use a token that is obtained using the User Based Authentication.","link_external":false,"link_url":"","order":12,"project":"56a1c9c13845200d0066d6fe","updates":[],"githubsync":"","parentDoc":null,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

postDisable a Request

This will disable the payment request on Instamojo. You need to use a token that is obtained using the User Based Authentication.

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":"590b2e39c0161e1900953776","body":"","excerpt":"This will enable the payment request on Instamojo. You need to use a token that is obtained using the User Based Authentication.","link_external":false,"slug":"enable-a-request","type":"post","__v":1,"hidden":false,"sync_unique":"","api":{"settings":"5729f56e7f34182900ce9d55","url":"/v2/payment_requests/:id/enable/","auth":"required","examples":{"codes":[{"language":"php","code":"<?php\n\n$ch = curl_init();\n\ncurl_setopt($ch, CURLOPT_URL, 'https://api.instamojo.com/v2/payment_requests/6a04501b03964ce4874711566e84fabb/enable/');\ncurl_setopt($ch, CURLOPT_HEADER, FALSE);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);\ncurl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);\ncurl_setopt($ch, CURLOPT_HTTPHEADER,array('Authorization: Bearer fRPB9REdsmD7C2qX9uJolWPhsIu4Tc'));\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\n?>"},{"language":"python","code":"import requests\n\nheaders = { \n\t\"Authorization\": \"Bearer fRPB9REdsmD7C2qX9uJolWPhsIu4Tc\"\n}\nresponse = requests.post(\n \"https://api.instamojo.com/v2/payment_requests/6a04501b03964ce4874711566e84fabb/enable/\", headers=headers\n) "}]},"method":"post","params":[{"_id":"590b2e39c0161e1900953777","ref":"","in":"path","required":true,"desc":"","default":"","type":"string","name":"id"}],"results":{"codes":[{"code":"{\n    \"success\": true\n}","name":"","status":200,"language":"json"}]}},"githubsync":"","order":13,"project":"56a1c9c13845200d0066d6fe","updates":[],"createdAt":"2017-05-04T13:35:53.608Z","isReference":true,"link_url":"","next":{"pages":[],"description":""},"title":"Enable a Request","user":"56a1c959842b650d0088899c","version":"571749c2d2a6510e00840a82","category":"5729f40a7f34182900ce9d52","parentDoc":null,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

postEnable a Request

This will enable the payment request on Instamojo. You need to use a token that is obtained using the User Based Authentication.

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":"589c705f29523b23003ba24b","sync_unique":"","isReference":false,"next":{"pages":[],"description":""},"category":"589c3e328912591b00fd9506","githubsync":"","link_external":false,"parentDoc":null,"title":"Common API Response codes","type":"basic","api":{"settings":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"auth":"required","params":[],"url":""},"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 [[email protected]](mailto:[email protected])\n\n* `502` : There was an error on one of our servers with your request. Please reach out to us via [[email protected]](mailto:[email protected])\n\n* `504` : There was an error on one of our servers with your request. Please reach out to us via [[email protected]](mailto:[email protected])\n\n\nYou can also find a more comprehensive list of HTTP response codes here: http://httpstatuses.com/","updates":[],"createdAt":"2017-02-09T13:36:31.669Z","excerpt":"","hidden":false,"link_url":"","order":0,"project":"56a1c9c13845200d0066d6fe","__v":0,"version":"571749c2d2a6510e00840a82","slug":"common-api-response-codes","user":"56a1c959842b650d0088899c","metadata":{"title":"","description":"","image":[]},"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 [[email protected]](mailto:[email protected]) * `502` : There was an error on one of our servers with your request. Please reach out to us via [[email protected]](mailto:[email protected]) * `504` : There was an error on one of our servers with your request. Please reach out to us via [[email protected]](mailto:[email protected]) 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 [[email protected]](mailto:[email protected]) * `502` : There was an error on one of our servers with your request. Please reach out to us via [[email protected]](mailto:[email protected]) * `504` : There was an error on one of our servers with your request. Please reach out to us via [[email protected]](mailto:[email protected]) You can also find a more comprehensive list of HTTP response codes here: http://httpstatuses.com/
{"_id":"589c4fce0552cc2f00a61cc6","__v":0,"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.","sync_unique":"","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"excerpt":"","githubsync":"","isReference":false,"link_external":false,"link_url":"","next":{"pages":[],"description":""},"parentDoc":null,"slug":"how-can-i-prefill-buyer-details-on-payment-forms","updates":[],"user":"56a1c959842b650d0088899c","version":"571749c2d2a6510e00840a82","category":"589c3e328912591b00fd9506","order":1,"project":"56a1c9c13845200d0066d6fe","title":"How can I prefill buyer details on payment forms?","type":"basic","createdAt":"2017-02-09T11:17:34.229Z","hidden":false,"metadata":{"title":"","description":"","image":[]},"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":"589c51950552cc2f00a61cce","order":2,"project":"56a1c9c13845200d0066d6fe","slug":"can-instamojo-save-the-creditdebit-card-numbers-of-my-customers","sync_unique":"","api":{"results":{"codes":[{"language":"json","code":"{}","name":"","status":200},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"body":"No. Not yet.","isReference":false,"link_url":"","type":"basic","updates":[],"version":"571749c2d2a6510e00840a82","title":"Can Instamojo save the credit/debit card numbers of my customers?","createdAt":"2017-02-09T11:25:09.801Z","githubsync":"","hidden":false,"parentDoc":null,"category":"589c3e328912591b00fd9506","user":"56a1c959842b650d0088899c","__v":0,"excerpt":"","link_external":false,"next":{"pages":[],"description":""},"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

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


No. Not yet.
{"_id":"589c52fe0552cc2f00a61cd5","updates":["5c7d5ee0bd57e9002a7f4386","5d1e1587d37787019103ac90"],"excerpt":"","hidden":false,"slug":"what-is-a-webhook","title":"What is a webhook?","api":{"results":{"codes":[{"code":"{}","name":"","status":200,"language":"json"},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"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 [[email protected]](mailto:[email protected]) 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.","next":{"pages":[],"description":""},"version":"571749c2d2a6510e00840a82","category":"589c3e328912591b00fd9506","isReference":false,"link_external":false,"link_url":"","project":"56a1c9c13845200d0066d6fe","sync_unique":"","type":"basic","user":"56a1c959842b650d0088899c","__v":2,"createdAt":"2017-02-09T11:31:10.579Z","githubsync":"","order":3,"parentDoc":null,"metadata":{"title":"","description":"","image":[]},"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 [[email protected]](mailto:[email protected]) 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 [[email protected]instamojo.com](mailto:[email protected]) 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":"58c24c379609c40f004b4b86","hidden":false,"sync_unique":"","title":"What if the webhook fails?","user":"56a1c959842b650d0088899c","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 [email protected] regarding this.","category":"589c3e328912591b00fd9506","excerpt":"","githubsync":"","link_url":"","order":4,"parentDoc":null,"project":"56a1c9c13845200d0066d6fe","api":{"auth":"required","params":[],"url":"","settings":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]}},"createdAt":"2017-03-10T06:48:23.236Z","isReference":false,"next":{"description":"","pages":[]},"version":"571749c2d2a6510e00840a82","__v":0,"type":"basic","updates":[],"link_external":false,"slug":"what-if-the-webhook-fails","metadata":{"title":"","description":"","image":[]},"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 [email protected] 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 [email protected] regarding this.
{"_id":"589c56880552cc2f00a61ce1","user":"56a1c959842b650d0088899c","version":"571749c2d2a6510e00840a82","api":{"results":{"codes":[{"code":"{}","name":"","status":200,"language":"json"},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"githubsync":"","isReference":false,"title":"What are the values of status of a payment?","next":{"pages":[],"description":""},"order":5,"parentDoc":null,"type":"basic","category":"589c3e328912591b00fd9506","createdAt":"2017-02-09T11:46:16.178Z","hidden":false,"link_url":"","updates":[],"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.","project":"56a1c9c13845200d0066d6fe","sync_unique":"","__v":0,"excerpt":"","link_external":false,"slug":"what-are-the-values-of-status-of-a-payment","metadata":{"title":"","description":"","image":[]},"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":"589c57b28912591b00fd9547","createdAt":"2017-02-09T11:51:14.877Z","githubsync":"","order":6,"title":"What are the values of status of a payment request?","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.","link_url":"","project":"56a1c9c13845200d0066d6fe","slug":"what-are-the-values-of-status-of-a-payment-request","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"category":"589c3e328912591b00fd9506","hidden":false,"link_external":false,"parentDoc":null,"__v":0,"excerpt":"","isReference":false,"next":{"pages":[],"description":""},"sync_unique":"","type":"basic","updates":[],"user":"56a1c959842b650d0088899c","version":"571749c2d2a6510e00840a82","metadata":{"title":"","description":"","image":[]},"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":"589c5a488912591b00fd954c","category":"589c3e328912591b00fd9506","link_external":false,"link_url":"","parentDoc":null,"sync_unique":"","api":{"auth":"required","params":[],"url":"","results":{"codes":[{"language":"json","code":"{}","name":"","status":200},{"status":400,"language":"json","code":"{}","name":""}]},"settings":""},"next":{"pages":[],"description":""},"user":"56a1c959842b650d0088899c","version":"571749c2d2a6510e00840a82","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.","slug":"how-do-i-fetch-the-payment-request-for-a-payment","title":"How do I verify the status of a payment?","updates":[],"__v":0,"createdAt":"2017-02-09T12:02:16.677Z","excerpt":"","hidden":false,"isReference":false,"order":7,"project":"56a1c9c13845200d0066d6fe","type":"basic","metadata":{"title":"","description":"","image":[]},"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":"589c6ad5ccb0c72500327bf0","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/`","category":"589c3e328912591b00fd9506","hidden":false,"link_external":false,"createdAt":"2017-02-09T13:12:53.618Z","githubsync":"","parentDoc":null,"type":"basic","updates":[],"version":"571749c2d2a6510e00840a82","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"link_url":"","slug":"what-is-the-difference-between-the-sandbox-and-production-environment","title":"What is the difference between the sandbox and production environment?","user":"56a1c959842b650d0088899c","__v":0,"excerpt":"","isReference":false,"next":{"pages":[],"description":""},"order":8,"project":"56a1c9c13845200d0066d6fe","sync_unique":"","metadata":{"title":"","description":"","image":[]},"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":"589c6c6eccb0c72500327bf3","version":"571749c2d2a6510e00840a82","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.","isReference":false,"slug":"can-i-make-api-calls-using-ajax","link_external":false,"next":{"pages":[],"description":""},"parentDoc":null,"updates":[],"user":"56a1c959842b650d0088899c","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"githubsync":"","project":"56a1c9c13845200d0066d6fe","title":"Can I make API calls using AJAX?","category":"589c3e328912591b00fd9506","hidden":false,"link_url":"","order":9,"sync_unique":"","type":"basic","__v":0,"createdAt":"2017-02-09T13:19:42.560Z","excerpt":"","metadata":{"title":"","description":"","image":[]},"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":"589c6e420552cc2f00a61d2f","version":"571749c2d2a6510e00840a82","excerpt":"","parentDoc":null,"slug":"can-i-issue-multiple-partial-refunds-for-a-payment","sync_unique":"","title":"Can I issue multiple partial refunds for a payment?","updates":[],"githubsync":"","link_external":false,"link_url":"","next":{"description":"","pages":[]},"project":"56a1c9c13845200d0066d6fe","__v":0,"createdAt":"2017-02-09T13:27:30.355Z","order":10,"type":"basic","user":"56a1c959842b650d0088899c","isReference":false,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"body":"No. This is not supported at the moment. You can only [create one refund](doc:create-a-refund)  per payment.","category":"589c3e328912591b00fd9506","hidden":false,"metadata":{"title":"","description":"","image":[]},"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":"589c6ea40552cc2f00a61d34","createdAt":"2017-02-09T13:29:08.507Z","link_url":"","title":"Can I add custom fields to a payment request?","sync_unique":"","type":"basic","updates":[],"category":"589c3e328912591b00fd9506","hidden":false,"parentDoc":null,"project":"56a1c9c13845200d0066d6fe","user":"56a1c959842b650d0088899c","version":"571749c2d2a6510e00840a82","__v":0,"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.","order":11,"slug":"can-i-add-custom-fields-to-a-payment-request","isReference":false,"link_external":false,"next":{"pages":[],"description":""},"api":{"settings":"","auth":"required","params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"code":"{}","name":"","status":400,"language":"json"}]}},"excerpt":"","githubsync":"","metadata":{"title":"","description":"","image":[]},"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":"589c6f3e8912591b00fd959d","parentDoc":null,"sync_unique":"","__v":0,"createdAt":"2017-02-09T13:31:42.803Z","hidden":false,"isReference":false,"link_external":false,"link_url":"","order":12,"project":"56a1c9c13845200d0066d6fe","slug":"i-get-a-failed-to-connect-to-wwwinstamojocom-port-443-connection-timed-out-error-what-is-wrong","category":"589c3e328912591b00fd9506","githubsync":"","next":{"pages":[],"description":""},"updates":[],"version":"571749c2d2a6510e00840a82","api":{"results":{"codes":[{"code":"{}","name":"","status":200,"language":"json"},{"status":400,"language":"json","code":"{}","name":""}]},"settings":"","auth":"required","params":[],"url":""},"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.","excerpt":"","title":"I get a \"Failed to connect to www.instamojo.com port 443: Connection timed out\" error. What is wrong?","type":"basic","user":"56a1c959842b650d0088899c","metadata":{"title":"","description":"","image":[]},"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":"593fc8e36caab2002d67a5b1","project":"56a1c9c13845200d0066d6fe","version":"571749c2d2a6510e00840a82","category":"593fc8c86f2334000f6b0193","user":"56a1c959842b650d0088899c","updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-06-13T11:13:39.581Z","link_external":false,"link_url":"https://docs.instamojo.com/docs/sdk","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":"Read more about Javascript SDK [here](https://docs.instamojo.com/docs/sdk).","excerpt":"Render Instamojo checkout form and collect payments on your webpage with just the instamojo-payment-url.","slug":"javascript-sdk","type":"basic","title":"Javascript SDK","__v":0,"parentDoc":null,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}

Javascript SDK

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

Read more about Javascript SDK [here](https://docs.instamojo.com/docs/sdk).
Read more about Javascript SDK [here](https://docs.instamojo.com/docs/sdk).