# Checkout Payment Extension

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

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

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

* **API\_URL**
* **API\_TOKEN**
* **PROCESSING\_CHANNEL\_ID**

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.

Another hash key (WEBHOOK\_HASH\_KEY) must be generated using the same method.

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

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.

| Variable                | Description                                                                                                                                                                                                        |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Extension-specific      |                                                                                                                                                                                                                    |
| API\_URL                | URL received during the preliminary works phase (without a trailing slash at the end)                                                                                                                              |
| API\_TOKEN              | API Token received during the preliminary works phase                                                                                                                                                              |
| PROCESSING\_CHANNEL\_ID | Processing Channel ID received during the preliminary works phase                                                                                                                                                  |
| SOURCE\_TYPE            | The Source Type is used to determine the payment service that the Checkout gateway will utilize. Currently, the only supported value for SOURCE\_TYPE is “knet”, which enables the integration with KNET services. |
| WEBHOOK\_URL            | *https\://{SHOP\_URL}/orders/hooks/payment*                                                                                                                                                                        |
| WEBHOOK\_HASH\_KEY      | The generated Webhook Hash Key during the preliminary works phase                                                                                                                                                  |
| Generic                 |                                                                                                                                                                                                                    |
| SECRET\_KEY             | The generated secret key during the preliminary works phase                                                                                                                                                        |
| HASH\_KEY               | The generated hash key during the preliminary works phase                                                                                                                                                          |
| ADMIN\_EMAIL            | The e-mail address of the installer can be entered                                                                                                                                                                 |
| ADMIN\_PASSWORD         | A newly created and extension-specific strong password                                                                                                                                                             |
| ADMIN\_USERNAME         | A username can be entered (example: ‘akinon’)                                                                                                                                                                      |

## <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.

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

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.

| Field               | Description                         |
| ------------------- | ----------------------------------- |
| Payment Option      | Redirect to bank                    |
| Payment Option Name | Checkout Extension                  |
| Payment Option Slug | checkout\_extension                 |
| Config\*            | {"pos\_slug":"checkout\_extension"} |

{% hint style="info" %}
Fields other than pos\_slug should be determined according to the requirements.
{% endhint %}

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

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.

| Field        | Description                                    |
| ------------ | ---------------------------------------------- |
| Name         | Checkout Extension                             |
| Slug         | checkout\_extension                            |
| Gateway      | Extension                                      |
| Resource URL | EXTENSION URL                                  |
| Username     | ADMIN\_USERNAME value in environment variables |
| Password     | ADMIN\_PASSWORD value in environment variables |
| Hash Key     | Random hash key                                |
| Payment Type | Sale                                           |

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

Webhook registration should occur after the extension is created.

[Webhook API Docs](https://api-reference.checkout.com/#tag/Workflows/paths/~1workflows/post)

[Webhook Docs for KNET via Checkout](https://www.checkout.com/docs/payments/add-payment-methods/knet#Webhooks)

Webhooks can be created, updated and deleted using Checkout Workflows. The extension only supports **`payment_pending`**`, payment_captured` events and webhook actions with **`HMACSHA256`** signature method.

An example request is provided below for creating a webhook:

```
curl --location '{API_URL}/workflows' \
--header 'Authorization: Bearer {API_TOKEN}\
--header 'Content-Type: application/json' \
--data '{
  "name": "Extension Test",
  "active": true,
  "conditions": [
    {
      "type": "event",
      "events": {
        "gateway": [
          "payment_pending",
          "payment_captured"
        ]
      }
    },
    {
      "type": "processing_channel",
      "processing_channels": [
        "{PROCESSING_CHANNEL_ID}"
      ]
    }
  ],
  "actions": [
    {
      "type": "webhook",
      "url": "{EXTENSION_URL}/webhook",
      "signature": {
        "method": "HMACSHA256",
        "key": "{WEBHOOK_HASH_KEY}"
      }
    }
  ]
}'
```

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

Useful links:

* [Checkout Docs](https://www.checkout.com/docs)
* [Checkout via KNET Docs](https://www.checkout.com/docs/payments/add-payment-methods/knet)
* [Checkout API Reference](https://api-reference.checkout.com/)


---

# 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.akinon.com/technical-guides/3rd-party-integration/payment-integrations/checkout-payment-extension.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.
