> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eximpe.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Order

## Overview

The Create Order endpoint is the first step in the payment flow across all collection modes. It creates a new order with buyer details, product information, and your preferred payment collection settings (Hosted Payment, Server-to-Server, Payment Link, etc.).

After creating an order, the response depends on the selected mode:

* Hosted Payment: returns a `session_id` and `order_id` for redirecting customers to the checkout page
* S2S UPI Intent: returns an `order_id` and `intent_uri`
* S2S Card: returns an `order_id` and an `acs_template` (Base64) for 3D Secure

## Payment Collection Modes

EximPe supports multiple payment collection modes:

### 1. Hosted Payment (Default)

The standard hosted payment flow where customers are redirected to EximPe's secure payment page.

### 2. S2S UPI Intent

Server-to-server UPI intent flow that generates a UPI intent link for direct app-to-app payments.

### 3. S2S Card Payment

Server-to-server card payment flow with 3D Secure authentication. For new cards, the system initiates 3D Secure verification and returns an ACS template that must be rendered on the client side to complete authentication. Card details are securely processed and can be tokenized using the [Create Token API](/api-reference/card-tokens/save) after successful payment.

## Request Parameters

### Required Parameters

* `reference_id`: Unique identifier for the order
* `amount`: Payment amount in decimal format
* `currency`: 3-letter ISO currency code (e.g., INR)
* `return_url`: URL to redirect after payment completion
* `buyer`: Buyer details object
* `product`: Product details object
* `invoice`: Invoice details object

### Optional Parameters

* `collection_mode`: Payment collection mode (`hosted_payment` or `s2s`)
* `mop_type`: Method of payment (`upi`, `credit_card`, `debit_card`, `net_banking`, `qr`)
* `upi_flow_type`: UPI flow type (`intent`) - required when using S2S with UPI
* `card_details`: Card information object - required when `mop_type` is `credit_card` or `debit_card`

### Card Payment Specific Parameters

When using card payments (`mop_type` is `credit_card` or `debit_card`), additional buyer information is required:

* `buyer.ip_address`: Customer's IP address (used for fraud prevention)
* `buyer.user_agent`: Customer's browser user agent (used for fraud prevention)

#### Card Details Options

You can provide card information in two ways:

1. **New Card Details** (for first-time payments):
   * Include full card information: `number`, `cardholder_name`, `expiry_month`, `expiry_year`, `cvv`, `network`
   * Required for new cards not previously saved
   * Use the [Create Token API](/api-reference/card-tokens/save) after successful payment to tokenize for future use

2. **Saved Card Token** (for repeat payments):
   * Use `token`: Previously saved card token from the [Create Token API](/api-reference/card-tokens/save)
   * Include `identifier`: Customer identifier used when saving the card
   * Include `network`: Card network (visa, mastercard, etc.)
   * No sensitive card data required - token handles authentication

### Parameter Definitions

The following tables define all request parameters, including nested objects, types, requirements, and constraints.

#### Top-level

| Name             | Type   | Required      | Description                                                       | Constraints                                                                             |
| ---------------- | ------ | ------------- | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| amount           | string | Yes           | Amount to charge, decimal string.                                 | Format: `^[0-9]+(\.[0-9]{1,2})?$`; amount must be > 0 and ≤ 10,000,000.00               |
| currency         | string | Yes           | 3-letter ISO currency code.                                       | Supported: `INR`                                                                        |
| reference\_id    | string | Yes           | Merchant-side unique reference for the order.                     | 1–50 chars; use letters, numbers, and dashes; unique per merchant while order is active |
| collection\_mode | string | No            | Mode of payment collection.                                       | Enum: `hosted_payment`, `s2s`; default `hosted_payment`                                 |
| mop\_type        | string | No            | Method of payment.                                                | Enum: `upi`, `credit_card`, `debit_card`, `net_banking`, `wallet`, `qr`                 |
| upi\_flow\_type  | string | Conditionally | UPI flow when `mop_type` is `UPI` and `collection_mode` is `s2s`. | Required if `mop_type=UPI` and `collection_mode=s2s`; Enum: `intent`, `collection`      |
| return\_url      | string | Yes           | URL to redirect after payment/auth completion.                    | HTTPS URL recommended                                                                   |
| buyer            | object | Yes           | Buyer/customer details.                                           | See Buyer object                                                                        |
| product          | object | Yes           | Product or service being purchased.                               | See Product object                                                                      |
| invoice          | object | Yes           | Invoice metadata.                                                 | See Invoice object                                                                      |
| card\_details    | object | Conditionally | Card details or token for card payments.                          | Required if `mop_type` is `credit_card` or `debit_card`; See Card Details               |

