# Paytabs

## Connecting PayTabs to Mavibot

To connect PayTabs with Mavibot, you need to configure several settings in your PayTabs account.

### 1. Create an API Key

In your PayTabs dashboard, go to:

**Developers → API Keys**

Create a new API key.

<div data-with-frame="true"><img src="/files/Vtr0xdkQDURCqJkDgxwe" alt=""></div>

<div data-with-frame="true"><img src="/files/vCljmIxBCJnZNmKp6sLL" alt=""></div>

After creating the API key, save the following details:

* **Server Key** — required for setting up the integration.
* **Profile ID** — also required for the connection setup.

<div data-with-frame="true"><img src="/files/dWv8LTtFn05LO2cSpBQp" alt="" height="252" width="794"></div>

### 2. Configure Payment Notifications

Go to:

**Developers → Configuration**

<div data-with-frame="true"><img src="/files/q074yPdsBw7eTNkxj6jI" alt="" height="414" width="750"></div>

Enable payment notifications (**callbacks**).

Click **"+"** and add the following callback URL:

```
https://chatter.mavibot.ai/paytabs_callback/result
```

<div data-with-frame="true"><img src="/files/felby58JO1O4a4ZRyZ6T" alt="" height="322" width="822"></div>

<div data-with-frame="true"><img src="/files/Pa1h0GbwJ7gJx9jFaVYx" alt="" height="368" width="835"></div>

This URL is used to send payment status updates to Mavibot.

### 3. Configure PayTabs in Mavibot

<div data-with-frame="true"><figure><img src="/files/OsDhpY8DV4dELGV7mTAt" alt=""><figcaption></figcaption></figure></div>

In the Mavibot settings:

1. Go to the **Acquiring** section
2. Select **PayTabs** as the payment provider
3. Enter the following details:
   * **Profile ID**
   * **Server Key**
4. Select your **PayTabs account region**

{% hint style="info" %}
**Please note!**\
The selected region must match the region where your PayTabs account is registered.
{% endhint %}

<div data-with-frame="true"><figure><img src="/files/awwXkgozm36UoLU1zTYQ" alt="" width="563"><figcaption></figcaption></figure></div>

Once the settings are saved, the integration setup will be completed.

### Generating a Payment Link

To generate a payment link, use the following function:

`get_paytabs_payment_url(amount, description, currency, customer_email, customer_phone,    full_name, language)`

#### Function Parameters

| Parameter                                        | Description                                      |
| ------------------------------------------------ | ------------------------------------------------ |
| <mark style="color:$danger;">**!**</mark> amount | Payment amount. Required parameter               |
| description                                      | Payment description. Optional parameter          |
| currency                                         | Payment currency. Optional parameter             |
| customer\_email                                  | Customer email address. Optional parameter       |
| customer\_phone                                  | Customer phone number. Optional parameter        |
| full\_name                                       | Customer full name. Optional parameter           |
| language                                         | Language of the payment page. Optional parameter |

#### Available Currencies

The following currency codes are supported:

```
SAR, AED, BHD, EGP, EUR, GBP, HKD, IDR,INR, IQD, JOD, JPY, KWD, MAD, OMR,PKR, QAR, USD
```

#### Available Languages

```
en — Englishar — Arabicfr — French
```

The function returns a payment URL.

If the **currency** parameter is not provided, the currency will be automatically selected based on the configured region.

### Using the Payment Link in a Button

To send a payment button to a customer:

1. Create a button with the **Payment** type
2. Select **PayTabs** as the payment provider
3. Specify:
   * payment description;
   * payment amount;
   * currency.

<div data-with-frame="true"><img src="/files/EKnICVffLxkxL317uZNF" alt="" width="554"></div>

***

## Payment Status Handling

After the customer opens the payment link and completes the payment, a callback event will be sent to the conversation.

### Successful Payment

<div data-with-frame="true"><figure><img src="/files/Eqy186xhk06WK2LNs4Rb" alt="" width="357"><figcaption></figcaption></figure></div>

Example:

```
SDJ91MTKTT_success 100
```

Where:

* **SDJ91MTKTT** — the first 10 characters of the **Server Key**
* **100** — the payment amount

To create an action for a successful payment, go to **Builder** and create a block with a trigger (this can be a **Start** block or a **Trigger** block).

Then, in the **Trigger** field, enter:

* the full callback value (if you want to trigger the action only for a specific payment amount), or
* only the callback value before the payment amount (if you want to trigger the action for all successful payments).

<div data-with-frame="true"><figure><img src="/files/Dds4sk4J3h8ZT01DRnw5" alt=""><figcaption><p>The "Start" block</p></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="/files/BUDzkHWwhBe7BIJK39zS" alt=""><figcaption><p>The "Trigger" block</p></figcaption></figure></div>

### Failed Payment

Example:

```
SDJ91MTKTT_fail 100
```

Failed payment handling is configured in the same way as successful payment handling.

Create a block with a trigger and enter the callback value in the **Trigger** field. This allows you to define actions that will be executed when a payment fails.

### Variables Saved After a Successful Payment

After a successful payment, the following variables are automatically saved for the customer:

**paytabs\_callback\_data**\
Contains the full webhook payload received from the payment system.

**paytabs\_payment\_completed**

Value:

```
True
```

Indicates that the payment has been successfully completed.


---

# 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.mavibot.ai/integrations/payment/paytabs.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.
