pg
attributeKakaoPay
or PAYCO
, or use a different PG service for each payment method.
To support this scenario, we will learn how to add multiple PG services in Iamport Admin Dashboard and change pg
attribute of the param
when calling IMP.request_pay
to call the desired payment window based on the situation.
In this guide, we will assume that Inicis
is a default PG
and another Inicis
setting will be added for the recurring payment. KakaoPay
will be also added for the simple payment.default PG
company and additional PG services
to use in Admin Dashboard.default PG
in Default PG
tab in PG Settings
tab. Set the PG service to be used primarily as the default PG. The PG service set as the default PG
is used by default when calling the IMP.request_pay
function of the Iamport JavaScript library.KG Inicis (web standard method)
is set as the default PG service.Default PG service
IMP.request_pay(param, callback)
is called, if the value specified in the pg
attribute of param
is not found, it calls the payment window of the PG that is set as the default PG
. This is the policy of Iamport to prevent loss of sales by setting the default PG
and calling the payment window in any case, because such a situation may occur due to a mistake in the value of the pg
attribute or a programmer’s mistake.
KG Inicis
.
Click Add PG
tab on the left to create a tab where the additional PG can be configured.added PG
tab.KG Inicis (web standard payment window)
is selected as PG
, and the newly issued information was entered: PG merchant ID (MID)
, web standard payment signKey
, and merchantKey for billing.
Next, we will add KakaoPay
, one of the simple payment services, for users’ convenience.
Likewise, click the Add PG
tab on the left and set PG Service
to KakaoPay
.PG service | Merchant ID | Purpose | Default PG |
---|---|---|---|
KG Inicis | MID-a (example) | General payment | O |
KG Inicis | MID-b (example) | Recurring Payment | X |
카카오페이 | MID-c (example) | Simple Payment | X |
IMP.request_pay
IMP.request_pay(param, callback)
of Iamport JavaScript library, you can use the payment window of desired PG among the PG services previously registered using the pg
attribute of param
. The following values can be specified for the pg
attribute.{ PG service code }
{ PG service code }.{ PG merchant ID }
pg attribute matching priority
{ pg service code }
KakaoPay
. Thus, it can be easily identified using the pg service code
. IMP.request_pay({
pg : "kakaopay", // Call KakaoPay payment window
amount : 1000,
name : "Test order",
buyer_name : "Buyer",
buyer_email : "buyer@iamport.kr"
});
pg
attribute as above, the payment window corresponding to the KakaoPay
configuration in the PG setting in Admin Dashboard is called.pg service code
html5_inicis
kcp
kcp_billing
uplus
nice
jtnet
kicc
bluewalnut
kakaopay
danal
danal_tpay
mobilians
chai
payco
syrup
paypal
eximbay
naverco
naverpay
{ pg service code }.{ pg merchant ID }
KG Inicis (general payment)
and KG Inicis (recurring payments)
have the same PG service code. It is not possible to identify the specific PG setting with just html_inicis
as PG
attribute. In this case, the first PG setting of KG Inicis
is used among the PG settings in Admin Dashboard.
In order to solve this problem, the pg merchant ID
can be provided along with the pg service code
to point to the desired PG setting even for the same PG service. Therefore, you can point to the PG setting of KG Inicis (recurring payments)
by specifying the pg
attribute as html5_inicis.MID-b
as shown below. IMP.request_pay({
pg : "html5_inicis.MID-b", // Call KG Inicis recurring payment window (merchant ID MID-b is applied)
amount : 1000,
name : "Test order",
buyer_name : "Buyer",
buyer_email : "buyer@iamport.kr"
});
KG Inicis (general payment)
by specifying the pg
attribute as html5_inicis.MID-a
. IMP.request_pay({
pg : "html5_inicis.MID-a", // Call KG Inicis general payment window (merchant ID MID-a is applied)
amount : 1000,
name : "Test order",
buyer_name : "Buyer",
buyer_email : "buyer@iamport.kr"
});