Notes:

* "Conditionally" required means the field is required only when the stated condition is met.

#### Buyer

| Name        | Type   | Required | Description                                      | Constraints                                                         |
| ----------- | ------ | -------- | ------------------------------------------------ | ------------------------------------------------------------------- |
| name        | string | Yes      | Full name of the buyer.                          | Max 255 chars; letters, spaces, and common name punctuation (.,-' ) |
| email       | string | Yes      | Email of the buyer.                              | RFC 5322 email format                                               |
| phone       | string | Yes      | Phone number with country code.                  | Valid phone number; E.164 preferred (e.g., `+9198xxxxxxxx`)         |
| address     | object | Yes      | Buyer address.                                   | See Address object                                                  |
| ip\_address | string | Optional | Customer IP address for card fraud checks.       | IPv4/IPv6                                                           |
| user\_agent | string | Optional | Browser/device user agent for card fraud checks. | typical browser user agent string                                   |

#### Address (Buyer.address)

| Name         | Type   | Required | Description      | Constraints                                                                                   |
| ------------ | ------ | -------- | ---------------- | --------------------------------------------------------------------------------------------- |
| line\_1      | string | Yes      | Address line 1.  | Text up to \~255 chars; use standard address characters (letters, numbers, spaces, , . - / #) |
| line\_2      | string | No       | Address line 2.  | Text up to \~255 chars; use standard address characters (letters, numbers, spaces, , . - / #) |
| city         | string | Yes      | City.            | Alphabetic only; Max 255 chars                                                                |
| state        | string | Yes      | State/Province.  | Alphabetic only; Max 255 chars                                                                |
| postal\_code | string | Yes      | Postal/ZIP code. | 6 chars                                                                                       |

#### Product

| Name                  | Type   | Required    | Description                                  | Constraints                                                      |
| --------------------- | ------ | ----------- | -------------------------------------------- | ---------------------------------------------------------------- |
| name                  | string | Yes         | Product or service name.                     | Max 255 chars; letters, numbers, spaces, and common punctuation  |
| description           | string | No          | Description of the product/service.          | Max 1024 chars; letters, numbers, spaces, and common punctuation |
| type\_of\_goods       | string | Yes         | Nature of goods/services.                    | Enum: `digital_goods`, `physical_goods`, `service`               |
| hs\_code              | string | Conditional | 8-digit HS Code. Required for physical goods | Max 8 chars; numbers                                             |
| hs\_code\_description | string | No          | HS Code description.                         | Max 1024 chars; letters, numbers, spaces, and common punctuation |

#### Invoice

| Name   | Type   | Required | Description              | Constraints                                     |
| ------ | ------ | -------- | ------------------------ | ----------------------------------------------- |
| number | string | Yes      | Invoice number.          | Max 255 chars; letters, numbers, dashes/slashes |
| date   | string | No       | Invoice date (ISO 8601). | Format: `YYYY-MM-DD`                            |

#### Card Details

Provide one of the following variants when `mop_type` is `credit_card` or `debit_card`:

* New card (full PAN):
  * `number` (string, required): PAN; numeric 12-19 digits
  * `cardholder_name` (string, required): Name on card; max 128 chars
  * `expiry_month` (string, required): `MM` format; `01`-`12`
  * `expiry_year` (string, required): `YYYY`; current year or later
  * `cvv` (string, required): 3-4 digits
  * `network` (string, required): Enum: `visa`, `mastercard`, `rupay`, `amex`, `diners`, `discover`
  * `nickname` (string, required): Friendly label; max 64 chars
  * `identifier` (string, required): Customer identifier used for future reference

* Saved card (tokenized):
  * `token` (string, required): Token from Create Token API
  * `identifier` (string, required): Customer identifier used when saving the card
  * `network` (string, required): Card network; same enum as above

Security:

* Do not log or store raw PAN/CVV. Use HTTPS and comply with applicable PCI requirements.

## Response

### Hosted Payment Response

For hosted payment mode, the response includes:

* `session_id`: Use this to redirect customers to the payment page
* `order_id`: Unique order identifier

### S2S UPI Intent Response

For S2S UPI Intent mode, the response includes:

* `order_id`: Unique order identifier
* `intent_uri`: UPI intent link that can be used to open UPI apps directly

### S2S Card Payment Response

For S2S Card Payment mode, the response includes:

* `order_id`: Unique order identifier
* `acs_template`: Base64-encoded HTML template for 3D Secure authentication

**Important**: The `acs_template` must be decoded from Base64 and rendered in the customer's browser to complete the 3D Secure authentication process.

## Examples

<CodeGroup>
  ```json Hosted Payment theme={null}
  {
    "amount": "1000.00",
    "currency": "INR", 
    "reference_id": "ORDER_123456",
    "collection_mode": "hosted_payment",
    "return_url": "https://yourdomain.com/payment/callback",
    "mop_type": "upi",
    "buyer": {
      "name": "Alice Smith",
      "email": "alice.smith@example.com",
      "phone": "+919812345678",
      "address": {
        "line_1": "221B Baker Street",
        "city": "Mumbai",
        "state": "Maharashtra", 
        "postal_code": "400001"
      }
    },
    "product": {
      "name": "Wireless Headphones",
      "type_of_goods": "physical_goods"
    }
  }
  ```

  ```json S2S UPI Intent theme={null}
  {
    "amount": "1000.00",
    "currency": "INR",
    "reference_id": "ORDER_123457", 
    "collection_mode": "s2s",
    "mop_type": "upi",
    "upi_flow_type": "intent",
    "buyer": {
      "name": "John Doe",
      "email": "john.doe@example.com",
      "phone": "+919876543210",
      "address": {
        "line_1": "123 Main Street",
        "city": "Delhi",
        "state": "Delhi",
        "postal_code": "110001"
      }
    },
    "product": {
      "name": "Smartphone", 
      "type_of_goods": "physical_goods"
    }
  }
  ```

  ```json S2S Card Payment theme={null}
  {
    "amount": "1000.00",
    "currency": "INR",
    "reference_id": "CARD_13MYHALESH7",
    "return_url": "https://yourdomain.com/checkout/callback/",
    "collection_mode": "s2s",
    "mop_type": "debit_card",
    "card_details": {
      "nickname": "My Card",
      "number": "4895380110000003",
      "cardholder_name": "John Doe",
      "expiry_month": "05",
      "expiry_year": "2030",
      "cvv": "123",
      "network": "visa",
      "identifier": "EX0001"
    },
    "buyer": {
      "name": "John Doe",
      "email": "john.doe@example.com",
      "phone": "+919876543210",
      "address": {
        "line_1": "123 Main Street",
        "line_2": "Apt 4B",
        "city": "City",
        "state": "State",
        "postal_code": "123456"
      },
      "ip_address": "192.168.1.100",
      "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
    },
    "product": {
      "name": "Sample Product",
      "description": "This is a sample product description",
      "hs_code": "98051000",
      "hs_code_description": "Portable automatic data processing machines",
      "type_of_goods": "physical_goods"
    },
    "invoice": {
      "number": "INV_0HOZ0C",
      "date": "2025-09-04"
    }
  }
  ```

  ```json S2S Card Payment (Saved Token) theme={null}
  {
    "amount": "1000.00",
    "currency": "INR",
    "reference_id": "CARD_4FQ0AIHQEI9",
    "return_url": "https://yourdomain.com/checkout/callback/",
    "collection_mode": "s2s",
    "mop_type": "credit_card",
    "card_details": {
      "token": "1e6709282a21e83f43a020",
      "identifier": "EX0001",
      "network": "visa"
    },
    "buyer": {
      "name": "John Doe",
      "email": "john.doe@example.com",
      "phone": "+919876543210",
      "address": {
        "line_1": "123 Main Street",
        "line_2": "Apt 4B",
        "city": "City",
        "state": "State",
        "postal_code": "123456"
      },
      "ip_address": "192.168.1.100",
      "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
    },
    "product": {
      "name": "Sample Product",
      "description": "This is a sample product description",
      "hs_code": "98051000",
      "hs_code_description": "Portable automatic data processing machines",
      "type_of_goods": "physical_goods"
    },
    "invoice": {
      "number": "INV_3MUK2I",
      "date": "2025-09-04"
    }
  }
  ```
</CodeGroup>

## Response Examples

<CodeGroup>
  ```json Hosted Payment Response theme={null}
  {
    "success": true,
    "message": "Checkout session created successfully",
    "data": {
      "session_id": "session_abc123def456",
      "order_id": "OD2000992103"
    }
  }
  ```

  ```json S2S UPI Intent Response theme={null}
  {
    "success": true,
    "message": "S2S UPI Request created successfully",
    "data": {
      "intent_uri": "pa=kk.payutest@hdfcbank&pn=&tr=403993715534292371&tid=PPPL403993715534292371080725205418&am=1000.00&cu=INR&tn=UPIIntent",
      "order_id": "OD2000992103"
    }
  }
  ```

  ```json S2S Card Payment Response theme={null}
  {
    "success": true,
    "message": "S2S Card Payment Request created successfully",
    "data": {
      "order_id": "OD9888127185",
      "acs_template": "PGh0bWw+PGJvZHk+PGZvcm0gbmFtZT0icGF5bWVudF9wb3N0IiBpZD0icGF5bWVudF9wb3N0IiBhY3Rpb249Imh0dHBzOi8vdGVzdC5wYXl1LmluL2UxMGMzNmExYWQ2YTQ1OTkzMWNhODYzNTBhZjIxZDU0ZDhiMTZhODRjYWQ1NDAxMDE2OGFlN2RjYmEwMmEwYWEvdGhyZWVEU2VjdXJlL21ldGhvZCIgbWV0aG9kPSJwb3N0Ij4uLi4="
    }
  }
  ```
</CodeGroup>

## Implementation Notes

### UPI Payments

* **S2S UPI Intent**: The response includes a UPI intent link that can be used to open UPI apps directly

### Card Payments

* **3D Secure Flow**: For new cards, the system initiates 3D Secure verification
* **ACS Template Processing**:
  1. Decode the Base64 `acs_template` from the response
  2. Render the decoded HTML in the customer's browser
  3. The form will auto-submit to complete 3D Secure authentication
  4. Customer will be redirected back to your `return_url` after authentication
* **Card Tokenization**: Use the [Create Token API](/api-reference/card-tokens/save) after successful payment to securely tokenize cards for future use
* **Saved Card Usage**: Use previously saved card tokens for faster, more secure repeat payments
* **Fraud Prevention**: `ip_address` and `user_agent` are required for fraud detection and prevention

#### New vs Saved Cards

* **New Cards**: Require full card details and may trigger 3D Secure authentication
* **Saved Cards**: Use tokens for faster processing, reduced 3D Secure requirements, and enhanced security
* **Token Benefits**: No sensitive data exposure, faster checkout, improved conversion rates

### Security Considerations

* **Card Data**: Never log or store card details in your application
* **3D Secure**: Always implement proper 3D Secure handling for card payments
* **Token Management**: Use the [Card Token APIs](/api-reference/card-tokens/save) for managing saved cards


## OpenAPI

````yaml POST /pg/orders/
openapi: 3.0.0
info:
  title: Eximpe Payment Gateway API
  description: >-
    API for payment processing and order management through Eximpe payment
    gateway. This specification includes v1, v2, and v3 API versions.
  license:
    name: Proprietary
  version: 2.0.0
servers:
  - url: https://api-pacb-uat.eximpe.com
    description: Payment Gateway Sandbox URL
security:
  - clientAuth: []
    clientSecretAuth: []
    apiVersionHeader: []
tags:
  - name: Card Tokens
  - name: Merchants
  - name: Orders
  - name: Payment Links
  - name: Payments
  - name: Refunds
  - name: Settlements
  - name: Subscriptions
paths:
  /pg/orders/:
    post:
      tags:
        - Orders
      summary: Create Order
      operationId: v1_post_pg_orders_
      requestBody:
        description: Order creation request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/v1_CreateOrderRequest'
            examples:
              Hosted Payment:
                summary: Hosted Payment
                description: Standard hosted payment flow
                value:
                  amount: '2499.99'
                  currency: INR
                  reference_id: ORD_2024_WH_001234
                  return_url: https://electronicshub.com/payment/success
                  collection_mode: hosted_payment
                  mop_type: upi
                  buyer:
                    name: Priya Sharma
                    email: priya.sharma@techcorp.in
                    phone: '+919876543210'
                    address:
                      line_1: 403, Crystal Tower, Linking Road
                      line_2: Near Metro Station
                      city: Mumbai
                      state: Maharashtra
                      postal_code: '400050'
                  product:
                    name: Sony WH-1000XM5 Wireless Headphones
                    description: >-
                      Premium noise-cancelling wireless headphones with 30-hour
                      battery life
                    hs_code: '85183000'
                    hs_code_description: >-
                      Headphones and earphones, whether or not combined with a
                      microphone
                    type_of_goods: physical_goods
                  invoice:
                    number: INV_WH_2024_0621
                    date: '2024-06-21'
              S2S UPI Intent:
                summary: UPI Intent (S2S)
                description: Server-to-server UPI intent flow
                value:
                  amount: '24999.00'
                  currency: INR
                  reference_id: ORD_2024_SP_005678
                  collection_mode: s2s
                  mop_type: upi
                  upi_flow_type: intent
                  buyer:
                    name: Rajesh Kumar
                    email: rajesh.kumar@innovatetech.com
                    phone: '+919123456789'
                    address:
                      line_1: B-204, Tech Park Complex, Sector 18
                      city: New Delhi
                      state: Delhi
                      postal_code: '110075'
                  product:
                    name: Samsung Galaxy S24 Ultra 5G
                    description: >-
                      Latest flagship Android smartphone with 512GB storage and
                      S Pen
                    type_of_goods: physical_goods
                    hs_code: '85183000'
                    hs_code_description: >-
                      Headphones and earphones, whether or not combined with a
                      microphone
              S2S Card Payment:
                summary: Card Payment (S2S)
                description: >-
                  Server-to-server card payment flow with 3D Secure
                  authentication. For new cards, the system initiates 3D Secure
                  verification and returns an ACS template that must be rendered
                  on the client side to complete authentication. The card
                  details are securely processed and can be tokenized using the
                  Save Card API after successful payment.
                value:
                  amount: '15750.00'
                  currency: INR
                  reference_id: ORD_2024_TAB_456789
                  return_url: https://gadgetstore.com/payment/callback/
                  collection_mode: s2s
                  mop_type: debit_card
                  card_details:
                    nickname: HDFC VISA Debit
                    number: '4895380110000003'
                    cardholder_name: Meera Patel
                    expiry_month: '05'
                    expiry_year: '2030'
                    cvv: '123'
                    network: visa
                    identifier: USER_MP_001
                  buyer:
                    name: Meera Patel
                    email: meera.patel@creativeagency.in
                    phone: '+919845612378'
                    address:
                      line_1: 12/A, Shivaji Nagar Housing Society
                      line_2: Near City Mall
                      city: Pune
                      state: Maharashtra
                      postal_code: '411005'
                    ip_address: 103.25.142.87
                    user_agent: >-
                      Mozilla/5.0 (Windows NT 10.0; Win64; x64)
                      AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0
                      Safari/537.36
                  product:
                    name: Apple iPad Air (5th Generation) Wi-Fi 64GB
                    description: >-
                      10.9-inch Liquid Retina display with True Tone, M1 chip,
                      12MP cameras
                    hs_code: '84713010'
                    hs_code_description: >-
                      Portable automatic data processing machines weighing not
                      more than 10 kg
                    type_of_goods: physical_goods
                  invoice:
                    number: INV_TAB_2024_1204
                    date: '2024-12-04'
              S2S Card Payment (Saved Token):
                summary: Card Payment with Saved Token (S2S)
                description: >-
                  Server-to-server card payment using a previously saved card
                  token. This provides faster checkout and enhanced security by
                  avoiding transmission of sensitive card data.
                value:
                  amount: '3799.00'
                  currency: INR
                  reference_id: ORD_2024_WATCH_789012
                  return_url: https://luxurywatches.com/checkout/success/
                  collection_mode: s2s
                  mop_type: credit_card
                  card_details:
                    token: 1e6709282a21e83f43a020
                    identifier: USER_AS_002
                    network: visa
                  buyer:
                    name: Arjun Singh
                    email: arjun.singh@financecorp.com
                    phone: '+919987654321'
                    address:
                      line_1: Tower B, 15th Floor, DLF Cyber City
                      line_2: Phase 2, Sector 24
                      city: Gurugram
                      state: Haryana
                      postal_code: '122002'
                    ip_address: 27.147.158.92
                    user_agent: >-
                      Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)
                      AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0
                      Safari/537.36
                  product:
                    name: Apple Watch Series 9 GPS + Cellular 45mm
                    description: >-
                      Starlight Aluminum Case with Sport Loop, Advanced health
                      monitoring features
                    hs_code: '91021100'
                    hs_code_description: >-
                      Wrist-watches, electrically operated, whether or not
                      incorporating a stop-watch facility
                    type_of_goods: physical_goods
                  invoice:
                    number: INV_WATCH_2024_1205
                    date: '2024-12-05'
              S2S Net Banking:
                summary: S2S Net Banking
                description: >-
                  Server-to-server net banking payment. EximPe returns an ACS
                  template that redirects the customer to their bank's net
                  banking portal.
                value:
                  amount: '1500.00'
                  currency: INR
                  reference_id: S2SNB_REF123
                  return_url: https://yoursite.com/payment/callback/
                  collection_mode: s2s
                  mop_type: net_banking
                  netbanking_details:
                    bank_name: State Bank Of India
                  buyer:
                    name: Rahul Mehta
                    email: rahul.mehta@example.com
                    phone: '+919876543210'
                    address:
                      line_1: 12, MG Road
                      line_2: Indiranagar
                      city: Bangalore
                      state: Karnataka
                      postal_code: '560038'
                    ip_address: 103.25.64.10
                    user_agent: >-
                      Mozilla/5.0 (Windows NT 10.0; Win64; x64)
                      AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0
                      Safari/537.36
                  product:
                    name: Laptop Stand
                    description: Adjustable aluminium laptop stand
                    hs_code: '94033020'
                    hs_code_description: Furniture of metal of a kind used in offices
                    type_of_goods: physical_goods
                  invoice:
                    number: INV_NB_2024_001
                    date: '2025-09-04'
        required: true
      responses:
        '200':
          description: Order created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1_CreateOrderResponse'
              examples:
                Hosted Payment:
                  summary: Hosted Payment
                  description: Response for hosted payment mode
                  value:
                    success: true
                    message: Checkout session created successfully
                    data:
                      session_id: session_wh_5f8e3d7a9b2c1
                      order_id: OD2024120456789
                S2S UPI Intent:
                  summary: UPI Intent (S2S)
                  description: Response for S2S UPI Intent mode
                  value:
                    success: true
                    message: S2S UPI Request created successfully
                    data:
                      intent_uri: >-
                        pa=rajesh.kumar@okaxis&pn=Rajesh%20Kumar&tr=624857392104738291&tid=EXIMPE624857392104738291120425184729&am=24999.00&cu=INR&tn=Samsung%20Galaxy%20S24%20Ultra%205G
                      order_id: OD2024120567890
                S2S Card Payment:
                  summary: Card Payment (S2S)
                  description: >-
                    Response for S2S Card Payment mode with 3D Secure
                    authentication. The acs_template contains Base64-encoded
                    HTML that must be decoded and rendered on the client side to
                    complete the 3D Secure authentication process.
                  value:
                    success: true
                    message: S2S Card Payment Request created successfully
                    data:
                      order_id: OD2024120890123
                      acs_template: >-
                        PGh0bWw+PGJvZHk+PGZvcm0gbmFtZT0icGF5bWVudF9wb3N0IiBpZD0icGF5bWVudF9wb3N...
                S2S Card Payment (Saved Token):
                  summary: Card Payment with Saved Token (S2S)
                  description: Response for S2S Card Payment mode with saved token
                  value:
                    success: true
                    message: S2S Card Payment Request created successfully
                    data:
                      order_id: OD2024120890123
                      acs_template: >-
                        PGh0bWw+PGJvZHk+PGZvcm0gbmFtZT0icGF5bWVudF9wb3N0IiBpZD0icGF5bWVudF9wb3N...
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1_ErrorResponse'
              examples:
                Reference ID must be unique Error:
                  value:
                    success: false
                    error:
                      code: ERR_ORDER_002
                      message: Validation error
                      details:
                        reference_id: Reference ID must be unique
        '401':
          description: Unauthorized - Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1_ErrorResponse'
              examples:
                Missing credentials:
                  value:
                    success: false
                    error:
                      code: ERR_AUTH_000
                      message: Missing credentials
                      details:
                        authentication: Missing credentials.
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v1_ErrorResponse'
              example:
                success: false
                error:
                  code: ERR_SERVICE_ERROR_000
                  message: Payment gateway error
                  details:
                    error: An unexpected error occurred. Please try again later
      security:
        - clientAuth: []
          clientSecretAuth: []
          merchantAuth: []
          apiVersionHeader: []
components:
  schemas:
    v1_CreateOrderRequest:
      type: object
      required:
        - amount
        - currency
        - reference_id
        - buyer
        - product
      properties:
        amount:
          type: string
          description: Amount in decimal format (e.g., "100.00")
          pattern: ^\d+\.\d{2}$
        currency:
          type: string
          description: 3-letter ISO currency code (e.g., INR, USD)
          pattern: ^[A-Z]{3}$
        reference_id:
          type: string
          description: Unique identifier for the order
        return_url:
          type: string
          format: uri
          description: URL to redirect after payment
        collection_mode:
          type: string
          description: Payment collection mode
          enum:
            - hosted_payment
            - s2s
        mop_type:
          type: string
          description: Method of payment type (e.g., UPI)
          enum:
            - upi
            - credit_card
            - net_banking
            - debit_card
            - qr
        upi_flow_type:
          type: string
          description: >-
            UPI flow type (required when collection_mode is s2s and mop_type is
            UPI)
          enum:
            - intent
            - collection
        buyer:
          $ref: '#/components/schemas/v1_Buyer'
        product:
          $ref: '#/components/schemas/v1_Product'
        invoice:
          $ref: '#/components/schemas/v1_Invoice'
        card_details:
          $ref: '#/components/schemas/v1_CardDetails'
    v1_CreateOrderResponse:
      type: object
      required:
        - success
        - message
        - data
      properties:
        success:
          type: boolean
          description: Indicates if the request was successful
        message:
          type: string
          description: Response message
        data:
          $ref: '#/components/schemas/v1_OrderData'
    v1_ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          enum:
            - false
          description: >-
            Indicates if the request was successful. Always false for error
            responses.
        error:
          $ref: '#/components/schemas/v1_ErrorDetails'
    v1_Buyer:
      type: object
      required:
        - name
        - address
        - email
        - phone
      properties:
        name:
          type: string
          description: Buyer's full name
        email:
          type: string
          format: email
          description: Buyer's email address
        phone:
          type: string
          description: Buyer's phone number with country code
          pattern: ^\+[1-9]\d{1,14}$
        address:
          $ref: '#/components/schemas/v1_Address'
        ip_address:
          type: string
          description: Buyer's IP address (required for card payments)
        user_agent:
          type: string
          description: Buyer's browser user agent (required for card payments)
    v1_Product:
      type: object
      required:
        - name
        - type_of_goods
      properties:
        name:
          type: string
          description: Product name
        description:
          type: string
          description: Product description
        hs_code:
          type: string
          description: Harmonized System code, required for physical goods
        hs_code_description:
          type: string
          description: Description of the HS code
        type_of_goods:
          type: string
          description: Type of goods (e.g., physical_goods)
          enum:
            - physical_goods
            - digital_goods
            - service
    v1_Invoice:
      type: object
      properties:
        number:
          type: string
          description: Invoice number
        date:
          type: string
          format: date
          description: Invoice date in YYYY-MM-DD format
    v1_CardDetails:
      type: object
      required:
        - number
        - cardholder_name
        - expiry_month
        - expiry_year
        - cvv
        - network
        - identifier
      properties:
        nickname:
          type: string
          description: Card nickname for easy identification
        number:
          type: string
          description: Card number (will be tokenized for security)
          pattern: ^[0-9]{13,19}$
        cardholder_name:
          type: string
          description: Name on the card
        expiry_month:
          type: string
          description: Card expiry month (MM format)
          pattern: ^(0[1-9]|1[0-2])$
        expiry_year:
          type: string
          description: Card expiry year (YYYY format)
          pattern: ^[0-9]{4}$
        cvv:
          type: string
          description: Card verification value
          pattern: ^[0-9]{3,4}$
        network:
          type: string
          description: Card network (e.g., visa, mastercard)
          enum:
            - visa
            - mastercard
            - amex
            - discover
            - rupay
        identifier:
          type: string
          description: Unique identifier for the card
    v1_OrderData:
      type: object
      required:
        - order_id
      properties:
        session_id:
          type: string
          description: >-
            Unique session identifier for payment processing (for hosted payment
            mode)
        order_id:
          type: string
          description: Unique order identifier
        intent_uri:
          type: string
          description: UPI intent URI for direct app opening (for S2S UPI Intent mode)
        message:
          type: string
          description: Status message (for S2S UPI Collection mode)
        acs_template:
          type: string
          description: >-
            Base64-encoded HTML template for 3D Secure authentication (for S2S
            Card Payment mode)
    v1_ErrorDetails:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Error code (e.g., ERR_ORDER_002)
        message:
          type: string
          description: Error message
        details:
          type: object
          description: Detailed validation error information with field-specific errors
          additionalProperties:
            type: string
            description: Error message for the specific field
    v1_Address:
      type: object
      required:
        - line_1
        - city
        - state
        - postal_code
      properties:
        line_1:
          type: string
          description: Address line 1
        line_2:
          type: string
          description: Address line 2
        city:
          type: string
          description: City name
        state:
          type: string
          description: State name
        postal_code:
          type: string
          description: Postal/ZIP code
  securitySchemes:
    clientAuth:
      type: apiKey
      name: X-Client-ID
      in: header
      description: >-
        **Client Application ID** - Your unique application identifier used to
        authenticate API requests. You can find your Client ID in the Developer
        Settings section of the merchant dashboard.
      x-displayName: Client ID
      x-example: your-client-id
    clientSecretAuth:
      type: apiKey
      name: X-Client-Secret
      in: header
      description: >-
        **Client Secret Key** - Your secret key used alongside the Client ID for
        secure authentication. Keep this confidential and never expose it in
        client-side code. Available in the Developer Settings section of the
        merchant dashboard.
      x-displayName: Client Secret
      x-example: your-client-secret
    apiVersionHeader:
      type: apiKey
      name: X-API-Version
      in: header
      description: >-
        **API Version** - Specifies which version of the API to use (e.g.,
        '1.X.X', '2.X.X', or '3.X.X'). This header allows you to control which
        API version your integration uses. Default version information is
        available in the Developer Settings.
      x-displayName: API Version
      x-example: 3.0.0
    merchantAuth:
      type: apiKey
      name: X-Merchant-ID
      in: header
      description: >-
        **Merchant Identifier** - The unique ID for the merchant account. This
        is required for PSP (Payment Service Provider) merchants who manage
        multiple merchant accounts. You can find merchant IDs in the Merchant
        Management section of the dashboard.
      x-displayName: Merchant ID
      x-example: your-merchant-id

````