Create an Order on the Server
An order should be created for every payment. The orderId returned in the response must be passed to checkout to protect the request from tampering.
How to Create an Order
Section titled “How to Create an Order”To create an order, integrate the sample API code below into your server.
# POST: {{domain}}/nac/api/v1/pg/orders/create-checkoutcurl -X POST {{domain}}/nac/api/v1/pg/orders/create-checkout \-U [CLIENT_ID]:[CLIENT_SECRET] \-H 'Content-Type: application/json' \-d '{ "amount": 500.00, "currency": "INR", "uiMode": "checkout", "receiptId": "66497326b1577421a0e99fb3", "description": "Ecommerce Transaction", "customerFields": { "email": "xyz@email.com", "phone": 9999999999, "name": "User name" }, "curn": "curn_id", "redirectType": "redirect"}'{ "orderId": "wb-e883b28d-0cd3-455d-9903-ef5d3d8ddf27", "amount": 500.00, "receiptId": "66497326b1577421a0e99fb3", "status": "success", "resCode": 200, "errMessage": ""}{ "receiptId": "66497326b1577421a0e99fb3", "status": "failure", "resCode": 400, "errMessage": "Order failed"}| Parameter | Mandatory | Description | Type | Example |
|---|---|---|---|---|
amount |
Yes | The total amount of the transaction in the specified currency. (up to 2 decimals) | Numeric | 500.00 |
currency |
Yes | The currency used for the transactions. | String | "INR" |
uiMode |
Yes | UI mode for the transaction. | String | "checkout" |
receiptId |
No | Unique identifier for the transaction. (up to 40 characters) | String | "57Kr4ec2qdQMLJ0QVFYZnu1N5y49x0CZz5PlHhp" |
description |
No | Additional information or notes regarding the transaction. | String | "Sample Transactions" |
curn |
No | Custom identifier or metadata for the order. | String | "123456789" |
redirectType |
Yes | Redirection mode after the transaction. | String | "post" / "redirect" |
phone |
Yes | Customer’s phone. | String | "9912364456" |
email |
Yes | Customer’s email. | String | "example@gmail.com" |
name |
Yes | Customer’s name. | String | "Customer name" |
phone, email, and name are nested inside the customerFields object in the request body (see sample above).