Create Order
This is the same API used for creating order for one-time payments. It can also be used to create a mandate for your existing customers with subscription specific details like amount, subscription frequency, duration of the mandate, Required/Optional mandate flow, etc. Use the order ID from the response of this API to call the Mandate Registration API.
Prerequisite for creating a mandate is to have the customer already registered/created with you. You can use Customer APIs to create a new customer or check the status of an existing customer.
The API is not required for the merchants using Juspay's Payment Page product.
During the entire journey, a mandate once created can take up any of the following states:
|
Status
|
Description
|
|---|---|
CREATED
| Mandate has been created, but awaiting status from PG.
|
ACTIVE
| When PG accepts the chosen mode of payment, the mandate is set to the active state. This is a terminal state until mandate expires or customer/merchant wants to revoke the mandate.
|
PAUSED
| Customer has an option to pause the mandate. Status changes to PAUSED when customer exercises this option.
|
REVOKED
| Mandate is revoked by either the customer or the merchant. Revoked is a terminal state, once Revoked the status cannot be changed.
|
FAILURE
| Mandate creation was unsuccessful. This is a terminal state, the merchant has to create a new mandate if failed.
|
EXPIRED
| Mandate validity has expired. This is a terminal state.
|
Values that mandate.rule_value can adopt depending on mandate.frequency
Fortnightly
If the value is ‘14’, ‘15’ or ‘16’ and falls on the latter half of February (16th to 28th) then the mandate shall execute on the last day of February.
If the mandate start date is 24th January 2018 with value ‘16’ then the first debit will be on 31st January, followed by 15th February, 28th February, 15th March, 31st March and so on.
If the value is ‘16’ and the month has only 30 days then the mandate should execute on 30th.
If the mandate start date is 29th January and the value is ‘4’ then the first debit will be on 4th February followed by 19th February, 4th March and so on.
Monthly
If the value is ‘29’, ‘30’ or ‘31’ and falls on February then the mandate shall execute on the last day of February.
If the value is ‘31’ and the next executable month has 30 days only then the mandate will execute on 30th
If the mandate start date is 29th January and the value is ‘17’ then the first debit will be on 17th February
Merchant ID which would have been issues while registering with Juspay
It should be application/x-www-form-urlencoded
We recommend passing the customer_id as the x-routing-id. If the customer is checking out as a guest, you can pass an alternative ID that helps track the payment session lifecycle. For example, this could be an Order ID or Cart ID.
This ID is associated with the customer. It plays a key role in ensuring consistency and maintaining connections across different systems. If you fail to pass the same x-routing-id for the same customer in all related API calls, it could lead to issues with API functionality. Therefore, it’s crucial that you use the same x-routing-id for all requests tied to the same customer.
Example:- customer_1122
Unique Identifier for the order. You can pass your native order ID here.
This is the amount that a customer will be charged in this transaction.
ISO string of the currency. Default value: INR
Unique ID for a customer that you get after running the Create Customer API
(Check Customer section for more details)
Email address of the customer. This field is mandatory if gateway requires it.
Mobile number or fixed line number of the customer. This field is mandatory if gateway requires it.
Short description for the order. We send this information to the gateways whenever there is a provision for this.
An identifier for the product. Fits well for impulse purchase usecases.
Specify your preferred gateway for this order. Complete mapping for gateway_id can be found here: Gateway mapping
A fully qualified URL such as http://shop.merchant.com/ to which the customer will be redirected after payment completion. This URL shouldn’t contain any query parameters.
This URL takes higher precedence over the common return URL configured in your account settings.
First name in the billing address
Last name in the billing address
Line 1 in the billing address
Line 2 in the billing address
Line 3 in the billing address
Billing address city
Billing address state
Billing address country
Billing address postal code or zip code
Mobile or phone number in the billing address
ISO Country code Default value: IND
First name in the shipping address
Last name in the shipping address
Line1 in the shipping address
Line2 in the shipping address
Line3 in the shipping address
Shipping address city
Shipping address state
Shipping address country
Shipping address postal code or zip code
Mobile or phone number in the shipping address
ISO Country code Default value: IND
For merchants who wants to set up mandates, can pass this as either “REQUIRED” or “OPTIONAL”. “REQUIRED” means that the transaction for this order has to be definitely converted to a mandate. “OPTIONAL” means that the final decision of conversion of the transaction lies at the /txns api call with the flag “should_create_mandate”
Maximum amount for a mandate. Required, only when amount type is variable. If amount type is fixed, amount is considered as max amount.
Defines the frequency of mandate execution, how often a customer should be charged.
Data type ENUM:
ONETIME (Supported only by UPI)
DAILY
WEEKLY
FORTNIGHTLY
MONTHLY
BIMONTHLY
QUARTERLY
HALFYEARLY
YEARLY
ASPRESENTED
By Default it is considered as ASPRESENTED
If frequency is selected anything other than ONETIME, DAILY, ASPRESENTED, rule_value should be passed mandatorily.
Note:
1. Daily is not supported by Billdesk and Paytm (For cards)
2. In UPI AutoPay, ONETIME frequency, Mandate is valid only for 90 Days
Data type ENUM: FIXED, VARIABLE. By default, it is considered as VARIABLE. In case of FIXED amount_rule.
Mandatory for UPI Mandate. Mandate end date in UNIX EPOCH timestamp (UTC timezone). Post end date, mandate will move to EXPIRED state and recurring mandate will not be allowed.By default value will be Mandate start date + 30 years
If false, the mandate cannot be revoked by the customer once set. Applicable only for UPI mandate. It should be true for Recurring and true/false for ONETIME. By default value will be true
Set to true if funds have to be blocked while a mandate is being created. Should be true for ONETIME and false for Recurring. By default value will be TRUE for ONETIME and FALSE for Recurring.
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.
Refer notes for detailed explanation.
ON| BEFORE| AFTER
For Razorpay, rule_type will be updated to BEFORE. For Paytm, Billdesk rule_type will be updated to AFTER.
Recurring amount for a mandate.
For variable amount type, Recurring amount should not be greater than max_amount.
For fixed amount type, Recurring amount should not be greater than order amount.
Recommended, if update mandate flow is used later.
Number of days after renewal cycle start date for which merchant can send renewal request. By default 0 for DAILY and ASPRESENTED and 7 for remaining frequencies.
Applicable only for Paytm. By default 2 for UPI mandate.
Applicable for TPV Mandate. This is a array of JSON objects and each JSON object includes set of parameters as below 1. bank_account_number 2. bank_ifsc 3. juspay_bank_code 4. bank_beneficiary_name 5. bank_account_type 6. bank_account_id If a merchant uses juspay bank_account feature APIs, then sending bank_account_id is sufficient.
Pass the param if you want to refund the debit amount while setting up the mandate, this will keep you mandate in active state and initiate a refund call to the PG
Example:- True
TPV_PAYMENT. Applicable only for TPV Mandates.

