# UPI

UPI (Unified Payments Interface) is an Indian instant payment system and protocol developed by the National Payments Corporation of India (NPCI) in 2016. It allows users to link their bank accounts to a mobile application and make online transactions seamlessly

## **Features**

| Processing currencies      | INR          |
| -------------------------- | ------------ |
| Settlement currencies      | INR          |
| Minimum transaction amount | 100.00 INR   |
| Maximum transaction amount | 50000.00 INR |
| Refunds                    | ❌            |
| Partial Refunds            | ❌            |
| Multiple partial refund    | ❌            |
| Chargeback                 | ❌            |

# **Integration Method**

**Payment method enumeration values:** **`upi`**

**There is integration method for UPI**

1. Direct API

## **Direct** **API** 

### Payment flow

![pic_2.png](https://api.apifox.com/api/v1/projects/1296482/resources/507924/image-preview)

### **How to integration**

For direct API integration, you can create a PaymentIntent and get url in only one step. The following is the demo of creating payment intent:

**Create a PaymentIntent**

A PaymentIntent is an object that represents your intent to collect payment from your customer and tracks the lifecycle of the payment process. Create a PaymentIntent on your server and specify the amount to collect and a supported currency. If you have an existing Payment Intents integration, add **`upi`** the list of payment method types.

***Request***  Create a PaymentIntent

```JSON
{
    "amount":10000,
    "currency":"INR",
    "confirm":true,
    "payment_method_data" : {
        "type":"upi",
         "billing_details":{
            "email":"kutum@gmail.com"
        }
    },
    "payment_method_options":{
        "upi":{
            "app_type":"phonepe" //googlepay、phonepe、other、phonepe,paytm
        }
    },
    "return_url":"https://yourwebsite.com"
}
```
When `app_type` is set to "other", the supported other apps can refer to: https://www.npci.org.in/what-we-do/upi/3rd-party-apps

***Response***

```JSON
{
    "id": "pi_1853358041907331072",
    "object": "payment_intent",
    "created": 1730709966000,
    "livemode": false,
    "currency": "INR",
    "amount": 10000,
    "status": "requires_action",
    "client_secret": "pi_1853358041907331072_secret_0H7fzK0uw8IGjA7M76qrmttp",
    "next_action": {
        "type": "redirect_to_url",
        "redirect_to_url": {
            "url": "https://XXXXXXXXXXXXXXXXx"
        }
    },
    "payment_method_types": [
        "upi"
    ],
    "confirmation_method": "automatic",
    "return_url": "https://yourwebsite.com",
    "payment_method": "pm_1853358041785696256",
    "capture_method": "automatic"
}
```

## **Checkout**

### Payment flow

1. Customer selects UPI from the list of payment methods available and clicks on the Pay botton


![88c5e2b2-b9a4-430f-8f9e-39af144c30fe.png](https://api.apifox.com/api/v1/projects/1296482/resources/475117/image-preview)

1. Customers will be redirected to UPI's page, and approve the payment


![c9421633-ebde-4c01-bbae-6891becd1408.png](https://api.apifox.com/api/v1/projects/1296482/resources/475113/image-preview)


### [Create a Session](api-42654181)

***Request*** 

```JSON
{
    "cancel_url": "www.wooshpay.com",
    "mode": "payment",
    "success_url": "https://wooshpay.com/",
    "payment_method_types": [
        "upi"
    ],
    "line_items": [
        {
            "price_data": {
                "currency": "INR",
                "unit_amount": 20000,
                "nickname": "apple",
                "product_data": {
                    "name": "apple",
                    "description": "very delicious"
                }
            },
            "quantity": 1
        }
    ]
}
```

***Response***

```JSON
{
    "id": "cs_1745349377481768960",
    "object": "checkout.session",
    "created": 1704958693000,
    "livemode": false,
    "currency": "INR",
    "customer": "",
    "mode": "payment",
    "status": "open",
    "url": "https://checkouttest.wooshpay.com/pay/cs_test_1745349377481768960?key=cGtfdGVzdF9OVEUyTlRjNU5ESXpNalUxTXpNME56ZzVNVE14T2pNemIxTTJhVVZrTmtOdmFsWlBSRTFuVFc1SVREaFljREUyT0RReE1Ua3lNamd6TVRR",
    "cancel_url": "www.wooshpay.com",
    "line_items": {
        "object": "list",
        "data": [
            {
                "id": "li_1745349377502740480",
                "object": "item",
                "currency": "INR",
                "description": "apple",
                "price": {
                    "id": "price_1745349377511129088",
                    "object": "price",
                    "created": 1704958693000,
                    "livemode": false,
                    "active": false,
                    "currency": "INR",
                    "nickname": "apple",
                    "product": "prod_1745349377519517696",
                    "type": "one_time",
                    "unit_amount": 20000
                },
                "quantity": 1,
                "amount_subtotal": 20000,
                "amount_total": 20000
            }
        ]
    },
    "payment_intent": "pi_1745349382124863488",
    "payment_method_types": [
        "upi"
    ],
    "payment_status": "unpaid",
    "success_url": "https://wooshpay.com/",
    "amount_subtotal": 20000,
    "amount_total": 20000,
    "billing_address_collection": "auto",
    "expires_at": 1705045093276,
    "payment_link": "",
    "client_secret": "pi_1745349382124863488_secret_4zzY2IQsRmMx9b2Vyk5TgHmF"
}
```

# **Next step**

You can add more features to your integration as needed

## Webhook

Listen to events on your WooshPay account so your integration can automatically trigger reactions. Create a webhook that mainly focuses on enabled_events and url.
