# PayU

## How PayU Integration works:

1. When a user makes a purchase through bot, a payment link is sent to the user via SMS and via ongoing bot conversation.
2. The user can click on the payment link and make the payment on the PayU Payment Gateway.
3. Once the payment is received, LimeChat receives the payment confirmation via webhook, and the order is completed, and the user is notified of the successful transaction.

## Finding credentials on the PayU dashboard

To set up PayU Payment Gateway on your LimeChat account, you will need to provide your `Merchant ID`, `Client ID`, and `Client Secret`, which can be found on your PayU Dashboard. Follow these steps:

1. Log in to your PayU account and navigate to the profile from top-right corner.

<figure><img src="https://303644337-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbTdWohNbJyoGc4vPpxk1%2Fuploads%2F8NtcgZW2XU46WoM36Emr%2Fimage.png?alt=media&#x26;token=7f639a33-21a1-4315-b2b5-c88ce80a0e0a" alt="" width="563"><figcaption></figcaption></figure>

2. Find your `Merchant ID` on top right side.

<figure><img src="https://303644337-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbTdWohNbJyoGc4vPpxk1%2Fuploads%2FJm1lCLzCQynFZpwYm3qE%2Fimage.png?alt=media&#x26;token=1819c03a-b19e-42a9-9bf8-e7d1e34e319d" alt="" width="563"><figcaption></figcaption></figure>

3. Go to the Payment Gateway tab, scroll down to **Client ID & Client Secret Details** and click on **Get Client Details** button to generate your `Client ID` and `Client Secret.`

<figure><img src="https://303644337-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbTdWohNbJyoGc4vPpxk1%2Fuploads%2FQVwAfatoTbYMXhOT7zAb%2Fimage.png?alt=media&#x26;token=7b67ae2b-514a-4d2a-bf89-c94a2e4d90d4" alt="" width="563"><figcaption></figcaption></figure>

4. You will be prompted for account password. Enter the password and click **Proceed**. Client ID and Client Secret details will be generated for you. Copy the details (`Client Id` and `Client Secret`) and share them with the LimeChat Customer Success Manager.

<figure><img src="https://303644337-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbTdWohNbJyoGc4vPpxk1%2Fuploads%2FvQby2q0MoophGmDF4WxT%2Fimage.png?alt=media&#x26;token=8e1c6e5f-d115-4071-a369-e970a99ab583" alt="" width="563"><figcaption></figcaption></figure>

## Setting up webhooks on PayU dashboard

To capture the payment status and complete the order, it is important to configure webhooks on PayU dashboard. Follow these steps:

1. Log in to your PayU account and navigate to the Settings tab from left pane.

<figure><img src="https://303644337-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbTdWohNbJyoGc4vPpxk1%2Fuploads%2Fpmag5axNB4RzXrI0UXyr%2Fimage.png?alt=media&#x26;token=97ad80a6-c806-40b5-ab46-ad7fe693a841" alt="" width="563"><figcaption></figcaption></figure>

2. Go to Webhooks.

<figure><img src="https://303644337-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbTdWohNbJyoGc4vPpxk1%2Fuploads%2Fj2ANhuf1RcwAkAXGiqhx%2Fimage.png?alt=media&#x26;token=dc27bcae-df37-46b9-8600-021dce509126" alt="" width="563"><figcaption></figcaption></figure>

3. Click on Create Webhook. Select Type as "Payments" and Event as "Successful".

<figure><img src="https://303644337-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbTdWohNbJyoGc4vPpxk1%2Fuploads%2FbhEgWzPm5CWmfClaaDhG%2Fimage.png?alt=media&#x26;token=f2493acd-dd61-4be0-9d31-d002e5085e97" alt="" width="563"><figcaption></figcaption></figure>

4. In the Webhook URL field, enter LimeChat webhook URL for PayU: [**`https://limekit.limechat.ai/payment_channels/webhook.handle_payu_payment_link_event`**](https://limekit.limechat.ai/payment_channels/webhook.handle_payu_payment_link_event)
5. Click on Create.

> Note: PayU only allows one webhook per event.&#x20;
>
> If a webhook is already set up for `Successful` `Payments` then you will need to edit the existing webhook and add the LimeChat webhook URL after the existing url separated with a comma.&#x20;
>
> Example: [**https://some-other-webhook.url/handle\_event**](https://some-other-webhook.url/handle_event), [https://limekit.limechat.ai/payment\_channels/webhook.handle\_payu\_payment\_link\_event](https://limekit.limechat.ai/payment_channels/webhook.handle_payu_payment_link_event**%60)

Once you have completed these steps, PayU will send a notification to LimeChat for every successful payment transaction, allowing LimeChat to automatically complete the order.

We hope that this new feature will make it easier for businesses to accept payments and improve the overall user experience. If you have any questions or concerns, please feel free to reach out to our Customer Support team.
