Create an Order
Step 1
Add Session Create function in your backend
Expose /initiateJuspayPayment API endpoint in your backend that calls the Create function of nodejs SDK. This API endpoint will be called from your frontend to open the payment page.
For ease of implementation, you can refer to order session function from ‘index.js’ file and update the following parameters:
Scroll inside to view more
|
First Column
|
Second Column
|
Third Column
|
|---|---|---|
order_id
| Mandatory
| Unique identifier for the order
|
customer_id
| Optional
| It is the ID with which merchant refers to a customer object. This id is used to access the stored payment methods, allow EMI transactions and setup subscriptions. In case of guest login it should be an empty string
|
amount
| Mandatory
| Amount that the customer has to pay. Will accept stringified double or integer values with upto two decimal places (Example: "100.15" and "100" are valid input but "100.1532" is not valid)
|
return_url
| Optional
| A fully qualified URL on which the customer will be redirected after payment completion
|
payment_page_client_id
| Mandatory
| For Sandbox, add 'hdfcmaster' as your client_id
|
merchant_id
| Optional
| Add the Merchant_ID provided by the bank
|
3 columns 7 rows
Warning
Please update ‘merchant_id’ and ‘customer_id’ in both ‘$params’ and ‘$requestOption’ variables
Step 2 (Optional)
Additional params for Order Session function
You may add these below mentioned optional params in your order session function added in the previous step as per your usecase:
Scroll inside to view more
|
Parameters
|
Description
|
|---|---|
customer_email
| Email address of the customer. If the backend gateway requires it, then you must send this value.
|
customer_phone
| Mobile number or fixed line number of the customer. If the backend gateway requires it, then you must send this value. We recommend passing a 10-digit number without including the "+91" or any mobile country code at the beginning.
|
first_name
| First Name of customer. This value will be used for customer identification.
|
last_name
| Last name of customer. This value will be used for customer identification.
|
description
| Description for order to be displayed to the user on amountBar.
|
currency
| Currency for the order. It should only be passed when supported by the Payment Gateway and enabled in the SmartGateway Dashboard within EC Operations → PGCC → Select PG → Edit → Supported Currencies.
|
udf1, udf2, udf3, udf4, udf5 (No Special Characters Supported)
| User Defined Parameter (UDF) field can be used to send any user defined parameters and it can be seen in the SmartGateway dashboard under each order. Example - abc5349
|
udf6, udf7, udf8, udf9, udf10 (Special Characters Supported)
| User Defined Parameter (UDF) field can be used to send any user defined parameters and it can be seen in the SmartGateway dashboard under each order. Example - abc5349
|
2 columns 9 rows
Note
Please pass parameters given above in String format

