# How to integrate KoraPay

[KoraPay](https://www.korahq.com/payin) can be connected to B2CORE through [PSS](https://docs.b2core.b2broker.com/integrations/payment-systems#payment-system-service-pss), with support for deposits, withdrawals to bank accounts, and withdrawals to to mobile wallets via mobile money.

Follow the instructions below to configure the KoraPay connection and set up the deposit and withdrawal methods in the B2CORE Back Office. These instructions correspond to the [General procedure](https://docs.b2core.b2broker.com/how-to-articles/manage-payment-methods/how-to-add-deposit-and-withdrawal-methods-through-pss) for adding methods for PSS-supported payment systems, but include details specific to KoraPay.

{% hint style="info" %}
Before proceeding with the instructions, you must have signed up for KoraPay and have an active account. You can consult the official [KoraPay documentation](https://developers.korapay.com/) or contact their support in case you have any questions.
{% endhint %}

## Supported currencies

Below is the table listing the currencies supported for deposits and withdrawals via KoraPay:

| Alpha code | Name                      | Supported for deposits              | Supported for withdrawals (bank accounts)                            | Supported for withdrawals (mobile wallets via mobile money) |
| ---------- | ------------------------- | ----------------------------------- | -------------------------------------------------------------------- | ----------------------------------------------------------- |
| NGN        | Nigerian naira            | <mark style="color:green;">✔</mark> | <mark style="color:green;">✔</mark> (to Nigerian bank accounts only) | <mark style="color:red;">✘</mark>                           |
| GHS        | Ghanaian cedi             | <mark style="color:green;">✔</mark> | <mark style="color:green;">✔</mark> (to Nigerian bank accounts only) | <mark style="color:green;">✔</mark>                         |
| KES        | Kenyan shilling           | <mark style="color:green;">✔</mark> | <mark style="color:green;">✔</mark> (to Nigerian bank accounts only) | <mark style="color:green;">✔</mark>                         |
| XAF        | Central African CFA franc | <mark style="color:green;">✔</mark> | <mark style="color:red;">✘</mark>                                    | <mark style="color:green;">✔</mark>                         |
| XOF        | West African CFA franc    | <mark style="color:green;">✔</mark> | <mark style="color:red;">✘</mark>                                    | <mark style="color:green;">✔</mark>                         |

{% hint style="info" %}
For `XAF` and `XOF` currencies, amounts are rounded down to the nearest multiple of 5, as required by KoraPay. For example, if a client enters 2,573 `XAF`, it will be rounded down to 2,570 for the transaction.
{% endhint %}

## Configure connections to KoraPay

If you plan to use KoraPay for both deposits and withdrawals, you must configure separate connections, each dedicated to a specific deposit or withdrawal method.

Each connection must be configured with the appropriate driver to ensure the correct operation of the respective deposit or withdrawal method.

To configure a connection to KoraPay:

{% stepper %}
{% step %}
In the B2CORE Back Office, navigate to **System** > **External connections**.
{% endstep %}

{% step %}
Click **+Create** in the upper-right page corner.
{% endstep %}

{% step %}
On the **Create connection** page, fill in the following fields:

* In the **Name** field, enter a name for the connection. The name must be unique and may only contain Latin letters, numbers, dashes, and underscores (for example, `Deposits_KoraPay` or `Withdrawals_KoraPay`).
* In the **Caption** field, enter a caption that will be applied to the connection in the Back Office.
* In the **Provider** dropdown, select:
  * **PaymentSystemDeposit** — to add a connection that will be used for a deposit method.
  * **PaymentSystemWithdrawal** — to add a connection that will be used for a withdrawal method.
    {% endstep %}

{% step %}
In the **Driver** dropdown that appears, select:

* **KoraPay** — for deposits.
* **KoraPay bank account** — for withdrawals to bank accounts.
* **KoraPay mobile money** — for withdrawals to mobile wallets via mobile money.
  {% endstep %}

{% step %}
In the **Credentials** section that appears, configure the KoraPay-specific settings:

* In the **API base URL** field, specify `https://api.korapay.com`.
* In the **Secret key** field, enter the secret key from your KoraPay account.
* In the **Public key** field, enter the public key from your KoraPay account.

To find both your secret and public keys, sign in to your KoraPay account, navigate to **Settings**, and open the **API Configuration** tab.

<figure><img src="https://514898401-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGoRxAprhHu1goANW7FXt%2Fuploads%2Fgit-blob-000ae8b972861c2971a9e290ba34b549afb37412%2Fkorapay-api-keys.png?alt=media" alt="API keys in KoraPay"><figcaption><p>API keys in KoraPay</p></figcaption></figure>
{% endstep %}

{% step %}
Click **Save** to create the connection.

The **KoraPay** connection will appear in the list of external connections.
{% endstep %}

{% step %}
Check the connection status.

If the connection is inactive (**No** is displayed in the **Enabled** column), click the **Edit** button to open the connection details and set the **Enabled** dropdown to **Yes**.
{% endstep %}

{% step %}
Click **Save** to apply the changes.
{% endstep %}
{% endstepper %}

If you need additional KoraPay connections for other payment methods, follow the same instruction to create a new connection with a different driver.

## Add a deposit method through KoraPay

To add and set up a method for making deposits through KoraPay:

{% stepper %}
{% step %}
In the B2CORE Back Office, navigate to **System** > **Deposit system** > **Deposit methods**.
{% endstep %}

{% step %}
Click **+Create** in the upper-right page corner.
{% endstep %}

{% step %}
On the **Create a deposit method** page, fill in the following fields:

* In the **Name** field, enter a name for the method. The name must be unique and may only contain Latin letters, numbers, dashes, and underscores.
* In the **Caption** field, enter a caption for the method. This caption will be assigned to the method in the Back Office and will be visible to clients in the B2CORE UI.
* In the **Provider** dropdown, select **PaymentSystemDeposit**.
  {% endstep %}

{% step %}
After selecting **PaymentSystemDeposit**, the following fields appear:

* In the **Available account currencies** dropdown, select one or more currencies that are supported for deposits, such as `NGN`, `GHS`, `KES`, `XAF`, and `XOF`. Deposits through KoraPay will be available to accounts denominated in the selected currencies.
* In the **Driver** dropdown, select **KoraPay**.
* In the **Connection** dropdown, select the previously configured [KoraPay connection for deposits](#configure-connections-to-korapay).
  {% endstep %}

{% step %}
In the **Configuration** section, set the **Merchant bears cost** option to:

* **Yes** — the broker (merchant) pays the transaction fee.
* **No** — the trader (client) pays the transaction fee.
  {% endstep %}

{% step %}
Click **Save** to create the deposit method.

The **KoraPay** deposit method will appear in the list of deposit methods.
{% endstep %}

{% step %}
Click **Edit** to enter the method details and complete the following fields:

* On the **Settings** tab, use the **Group** dropdown to select one or more groups where the method should be included.
* In the **Icon** field, specify `paymethod-korapay` to display the [predefined icon](https://docs.b2core.b2broker.com/integrations/payment-systems) for the KoraPay deposit method in the B2CORE UI. To use a custom icon, specify the URL of the image to be displayed.
* Check the method status.

  If the method is inactive (**No** is displayed in the **Enabled** field), activate it by setting the **Enabled** dropdown to **Yes**.
* On the **PS Currencies** tab, add the needed currencies. To enable the method to process deposits in a specific currency, ensure it is added on this tab.
* If needed, configure commissions for the method on the **Commissions** tab (for details, refer to [How to configure commissions for deposit and withdrawal methods](https://docs.b2core.b2broker.com/how-to-articles/manage-payment-methods/how-to-configure-commissions-for-deposit-and-withdrawal-methods)).

<figure><img src="https://514898401-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGoRxAprhHu1goANW7FXt%2Fuploads%2Fgit-blob-07cef3011c0373273f813a7bda1d7548723064e8%2Fkorapay-deposit-method-details.png?alt=media" alt="KoraPay deposit method — Settings tab"><figcaption><p>KoraPay deposit method — Settings tab</p></figcaption></figure>
{% endstep %}

{% step %}
Click **Test configuration** to validate the connection settings of the deposit method.

The test result will be displayed on the page.
{% endstep %}

{% step %}
After successfully validating the configuration, click **Save**.
{% endstep %}
{% endstepper %}

The **KoraPay** deposit method is now configured in the B2CORE Back Office.

## Add a withdrawal method through KoraPay

To add and set up a method for making withdrawals through KoraPay:

{% stepper %}
{% step %}
In the B2CORE Back Office, navigate to **System** > **Payout system** > **Payout methods**.
{% endstep %}

{% step %}
Click **+Create** in the upper-right page corner.
{% endstep %}

{% step %}
On the **Create a payout method** page, fill in the following fields:

* In the **Name** field, enter a name for the method. The name must be unique and may only contain Latin letters, numbers, dashes, and underscores.
* In the **Caption** field, enter a caption for the method. This caption will be assigned to the method in the Back Office and will be visible to clients in the B2CORE UI.
* In the **Provider** dropdown, select **PaymentSystemWithdrawal**.
  {% endstep %}

{% step %}
After selecting **PaymentSystemWithdrawal**, the following fields appear:

* In the **Available account currencies** dropdown, select one or more currencies. Withdrawals through KoraPay will be available from accounts denominated in the selected currencies.
* In the **Driver** dropdown, select:
  * **KoraPay bank account** — for withdrawals to bank accounts.

    Only withdrawals to Nigerian bank accounts are supported.
  * **KoraPay mobile money** — for withdrawals to mobile wallets via mobile money.

    Withdrawals are supported for Kenyan (KES), Ghanaian (GHS), Ivorian (XOF), and Cameroonian (XAF) mobile money accounts.
* In the **Connection** dropdown, select the previously configured [KoraPay connection for withdrawals](#configure-connections-to-korapay).
  {% endstep %}

{% step %}
In the **Configuration** section, complete the following settings:

For the **KoraPay bank account** driver:

* In the **Merchant bears cost** dropdown, select:
  * **Yes** — the broker (merchant) pays the transaction fee.
  * **No** — the trader (client) pays the transaction fee.

For the **KoraPay mobile money** driver:

* Configure the **Merchant bears cost** option as described above.
* In the **Country** dropdown, select the where this withdrawal method will be available, such as Kenya, Ghana, Côte d’Ivoire, or Cameroon.
  {% endstep %}

{% step %}
Click **Save** to create the withdrawal method.

The **KoraPay** withdrawal method will appear in the list of withdrawal methods.
{% endstep %}

{% step %}
Click **Edit** to enter the method details and complete the following fields:

* On the **Settings** tab, use the **Group** dropdown to select one or more groups where the method should be included.
* In the **Icon** field, specify `paymethod-korapay` to display the [predefined icon](https://docs.b2core.b2broker.com/integrations/payment-systems) for the KoraPay withdrawal method in the B2CORE UI. To use a custom icon, specify the URL of the image to be displayed.

  If the method is inactive (**No** is displayed in the **Enabled** field), activate it by setting the **Enabled** dropdown to **Yes**.
* On the **PS Currencies** tab, add the needed currencies. To enable the method to process withdrawals in a specific currency, ensure it is added on this tab.
* If needed, configure commissions for the method on the **Commissions** tab (for details, refer to [How to configure commissions for deposit and withdrawal methods](https://docs.b2core.b2broker.com/how-to-articles/manage-payment-methods/how-to-configure-commissions-for-deposit-and-withdrawal-methods)).

<figure><img src="https://514898401-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGoRxAprhHu1goANW7FXt%2Fuploads%2Fgit-blob-a16417ffc4e38188ef0db5a682c9f9aad3b7bf2d%2Fkorapay-withdrawal-method-details.png?alt=media" alt="KoraPay withdrawal method — Settings tab"><figcaption><p>KoraPay withdrawal method — Settings tab</p></figcaption></figure>
{% endstep %}

{% step %}
Click **Test configuration** to validate the connection settings of the withdrawal method.

The test result will be displayed on the page.
{% endstep %}

{% step %}
After successfully validating the configuration, click **Save**.
{% endstep %}
{% endstepper %}

The **KoraPay** withdrawal method is now configured in the B2CORE Back Office. To add another withdrawal method via KoraPay using a different driver, follow the same instructions and select the other driver.
