# How to integrate Proxpay

[Proxpay](https://www.proxpay.co/auth/login) can be connected to B2CORE through [PSS](https://docs.b2core.b2broker.com/integrations/payment-systems#payment-system-service-pss). It supports deposits via QR codes and withdrawals to bank accounts, processed in `THB`.

Follow the instructions below to configure the Proxpay connections 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 Proxpay.

{% hint style="info" %}
Before proceeding with the instructions, you must have signed up for Proxpay and have an active account.
{% endhint %}

## Configure connections to Proxpay

If you plan to use Proxpay for both deposits and withdrawals, you must configure two separate connections: one for deposits and another for withdrawals.

To configure a connection to Proxpay:

{% 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_Proxpay` or `Withdrawals_Proxpay`).
* 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 **Proxpay**.
{% endstep %}

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

#### For deposits:

* In the **API base URL** field, specify:
  * `https://api.proxpay.co` — for the production environment
  * `https://stg-api.proxpay.co` — for the sandbox testing environment
* In the **API key** field, enter the API key provided by Proxpay to authenticate requests.
* In the **Username** and **Password** fields, specify the credentials associated with your Merchant ID.
* In the **API start base URL** field, specify `https://payment.thehabito.com`. This URL is only intended for the production environment and isn't available for the testing environment.
* In the **Start token** field, enter the token used to initiate API sessions with Proxpay.
* In the **Merchant ID** field, specify your Merchant ID assigned by Proxpay.
* In the **Proxpay merchant ID** filed, specify the unique merchant identifier used for QR code deposits.

#### For withdrawals:

* In the **API base URL** field, specify:
  * `https://api.proxpay.co` — for the production environment
  * `https://stg-api.proxpay.co` — for the sandbox testing environment
* In the **API key** field, enter the API key provided by Proxpay to authenticate requests.
* In the **Username** and **Password** fields, specify the credentials associated with your Merchant ID.
* In the **Merchant ID** field, specify your Merchant ID assigned by Proxpay.

{% hint style="info" %}
You need to request all the credentials required for configuring connections from the Proxpay support.
{% endhint %}
{% endstep %}

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

The **Proxpay** 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 to support both deposits and withdrawals via Proxpay, follow the same instruction to create a new connection for the other operation.

## Add a deposit method through Proxpay

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

{% 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. Deposits through Proxpay will be available to accounts denominated in the selected currencies. For these currencies, conversion rates for `THB` must be configured.
* In the **Driver** dropdown, select **Proxpay**.
* In the **Connection** dropdown, select the previously configured [Proxpay connection for deposits](#configure-connections-to-proxpay).
  {% endstep %}

{% step %}
In the **Configuration** section, enter the value for the **Product detail** field as provided by the Proxpay support.
{% endstep %}

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

The **Proxpay** 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 the URL of an image that will be displayed as the icon for the deposit method in the B2CORE UI.
* 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 `THB`.
* 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-f6b477d19e61356c6fdc80213efc6896da402537%2Fproxpay-deposit-method-details.png?alt=media" alt="Proxpay deposit method — Settings tab"><figcaption><p>Proxpay 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 **Proxpay** deposit method is now configured in the B2CORE Back Office.

## Add a withdrawal method through Proxpay

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

{% 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 Proxpay will be available from accounts denominated in the selected currencies. For these currencies, conversion rates for `THB` must be configured.
* In the **Driver** dropdown, select **Proxpay**.
* In the **Connection** dropdown, select the previously configured [Proxpay connection for withdrawals](#configure-connections-to-proxpay).
  {% endstep %}

{% step %}
Skip the **Configuration** section, as no settings are required for the Proxpay withdrawal method.
{% endstep %}

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

The **Proxpay** 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 the URL of an image that will be displayed as the icon for the withdrawal method in the B2CORE UI.
* 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 `THB`.
* 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-cbc15d1157b89c454a75cb96655f7b02c5ddb6fe%2Fproxpay-withdrawal-method-details.png?alt=media" alt="Proxpay withdrawal method — Settings tab"><figcaption><p>Proxpay 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 **Proxpay** withdrawal method is now configured in the B2CORE Back Office.

## Set up webhooks in Proxpay

To receive status updates for deposits and withdrawals in B2CORE, notification webhooks must be set up on the side of Proxpay.

### Copy webhook URLs from the B2CORE Back Office

You will need separate webhook URLs for both deposit and withdrawal methods.

{% stepper %}
{% step %}
In the B2CORE Back Office, navigate to:

* **System** > **Deposit system** > **Deposit methods**
* **System** > **Payout system** > **Payout methods**
  {% endstep %}

{% step %}
Find the configured Proxpay deposit or withdrawal method and click **Edit** to open its details.
{% endstep %}

{% step %}
Go to the **Webhooks** tab.
{% endstep %}

{% step %}
Copy the URL displayed in the **Notification URL** field.
{% endstep %}
{% endstepper %}

### Provide URLs to Proxpay

Send the copied webhook URLs (for both deposits and withdrawals) to the Proxpay support for configuration on their side.
