---
description: Learn how to set up and use multiple PGs.
---

# Integrating Multiple PGs

### Set up multiple PGs in the i'mport **Admin console** and open a payment window for the desired payment method.

### 1. Configure authenticated payment (general)

Go to [**i'mport Admin Console > System Settings > PG Settings tab > Default PG tab**](https://admin.iamport.kr/settings#tab_pg) to set the `default PG` that is used as the default `param.pg` value when you call [`IMP.request_pay`](https://docs.iamport.kr/en-US/sdk/javascript-sdk#request_pay) to open the payment window. The default value is used when the `pg` value is missing or invalid.

![Configure authenticated payment (general)](https://2814812280-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhTv8JEzyM5h4cYcL5StH%2Fuploads%2FymxORuero3pFkGi5nIqd%2Fimage.png?alt=media\&token=378dc566-dc8b-46f1-ab99-c7c0733b1bfd)

### 2. Add PG for subscription payment (for non-authenticated/**PG payment window)**

After acquiring a separate Merchant ID (MID) for subscription (non-authenticated) payment from the PG, use it to add the PG from the [**i'mport Admin Console > System Settings > PG Settings (general/subscription) tab**](https://admin.iamport.kr/settings#tab_pg).

![Add new PG page](https://2814812280-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhTv8JEzyM5h4cYcL5StH%2Fuploads%2F1llxJ7qxv5sAM2SQMoGl%2Fimage.png?alt=media\&token=f46e269a-46ff-4d00-b1bc-c826f7daa144)

### 3. **Add PG for simple payment (Kakao Pay)**

Repeat step 2 to add PG setting for Kakao Pay.

![Add simple payment Kakao Pay](https://2814812280-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhTv8JEzyM5h4cYcL5StH%2Fuploads%2F9AL6Apda1xxecz1jogfP%2Fimage.png?alt=media\&token=89d0d255-419b-413c-90a8-d575512c3e4e)

## Open PG's payment window <a href="#pg" id="pg"></a>

To open a PG's payment window, call [**JavaScript SDK**](../sdk/javascript-sdk) `IMP.request_pay` by specifying the PG that is already configured in **Admin console** in the `param.pg` property.&#x20;

The [`pg` value](https://docs.iamport.kr/en-US/sdk/javascript-sdk#request_pay) can have the following format:

* **`{ PG code }`**
* **`{ PG code }.{ PG Merchant ID }`**

&#x20;Assume that we have added **3 PG settings** as follows:

| PG              | Merchant ID       | Pay Type         | Default PG |
| --------------- | ----------------- | ---------------- | ---------- |
| **`KG INICIS`** | `MID-a` (example) | **General**      | O          |
| **`KG INICIS`** | `MID-b` (example) | **Subscription** | X          |
| `Kakao Pay`     | `MID-c` (example) | Simple           | X          |

Of the previously added PG settings, `Kakao Pay` can be identified just with the `PG service code`. Set **`kakaopay`** in the `pg` property for the Kakao Pay payment request as follows:

{% code title="client-side" %}
```javascript
 IMP.request_pay({
    pg : "kakaopay",  //Open Kakao Pay payment page
    amount : 1000,
    name : "Sample order",
    buyer_name : "Buyer",
    buyer_email : "buyer@iamport.kr"
  });
```
{% endcode %}

Of the previously added PG settings, **`KG INICIS (general)`** and **`KG INICIS (subscription)`** have the <mark style="color:red;">**same PG service code**</mark>. Hence, you need to set `pg` to a value that combines the service code with the Merchant ID, **`{ PG Code }.{ PG Merchant ID }`**.

{% tabs %}
{% tab title="KG Inicis general payment window call" %}
{% code title="JavaScript" %}
```javascript
IMP.request_pay({
    pg : "html5_inicis.MID-a",  // Call KG INICIS general payment window (merchant ID: MID-a)
    amount : 1000,
    name : "Sample order",
    buyer_name : "Buyer",
    buyer_email : "buyer@iamport.kr"
  });
```
{% endcode %}
{% endtab %}

{% tab title="KG Inicis subscription payment window call" %}
{% code title="JavaScript" %}
```javascript
IMP.request_pay({
    pg : "html5_inicis.MID-b",  // Call KG INICIS subscription payment window (merchant ID: MID-b)
    amount : 1000,
    name : "Sample order",
    buyer_name : "Buyer",
    buyer_email : "buyer@iamport.kr"
  });
```
{% endcode %}
{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Matching priority for PG**

[`IMP.request_pay`](https://docs.iamport.kr/en-US/sdk/javascript-sdk#request_pay) finds the setting that matches the `pg` value in the order the PG settings are shown in the **Admin console**. It opens the payment window for the first matching PG setting.
{% endhint %}
