# REST API

## Create Order

<mark style="color:green;">`POST`</mark> `https://public_key:secret_key@api.ippopay.com/v1/order/create`

Use this api to create your order on Ippopay to use it for initiating transaction. You can get your keys from the api dashboard.

#### Request Body

| Name           | Type   | Description                                                                                      |
| -------------- | ------ | ------------------------------------------------------------------------------------------------ |
| notify\_url    | string | Your webhook url                                                                                 |
| amount         | number | The Order amount to be charged in format ##.##                                                   |
| currency       | string | The currency to be charged, Defaults to INR.                                                     |
| payment\_modes | string | Payment modes to be enabled for this order, Defaults to Credit, Debit Cards, Netbanking and UPI. |
| customer       | object | Information of the customer, if not provided will be prompted on payment page.                   |

{% tabs %}
{% tab title="200 " %}

```
{
        "success": true,
        "message": "Order created",
        "data": {
            "order": {
            "merchant": {
                "name": "Demo Merchant",
                "id": "TaodSgGa"
            },
            "customer": {
                "phone": {
                "country_code": "91",
                "national_number": "1234567"
                },
                "name": "Test",
                "email": "test@gmail.com"
            },
            "currency": "INR",
            "paymentModes": "cc,db,nb,upi",
            "status": "created",
            "amount": 100.00,
            "order_id": "order_G@nzg3qBq"           
            }
        }
    }

```

{% endtab %}
{% endtabs %}

```javascript
{
        "amount": 100.00,
        "currency": "INR",
        "payment_modes": "cc,dc,nb,upi",
        "notify_url":"YOUR WEBHOOK URL",
        "customer": {
                "name": "Test",
                "email": "test@gmail.com",
                "phone": {
                        "country_code": "91" ,
                        "national_number": "1234567"
                    }
                }
    }
```

## Get Order Details

<mark style="color:blue;">`GET`</mark> `https://public_key:secret_key@api.ippopay.com/v1/order/ORDER_ID`

Use this API to get your order details.

{% tabs %}
{% tab title="200 " %}

```
{
        "success": true,
        "message": "Order Details",
        "data": {
            "order": {
            "merchant": {
                "name": "Demo Merchant",
                "id": "TaodSgGa"
            },
            "customer": {
                "phone": {
                "country_code": "91",
                "national_number": "1234567"
                },
                "name": "Test",
                "email": "test@gmail.com"
            },
            "currency": "INR",
            "paymentModes": "cc,db,nb,upi",
            "status": "created",
            "amount": 100.00,
            "order_id": "order_G@nzg3qBq"           
            }
        }
    }

```

{% endtab %}
{% endtabs %}

## Get Transaction Details for Order

<mark style="color:blue;">`GET`</mark> `https://public_key:secret_key@api.ippopay.com/v1/order/ORDER_ID/transaction`

Use this API to get your transaction details for the successful order.

{% tabs %}
{% tab title="200 " %}

```
{
    "success":true,
    "message":"Transaction details",
    "data":{
        "transaction":{
            "trans_id":"trans_t2Jca2dVIF",
            "merchant":{
                "name":"Test",
                "id":"MERCHANT_ID"
            },
            "customer":{
                "phone":{
                    "country_code":"+91",
                    "national_number":"9876543210"
                },
                "name":"Test",
                "email":"test@gmail.com"
            },
            "cost":{
                "paid":1,
                "settled":0.98
            },
            "commission":{
                "percentage":1.75,
                "value":0.02,
                "tax":0,
                "total":0.02,
            },
            "tax":{
                "value":0,
                "calculation":"percent"
            },
            "notes":"",
            "is_manual_record":false,
            "manual_recorded_date":"2020-12-08T17:33:11.405Z",
            "is_intl_payment":false,
            "refund_status":"not_requested",
            "status":"success",
            "failure_reason":"",
            "product":"order",
            "settlement_date":"2020-12-10T18:30:00.000Z",
            "gateway":{
                "payment_mode":{
                    "pay_mode":"Debit Card",
                    "pay_mode_id":"dc",
                    "pay_group":"card",
                    "bank_name":"HDFC Bank",
                    "card_number":"405988XXXXXX6908",
                    "card_scheme":"VISA"
                }
            },
            "updatedAt":"2020-12-09T06:59:23.488Z",
            "createdAt":"2020-12-09T06:59:23.488Z",
            "settlement_id":"settl_oVHAVByLh"
        }
    }
}

```

{% endtab %}
{% endtabs %}

## Refund Request

<mark style="color:green;">`POST`</mark> `https://public_key:secret_key@api.ippopay.com/v1/order/refund/YOUR_ORDER_ID`

Use this API to refund for your order on Ippopay.

#### Request Body

| Name        | Type   | Description                                 |
| ----------- | ------ | ------------------------------------------- |
| refund\_amt | number | Pass this parameter to do a partial refund. |

{% tabs %}
{% tab title="200 " %}

```
{
    "success": true,
    "message": "Your refund request accepted"
}

```

{% endtab %}
{% endtabs %}


---

# 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://docs.ippopay.com/server-side-integrations/rest-api.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.
