# Tabby Payment Extension

## <mark style="color:red;">**Extension Installation**</mark>

### **Preliminary Works**

The following information is requested from the provider for the brand-specific and production (live) environment.

* **TABBY\_URL**
* **TABBY\_PUBLIC\_KEY**
* **TABBY\_SECRET\_KEY**
* **TABBY\_MERCHANT\_CODES**

A secret\_key is generated with a minimum length of 41 characters. The generated key must be kept throughout the installation. An example command line to generate a random key:

```
openssl rand -base64 41
```

A hash\_key must also be generated with a minimum length of 32 characters. The generated key must be kept throughout the installation.

### **Payment Package**

In order for the Tabby Payment Extension to be installed, the Payment Package installation must be completed.

### **Environment Variables**

The extension installed to the relevant project in ACC must have the following environment variables. Environment variables can be entered before or after the deployment phase. As changes are made to the environment variables, the deployment process must be performed again.

<table><thead><tr><th width="283.05078125">Variable</th><th>Description</th></tr></thead><tbody><tr><td>Extension-specific</td><td></td></tr><tr><td>TABBY_URL</td><td>URL received during the preliminary works phase (without a trailing slash at the end)</td></tr><tr><td>TABBY_PUBLIC_KEY</td><td>Public Key received during the preliminary works phase</td></tr><tr><td>TABBY_SECRET_KEY</td><td>Secret Key received during the preliminary works phase</td></tr><tr><td>TABBY_MERCHANT_CODES</td><td>Each currency to be used requires a merchant code. Example: <em>TABBY_MERCHANT_CODES={"AED":"rnb_ae_aed","SAR":"rnb_sa_sar"}</em></td></tr><tr><td>WEBHOOK_URL</td><td><em>https://{SHOP_URL}/orders/hooks/payment</em></td></tr><tr><td>WEBHOOK_USERNAME</td><td>Webhook username</td></tr><tr><td>WEBHOOK_PASSWORD</td><td>Webhook password</td></tr><tr><td>Generic</td><td></td></tr><tr><td>SECRET_KEY</td><td>The generated secret key during the preliminary works phase</td></tr><tr><td>HASH_KEY</td><td>The generated hash key during the preliminary works phase</td></tr><tr><td>ADMIN_EMAIL</td><td>The e-mail address of the installer can be entered</td></tr><tr><td>ADMIN_PASSWORD</td><td>A newly created and extension-specific strong password</td></tr><tr><td>ADMIN_USERNAME</td><td>A username can be entered (example: ‘akinon’)</td></tr></tbody></table>

## <mark style="color:red;">**Omnitron Settings**</mark>

The installed extension must also be defined to the project via Omnitron. This can be done on the Payment Options & Add/Edit POS Integration pages. After the settings are completed, it will be accessible under a new tab on the payment screen as it is a redirection type payment integration.

### **Payment Options**

One payment option must be defined in Omnitron to be specific for the extension installed. Explanations on how the settings should be made at this stage are in the table below.

Note: Do not set more than one active payment option with the type “masterpass” or “credit card”.

<table><thead><tr><th width="269.57421875">Field</th><th>Description</th></tr></thead><tbody><tr><td>Payment Option</td><td>Redirect to bank</td></tr><tr><td>Payment Option Name</td><td>Tabby</td></tr><tr><td>Payment Option Slug</td><td>tabby</td></tr><tr><td>Config*</td><td>{"pos_slug":"tabby"}</td></tr></tbody></table>

\* Fields other than pos\_slug should be determined according to the requirements.

### **POS Integration**

One POS integration must be defined in Omnitron to be specific for the extension installed. Explanations on how the settings should be made at this stage are in the table below.

<table><thead><tr><th width="173.30078125">Field</th><th>Description</th></tr></thead><tbody><tr><td>Name</td><td>Tabby</td></tr><tr><td>Slug</td><td>tabby</td></tr><tr><td>Gateway</td><td>Extension</td></tr><tr><td>Resource URL</td><td>EXTENSION URL</td></tr><tr><td>Username</td><td>ADMIN_USERNAME value in environment variables</td></tr><tr><td>Password</td><td>ADMIN_PASSWORD value in environment variables</td></tr><tr><td>Hash Key</td><td>Random hash key</td></tr><tr><td>Payment Type</td><td>AUTH</td></tr></tbody></table>

## <mark style="color:red;">**Webhook**</mark>

Webhook registration should occur after the extension is created.

[Webhook API Docs](https://api-docs.tabby.ai/#operation/postWebhook)

An example request is provided below for creating a webhook:

```
curl --location --request POST 'https://api.tabby.ai/api/v1/webhooks' \
--header 'X-Merchant-Code: {MERCHANT_CODE}' \
--header 'Authorization: Bearer {TABBY_SECRET_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "url": "{EXTENSION_URL}/webhook/",
    "is_test": true,
    "header": {
        "title": "Authorization",
        "value": "Basic base64({WEBHOOK_USERNAME}:{WEBHOOK_PASSWORD})"
    }
}'
```

## <mark style="color:red;">**Additional Notes**</mark>

Useful links:

* [Tabby Docs](https://docs.tabby.ai/)
* [Tabby API Reference](https://api-docs.tabby.ai/)
