# Create Order

Use the Create Order API to generate a new payment order and initiate a hosted checkout session for your customer.

Once the order is created successfully, KwikPaisa returns a hosted payment link that can be used to redirect customers and complete the payment securely.

This API supports:

* UPI Payments
* QR Payments
* Net Banking
* Cards
* Wallets

***

## Endpoint

```http
POST /api/v3/pg/order/create
```

## Base URLs

### Sandbox

```http
https://sandbox.kwikpaisa.com
```

### Production

```http
https://api.kwikpaisa.com
```

***

#### This endpoint requires standard KwikPaisa authentication headers.

Refer to:\
➡️ [Headers](/v3-guide/authentication/headers.md)\
➡️ [Signature Generation](/v3-guide/authentication/signature.md)\
➡️ [Timestamp Validation](/v3-guide/authentication/timestamp.md)

***

## Request Parameters

| Parameter        | Type           | Required | Description                  |
| ---------------- | -------------- | -------- | ---------------------------- |
| `order_id`       | Integer/String | Yes      | Unique merchant order ID     |
| `order_amount`   | Decimal        | Yes      | Transaction amount           |
| `order_currency` | String         | Yes      | Currency code (Example: INR) |
| `order_note`     | String         | No       | Additional order information |
| `service_type`   | String         | Yes      | Transaction service type     |
| `customer.name`  | String         | Yes      | Customer full name           |
| `customer.email` | String         | Yes      | Customer email address       |
| `customer.phone` | String         | Yes      | Customer mobile number       |
| `return_url`     | String         | Yes      | Merchant return/callback URL |

***

## Example Request Body

```json
{
  "order_id": 6116229263036,
  "order_amount": 105,
  "order_currency": "INR",
  "order_note": "Additional order info",
  "service_type": "DIGITAL",
  "customer": {
    "name": "Ajay",
    "email": "developer@jangras.co",
    "phone": "9816512345",
    "address": {
      "line1": "Capital Office, Kemp House",
      "line2": "152 - 160 City Road",
      "city": "London",
      "state": "London",
      "country": "UK",
      "postal_code": "EC1V 2NX"
    }
  },
  "return_url": "https://merchant.in/process_return.php?order_id=order_1626945143520"
}
```

***

## Example cURL Request

```http
curl --request POST \
--url https://sandbox.kwikpaisa.com/api/v3/pg/order/create \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--header "X-API-KEY: pk_test_xxxxxxxxx" \
--header "X-TIMESTAMP: GENERATED_TIMESTAMP" \
--header "X-SIGNATURE: GENERATED_SIGNATURE" \
--data '{
  "order_id": 6116229263036,
  "order_amount": 105,
  "order_currency": "INR",
  "order_note": "Additional order info",
  "service_type": "DIGITAL",
  "customer": {
    "name": "Ajay",
    "email": "developer@jangras.co",
    "phone": "9816512345",
    "address": {
      "line1": "Capital Office, Kemp House",
      "line2": "152 - 160 City Road",
      "city": "London",
      "state": "London",
      "country": "UK",
      "postal_code": "EC1V 2NX"
    }
  },
  "return_url": "https://merchant.in/process_return.php?order_id=order_1626945143520"
}'
```

***

## Example Success Response

```json
{
  "code": "200",
  "status": "success",
  "message": "API authentication successful!",
  "return_data": {
    "kwikX_order_id": "kp_40dec464-7155-43a3-855d-c95c5ab1be71",
    "created_at": "13-05-2026 08:34 AM",
    "order_id": 6116229263036,
    "order_status": "UN_PAID",
    "payment_link": "https://sandbox.kwikpaisa.com/payment/checkout/..."
  }
}
```

***

## Response Parameters

| Parameter        | Description                         |
| ---------------- | ----------------------------------- |
| `kwikX_order_id` | Unique KwikPaisa generated order ID |
| `created_at`     | Order creation timestamp            |
| `order_id`       | Merchant order ID                   |
| `order_status`   | Current payment status              |
| `payment_link`   | Hosted checkout payment URL         |

***

## Redirect Customer to Payment Link

After receiving the response, redirect the customer to:

```http
payment_link
```

This hosted payment page allows customers to securely complete the transaction using supported payment methods.

***

## Order Status Flow

Possible order statuses:

| Status       | Description                    |
| ------------ | ------------------------------ |
| `UN_PAID`    | Payment pending                |
| `PROCESSING` | Payment under processing       |
| `PAID`       | Payment completed successfully |
| `FAILED`     | Payment failed                 |
| `EXPIRED`    | Payment session expired        |

***

## Important Notes

* `order_id` must always be unique
* Duplicate order IDs may be rejected
* Generate signatures server-side only
* Always validate payment status using Order Status API
* Do not rely only on frontend redirects

***

## Recommended Payment Flow

1. Create Order API
2. Redirect customer to `payment_link`
3. Customer completes payment
4. Receive webhook notification
5. Verify payment using Order Status API

***

## Common Errors

### 400 Bad Request

Possible reasons:

* Missing required parameters
* Invalid payload format
* Invalid order amount

***

### 401 Unauthorized

Possible reasons:

* Invalid API key
* Incorrect signature
* Expired timestamp

***

### Duplicate Order ID

Possible reasons:

* Reusing existing `order_id`
* Duplicate payment attempts

***

## Best Practices

* Always use unique order IDs
* Validate payment status server-side
* Verify webhook signatures
* Store `kwikX_order_id` for reconciliation
* Use HTTPS for all requests


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.kwikpaisa.com/v3-guide/payment-gateway-integration/create-order.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
