---
agentTools:
  projectIndex: https://docs.instamojo.com/v2-mdp/llms.txt
---

# Create a Payment Request

This will create a payment request, ie, a payment link on Instamojo, for the specific merchant, whose access token is being used.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "API v2",
    "version": "2-mdp"
  },
  "servers": [
    {
      "url": "https://api.instamojo.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "name": "Authorization",
        "in": "header",
        "x-default": "Bearer {{access_token}}"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/v2/payment_requests/": {
      "post": {
        "summary": "Create a Payment Request",
        "description": "This will create a payment request, ie, a payment link on Instamojo, for the specific merchant, whose access token is being used.",
        "operationId": "create-a-payment-request",
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "schema": {
              "type": "string",
              "default": "Bearer <your-token>"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "amount",
                  "purpose"
                ],
                "properties": {
                  "amount": {
                    "type": "number",
                    "description": "The amount for the request. The minimum amount is 9. And the maximum is 200000.",
                    "format": "double"
                  },
                  "purpose": {
                    "type": "string",
                    "description": "Purpose of the payment request."
                  },
                  "buyer_name": {
                    "type": "string",
                    "description": "Name of payer"
                  },
                  "email": {
                    "type": "string",
                    "description": "Email of payer"
                  },
                  "phone": {
                    "type": "string",
                    "description": "Phone number of payer"
                  },
                  "redirect_url": {
                    "type": "string",
                    "description": "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": {
                    "type": "string",
                    "description": "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": {
                    "type": "boolean",
                    "description": "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": false
                  },
                  "send_email": {
                    "type": "boolean",
                    "description": "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
                  },
                  "send_sms": {
                    "type": "boolean",
                    "description": "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
                  },
                  "expires_at": {
                    "type": "string",
                    "description": "Time after which the payment request will be expired in UTC timestamp. Max value is 600 seconds. Default is Null",
                    "format": "date"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"id\": \"05f317448ad84649aa1a9c7328edb015\",\n  \"user\": \"https://api.instamojo.com/v2/users/90f01dfdacbe4fe7892fc27dbdc30906/\",\n  \"phone\": \"+919999999999\",\n  \"email\": \"foo@example.com\",\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}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "example": "05f317448ad84649aa1a9c7328edb015"
                    },
                    "user": {
                      "type": "string",
                      "example": "https://api.instamojo.com/v2/users/90f01dfdacbe4fe7892fc27dbdc30906/"
                    },
                    "phone": {
                      "type": "string",
                      "example": "+919999999999"
                    },
                    "email": {
                      "type": "string",
                      "example": "foo@example.com"
                    },
                    "buyer_name": {
                      "type": "string",
                      "example": "John Doe"
                    },
                    "amount": {
                      "type": "string",
                      "example": "2500"
                    },
                    "purpose": {
                      "type": "string",
                      "example": "FIFA 16"
                    },
                    "status": {
                      "type": "string",
                      "example": "Pending"
                    },
                    "payments": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {}
                      }
                    },
                    "send_sms": {
                      "type": "boolean",
                      "example": true,
                      "default": true
                    },
                    "send_email": {
                      "type": "boolean",
                      "example": true,
                      "default": true
                    },
                    "sms_status": {
                      "type": "string",
                      "example": "Pending"
                    },
                    "email_status": {
                      "type": "string",
                      "example": "Pending"
                    },
                    "shorturl": {},
                    "longurl": {
                      "type": "string",
                      "example": "https://www.instamojo.com/@foo/05f317448ad84649aa1a9c7328edb015"
                    },
                    "redirect_url": {
                      "type": "string",
                      "example": "http://www.example.com/redirect/"
                    },
                    "webhook": {
                      "type": "string",
                      "example": "http://www.example.com/webhook/"
                    },
                    "created_at": {
                      "type": "string",
                      "example": "2016-05-09T16:10:13.786Z"
                    },
                    "modified_at": {
                      "type": "string",
                      "example": "2016-05-09T16:10:13.786Z"
                    },
                    "resource_uri": {
                      "type": "string",
                      "example": "https://api.instamojo.com/v2/payment_requests/05f317448ad84649aa1a9c7328edb015/"
                    },
                    "allow_repeated_payments": {
                      "type": "boolean",
                      "example": false,
                      "default": true
                    },
                    "mark_fulfilled": {
                      "type": "boolean",
                      "example": true,
                      "default": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"purpose\": [\n    \"This field is required.\"\n  ],\n  \"amount\": [\n    \"This field is required.\"\n  ]\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "purpose": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "example": "This field is required."
                      }
                    },
                    "amount": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "example": "This field is required."
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "401",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"success\": false,\n  \"message\": \"Authentication credentials were not provided.\"\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false,
                      "default": true
                    },
                    "message": {
                      "type": "string",
                      "example": "Authentication credentials were not provided."
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "x-readme": {
          "code-samples": [
            {
              "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' => 'foo@example.com',\n  'phone' => '9999999999',\n  'redirect_url' => 'http://www.example.com/redirect/',\n  'send_email' => 'True',\n  'send_sms' => 'True',\n  'webhook' => 'http://www.example.com/webhook/',\n  'allow_repeated_payments' => 'False',\n}\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': 'foo@example.com',\n  'phone': '9999999999',\n  'redirect_url': 'http://www.example.com/redirect/',\n  'send_email': 'True',\n  'send_sms': 'True',\n  'webhook': 'http://www.example.com/webhook/',\n  'allow_repeated_payments': 'False',\n}\nresponse = requests.post(\n  \"https://api.instamojo.com/v2/payment_requests/\", \n  data=payload, \n  headers=headers\n)              "
            }
          ],
          "samples-languages": [
            "php",
            "python"
          ]
        }
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "63053f959807941f67a92cfe:612b689158f86a001154b57a"
}
```