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:
Scroll inside to view more
|
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.
|
Request
Response
API Endpoints
Sandbox Link
POST
https://sandbox.juspay.in/orders
Production Link
POST
https://api.juspay.in/orders
Headers
Body
200 : Success
Error Codes
Scroll inside to view more
|
Scenario
|
Error Codes
|
Sample Error Message
|
|---|---|---|
Not passing the currency value
| 400
| {"error_message":"Bad Request.","status":"Bad Request","error_code":"INVALID_REQUEST","error_info":{"user_message":"Invalid input data","fields":[{"field_name":"currency","reason":"Missing field or Invalid Value"}],"developer_message":"Invalid input data","code":"INVALID_INPUT","category":"USER_ERROR"}}
|
Not passing the amount value
| 400
| {"error_message":"Bad Request.","status":"Bad Request","error_code":"INVALID_REQUEST","error_info":{"user_message":"Invalid input data","fields":[{"field_name":"amount","reason":"Missing field or Invalid Value"}],"developer_message":"Invalid input data","code":"INVALID_INPUT","category":"USER_ERROR"}
|
Passing the amount in negative Integer
| 400
| {"error_message":"Bad Request.","status":"Bad Request","error_code":"INVALID_REQUEST","error_info":{"user_message":"Invalid input data","fields":[{"field_name":"amount","reason":"Invalid amount"}],"developer_message":"Invalid input data","code":"INVALID_INPUT","category":"USER_ERROR"}}
|
Passing the amount in Positive Integer
| 400
| {"error_message":"BadRequest.","status":"Bad Request","error_code":"INVALID_REQUEST","error_info":{"user_message":"Invalid input data","fields":[{"field_name":"amount","reason":"Missing field or Invalid Value"}],"developer_message":"Invalid input data","code":"INVALID_INPUT","category":"USER_ERROR"}}
|
Not passing the customer_email value
| 400
| {"status":"error","error_code":"invalid_request","error_info":{"user_message":"Invalid customer Email","fields":[{"field_name":"customerEmail","reason":"Invalid value."}],"developer_message":"customerEmail shouldn't have any special chars","code":"INVALID_INPUT","category":"USER_ERROR"}}
|
Not sending the orderId
| 400
| {"error_message":"order_id is missing","status":"Bad Request","error_code":"order_id is missing","error_info":{"user_message":"Please pass order_id in request","fields":[{"field_name":"order_id","reason":"Missing field."}],"developer_message":"order_id is missing in request","code":"MISSING_MANDATORY_PARAMETER","category":"USER_ERROR"}}
|
Not passing API key
| 403
| {"error":true,"error_message":"Forbidden.No valid API key or client auth token is present in Authorization header or client_auth_token query parameter","user_message":"Access Denied.Unable to proceed.","userMessage":"Access Denied.Unable to proceed.","error_info":{"code":"UNAUTHORIZED","category":"USER_ERROR","user_message":"AccessDenied","developer_message":"No valid API key or client auth token is present in Authorization header or client_auth_token query parameter"}}
|
Invalid API key
| 401
| {"status":"error","error_code":"access_denied","error_info":{"user_message":"Unauthorized.","developer_message":"Invalid API Key.Please pass a valid and active apikey.","code":"UNAUTHORIZED","category":"USER_ERROR"}}
|
Whitelisting of IP in dashboard
| 403
| {"error":true,"error_message":"Internal Server error.","user_message":"Bad Origin.","error_info":{"code":"BAD_ORIGIN","category":"USER_ERROR","user_message":"Bad Origin.","developer_message":"IP Verification Failed"}}
|
Passing amount as 0(without Juspay internal enablement)
| 400
| {"error_message":"Bad Request.","status":"ERROR","error_code":"INVALID_REQUEST","error_info":{"user_message":"Invalid input data","fields":[{"field_name":"amount","reason":"Invalid amount"}],"developer_message":"Invalid input data","code":"INVALID_INPUT","category":"USER_ERROR"}}'
|
Passing a non configured currency
| 400
| {"error_message":"Can't find a suitable gateway to process the transaction","status":"Bad Request","error_code":"invalid_request_error","error_info":{"user_message":"Gateway not found to process the transaction request.","developer_message":"No functional gateways after filtering for currency THB","code":"GATEWAY_NOT_FOUND","category":"CONFIG_ERROR"}}
|
Not Passing customer_id
| 400
| {"error_message":"pass valid customer_id","status":"ERROR","error_code":"INVALID_CUSTOMER_ID","error_info":{"user_message":"INVALID_CUSTOMER_ID","fields":[{"field_name":"customer_id","reason":"Invalid Value"}],"developer_message":"pass valid customer_id","code":"INVALID_INPUT","category":"USER_ERROR"},"status_id":-1}
|
Invalid gateway_id
| 400
| {"error_message":"Can't find a suitable gateway to process the transaction","status":"Bad Request","error_code":"invalid_request_error","error_info":{"user_message":"Gateway not found to process the transaction request.","developer_message":"No functional gateways supporting this transaction.","code":"GATEWAY_NOT_FOUND","category":"CONFIG_ERROR"}}
|
Not passing mandate_max_amount
| 400
| {"error_message":"Bad Request.","status":"ERROR","error_code":"INVALID_REQUEST","error_info":{"user_message":"Invalid input data","fields":[{"field_name":"mandate","reason":"mandate_max_amount is not passed or is invalid"}],"developer_message":"Invalid input data","code":"INVALID_INPUT","category":"USER_ERROR"},"status_id":-1}
|
Passing mandate_max_amount as '0'
| 400
| {"error_message":"mandate_max_amount should be greater than or equal to 1","status":"ERROR","error_code":"INVALID_REQUEST","error_info":{"user_message":"INVALID_REQUEST","fields":[{"field_name":"mandate.max_amount","reason":"Invalid Value"}],"developer_message":"mandate_max_amount should be greater than or equal to 1","code":"INVALID_INPUT","category":"USER_ERROR"},"status_id":-1}
|
Passing any date greater than today as a start date
| 200
| By default taking today's date
|
Not Passing start date of mandate
| 200
| By default taking today's date
|
Not passing end date
| 200
| By default taking 10 years
|
Passing end date as the same day with difference of few hours
| 400
| {"error_message":"End date passed is invalid","status":"ERROR","error_code":"INVALID_END_DATE","error_info":{"user_message":"INVALID_END_DATE","fields":[{"field_name":"mandate.end_date","reason":"Invalid Value"}],"developer_message":"End date passed is invalid","code":"INVALID_INPUT","category":"USER_ERROR"},"status_id":-1}
|
Not Passing mandate.frequency field
| 200
| By default it is taking as ASPRESENTED
|
Passing invalid gateway_reference_id
| 400
| {"error_message":"Can't find a suitable gateway to process the transaction","status":"Bad Request","error_code":"invalid_request_error","error_info":{"user_message":"Gateway not found to process the transaction request.","developer_message":"No gateways are configured with the referenceIds {\"RAZORPAY:gateway_reference_id\":\"test\"} to proceed transaction ","code":"GATEWAY_NOT_FOUND","category":"CONFIG_ERROR"}}
|
- Have questions?
- Need help? Contact support
- LLM? Read llms.txt

