---
page_source: https://juspay.io/in/docs/payv3/web/base-integration/order-create
page_title: Order Create API
---

## API Version: default


## Order Create API



This is a Server-to-Server API that takes order parameters as an input and creates an order in the Juspay system. ## Endpoints:
- Production: https://api.juspay.in/orders

## Request Type: 
POST

## Content-Type: 
application/json

## Authorization:

#### Basic Auth:
Consists of two parts.

* Username: API Key obtained from Juspay dashboard
* Password: Empty string
- Value: <p>Example:- <br> MUQ2QUZEQzhFQTY0OUU5QTIxQzNFNTQwNkFDMEZCOg== </p>
- Tags: Base64 Encoded username:password, Required
## Headers:

#### x-merchantid:
Merchant ID obtained provided by Juspay
- Value: <p>Example:- <br> merchant-id</p>
- Tags: string, Required

#### version:
Pass the date in YYYY-MM-DD format
- Value:  Example:- 2023-01-01
- Tags: String, Mandatory
## Sample Code Snippets:
### Sample Request:

#### Shell Code Snippet:

```shell
curl --location --request POST 'https://api.juspay.in/orders' \
--header 'version: 2018-10-25' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'x-merchantid: merchant_id'\
--header 'Authorization: Basic QTA0QT*******ODg1Og==' \
--data-urlencode 'order_id=14183944763' \
--data-urlencode 'amount=100.00' \
--data-urlencode 'currency=INR' \
--data-urlencode 'customer_id=guest_user_101' \
--data-urlencode 'customer_email=customer@gmail.com' \
--data-urlencode 'customer_phone=9988665522' \
--data-urlencode 'product_id=prod-141833' \
--data-urlencode 'return_url=http://shop.merchant.com/payments/handleResponse' \
--data-urlencode 'description=Sample description' \
--data-urlencode 'options.get_client_auth_token=true' \
```

### Sample Response:

#### Response:
```json
{
  "status": "CREATED",
  "status_id": 1,
  "id": "ord_e294a26e66ad4336a992ceab81ad704c",
  "order_id": "14183944763",
  "payment_links": {
    "web": "https://api.juspay.in/merchant/pay/ord_e294a26e66ad4336a992ceab81ad704c",
    "mobile": "https://api.juspay.in/merchant/pay/ord_e294a26e66ad4336a992ceab81ad704c?mobile=true",
    "iframe": "https://api.juspay.in/merchant/ipay/ord_e294a26e66ad4336a992ceab81ad704c"
  }
}
```

## Body Parameters:
### Basic Parameters:

#### order_id:
- Description: Unique Identifier for the order. Should be Alphanumeric with character length less than 21.
- Value: <p>Example:- <br> order-id-9876580</p>
- Tags: string, required

#### amount:
- Description: Amount that the customer has to pay. Will accept stringified double or integer values with upto two decimal places. For example, "100.15" and "100" are valid input but "100.1532" is not valid.
- Value: <p>Example:- <br> 1.00</p>
- Tags: string, required

#### customer_id:
- Description: String that uniquely identifies the customer. It is the ID with which merchant refers to a customer object.
- Value: <p>Example:- <br>customer-id-007</p>
- Tags: string

#### customer_email:
- Description: Email address of the customer. If the backend gateway requires it, then you must send this value.
- Value: <p>Example:- <br>test@gmail.com</p>
- Tags: string

#### customer_phone:
- Description: Mobile number or fixed line number of the customer. If the backend gateway requires it, then you must send this value.
- Value: <p>Example:- <br>9999999912</p>
- Tags: string

#### return_url:
- Description: A fully qualified URL which the customer will be redirected after payment completion. This URL shouldn't contain any query parameters or Ip address. This URL takes higher precedence over the common return URL configured in your account settings.
- Value: <p>Example:- <br>https://shop.merchant.com</p>
- Tags: string

#### first_name:
- Description: First Name of customer. This value will be used for customer identification.
- Value: <p>Example:- <br>John</p>
- Tags: string

#### last_name:
- Description: Last name of customer. This value will be used for customer identification.
- Value: <p>Example:- <br>Wick</p>
- Tags: string
### Metadata Object:

#### metadata.PAYU:gateway_reference_id:
- Description: **Use this parameter only when you have Multiple Line of Businesses.** 

