Create Order API

This is a Server-to-Server API that takes order parameters as an input and creates an order in the Juspay system and fetches the corresponding client_auth_token.


Amount and order id are the mandatory fields, the contact details like email, phone number, customer id's are conditional and depends on the underlying payment gateway/ aggregator used.

'UDF' is used to pass any additional information that is required to be stored at Juspay for any analysis or other operations. In some cases, these UDFs are passed to the downstream gateways as well.

Juspay supports 10 UDFs (UDF1 to UDF10). The values passed in UDFs are reflected back in the order status response and in webhooks back to the merchant. If there are any special characters that need to be passed in UDF values, please use UDF 6 to 10 for passing the same. UDF 1 to 5 can be used to pass values which do not have any special characters.

‘Metadata’ is used to send custom params to the payment aggregators, irrespective of default parameters, The supported parameters

Note: Auth api key should be Base64 encoded.

Note

If merchants choose not to call the Juspay Customer API, the Customer ID can be implicitly created during order creation. Please ensure the following,

  • Include all required customer-related parameters in the order creation request.

  • Juspay internal enablement is necessary for implicit customer creation. Please contact the Juspay team for this enablement.

Scroll inside to view more
Payment Gateways
Fields
PG1
metadata.PG1:promo_code
PG2
metadata.PG2:AdditionalInfo3
PG3
metadata.PG3:campaignCode
PG4
metadata.PG4:OrderInfo
PAYPAL
metadata.PAYPAL:landing_page
PAYPAL
metadata.PAYPAL:phone_number
PAYPAL
metadata.PAYPAL:country_code
PAYPAL
metadata.PAYPAL:first_name
PAYPAL
metadata.PAYPAL:last_name
PAYPAL
metadata.PAYPAL:experience_id
PAYPAL
metadata.PAYPAL:brand_name
PAYPAL
metadata.PAYPAL:additional_data
API Endpoints
Sandbox Link
POST
https://sandbox.juspay.in/orders
Production Link
POST
https://api.juspay.in/orders
Authorization Header
Headers
Body
200 : Success
400 : Invalid Input data
401 : Authentication Failed

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
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"}}