To use multiple MID setup, please pass reference Id as per the following format:

Assume you have two lines of businesses BUS and TRAIN; and using RAZORPAY and PAYU gateways.

For BUS LOB pass the following in order create request. metadata.PAYU:gateway_reference_id : BUS metadata.RAZORPAY:gateway_reference_id : BUS

For TRAIN LOB pass the following in order create request. metadata.PAYU:gateway_reference_id : TRAIN metadata.RAZORPAY:gateway_reference_id : TRAIN
- Value: <p>Example:- <br>BUS</p>
- Tags: string
### Mandate Parameters:

#### options.create_mandate:
- Description: Enum: 'REQUIRED' , "OPTIONAL'.

Defines what kind mandate support is available during a session. Required to create a Mandate.

Chose between the follow values based upon requirements :-

* REQUIRED : Mandate is must for completing transaction. Only instruments which support Mandate will be shown
* OPTIONAL : Mandate is a user choice for completing transaction.
- Value: <p>Example:- <br>OPTIONAL</p>
- Tags: string

#### mandate.max_amount:
- Description: mount that can be set as maximum mandate Mandatory only if mandate.amount_rule = VARIABLE </p
- Value: <p>Example:- <br>1000.0</p>
- Tags: string

#### mandate.start_date:
- Description: mount that can be set as maximum mandate Mandatory only if mandate.amount_rule = VARIABLE </p
- Value: <p>Example:- <br>1633087969</p>
- Tags: string

#### mandate.end_date:
- Description: Mandate start date in UNIX EPOCH timestamp (UTC timezone), from when a mandate will move to EXPIRED state and recurring mandate will not be allowed </p
- Value: <p>Example:- <br>1633088989</p>
- Tags: string

#### mandate.frequency:
- Description: Defines the frequency of mandate execution, how often a customer should be charged

Enum :- ONETIME DAILY WEEKLY FORTNIGHTLY MONTHLY BIMONTHLY QUARTERLY HALFYEARLY YEARLY ASPRESENTED
- Value: <p>Example:- <br>1633088989</p>
- Tags: string

#### mandate.rule_value:
- Description: 1-7 when frequency is WEEKLY. In weekly, serial numbers start from Monday. Monday represents 1 and Sunday represents 7.

1-16 when frequency is FORTNIGHTLY. This mandate is executed twice a month. First day of the month is represented by value '1' and ends with '15' on 15th day of the month. Then again starts with '1' for 16th of the month and ends with the last day of the month.

1-31 when frequency is MONTHLY, BIMONTHLY, QUARTERLY, HALFYEARLY, or YEARLY.

Not required when frequency is ONETIME, DAILY, ASPRESENTED. For Razorpay, rule_value will be considered as the last date of the week/month/year. For Paytm, rule_value will be considered as today's date/day
- Value: <p>Example:- <br>1</p>
- Tags: string

#### mandate.amount_rule:
- Description: Enum: FIXED, VARIABLE

In case of FIXED amount_rule, amount will be equal to max amount
- Value: <p>Example:- <br>FIXED</p>
- Tags: string

#### mandate.revokable_by_customer:
- Description: If false, the mandate cannot be revoked by the customer once set. It should be true for Recurring and true/false for ONETIME
- Value: <p>Example:- <br>false</p>
- Tags: Boolean

#### mandate.block_funds:
- Description: Should be true for ONETIME and false for Recurring.
- Value: <p>Example:- <br>false</p>
- Tags: Boolean
## API Responses:
### 200:

#### order_id:
- Description: Order Id passed during order creation
- Tags: string

#### status:
- Description: Status of order
- Value: <p>Example:-<br>NEW</p>
- Tags: string
### 400:

#### status:
- Description: Bad Request
- Tags: string

#### error_code:
- Description: Details of keys missing
- Value: <p>Example:-<br>Mandatory fields are missing</p>
- Tags: string

#### error_message:
- Description: Further Details of keys missing
- Tags: string
### 401:

#### status:
- Description: error
- Tags: string

#### error_code:
- Description: access_denied
- Tags: string
### 500:

#### status:
- Description: error
- Tags: string

#### error_code:
- Description: Internal server Error
- Tags: string
