JavaScript SDK
Integrate the payment window with the Eximbay JavaScript SDK.
You can check how to Install SDK, how to use the method, parameter information, and how to handle SDK errors.
Eximbay provides various types of payment windows that merchants can use according to their purpose.
When calling the payment window with the SDK, you can select the transaction_type below.
-
PAYMENT
: This type includes Authentication, Authorization and Capture in one transaction. Authentication Authorization Capture
-
PAYER_AUTH
: This type includes only Authentication in one transaction. After receiving the response, you need to request additional APIs for Authorization and Capture. Authentication
-
AUTHORIZE
: This type includes Authentication and Authorization in one transaction. After Authorization the payments, you can request Capture API for capturing the payments. Authentication Authorization
Capture API is available after a separate contract. Please contact us.
Install SDK Library
You need to add the Eximbay JavaScript SDK library to the HTML page that will link the payment window.
<!-- jQuery -->
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<!-- SDK -->
<script type="text/javascript" src="https://api-test.eximbay.com/v1/javascriptSDK.js"></script>
After finish load the library, you can call the EXIMBAY.request_pay() method for open the payment window.
Open the Online Payment
Before calling SDK, merchant need fgkey to request Payment Ready API to check parameter forgery and alteration. For more information, refer to Preparing fgkey.
After create fgkey with the Payment Ready API, you can open the Eximbay's online payment successfully.
When opening the payment window using the SDK, you must send a value that matches the request parameter sent to the FGKey generation API called earlier. The payment fails because the generated fgkey with different parameter values is different.
<button type="button" onclick="payment();">결제 창 연동</button>
.
.
.
<script type="text/javascript">
function payment() {
EXIMBAY.request_pay({
// Payment Ready API로 생성된 fgkey
"fgkey" : "0E9BE04BA239A519E68171F26B68604ADA0A85C8350DBF5C8C0FCCF98461DB09",
"payment" : {
"transaction_type" : "PAYMENT",
"order_id" : "20220819105102",
"currency" : "USD",
"amount" : "1",
"lang" : "EN"
},
"merchant" : {
"mid" : "1849705C64"
},
"buyer" : {
"name" : "eximbay",
"email" : "test@eximbay.com"
},
"settings" : {
"display_type" : "R"
},
"url" : {
"return_url" : "eximbay.com",
"status_url" : "eximbay.com"
}
});
}
</script>
SDK parameters
You can check the detailed parameter information required to open the payment page.
fgkey string
Requirepayment object
transaction_type string
Require-
PAYMENT
: This type includes Authentication, Authorization and Capture in one transaction.
-
PAYER_AUTH
: This type includes only Authentication in one transaction. After receiving the response, you need to request APIs for Authorization and Capture.
-
AUTHORIZE
: This type includes Authentication and Authorization in one transaction. After authorize the payments, you can request API for Capture.
* Capture API is available after a seperate contract. Please contact us.
order_id string
RequireThis is the unique order ID issued by Merchant to identify accept of canceled transactions. (e.g. orderid)
currency string
RequireThe type of currency in currency codes.
amount string
RequireTotal payment amount. , is not allowed, only numbers greater than zero can be sent.
lang string
RequireThe type of language shown in the payment SDK. Refer to the Supported Languages.
payment_method string
The type of payment method. Refer to payment method codes.
This parameter is used when you
want to call a specific payment method.
multi_payment_method string
merchant object
mid string
RequireThis is the unique merchant ID issued by Eximbay to identify merchants.
shop string
Shop Name. Required when Shop name is different from Merchant name.
partner_code string
Partner Codes.
url object
return_url string
Require
Merchant page that is called when the user exits the payment screen on the payment result confirmation screen.
Since returnurl operates based on the customer's browser, it may not be cal led if the browser is forcibly closed.
status_url string
RequireSince it is not called from the browser, scripts, cookies, and sessions cannot be used.
* DB operation and payment process must be handled by statusurl, and returnurl may not be called
depending on the payment method or when the customer forcibly closes the payment screen.
* Since statusurl can be called in duplicate, please make sure that your order is not processed in duplicate.
buyerobject
name string
RequireName of buyer.
phone_number string
Contact number of buyer.
email string
RequireEmail address of buyer. This email is necessary for sending payment confirmation email.
tax object* This Parameters are for domestic payments.
amt_tax_free string
Tax-free amount out of the total payment amount.
amt_taxable string
Taxable amount out of the total payment amount.
amt_vat string
RequireVAT out of the total payment amount.
amt_service_fee string
RequireService-fee out of the total payment amount.
Note. 1 - You must send all parameters in the tax object when you proceed with payment with Naver Pay points.
other_param object
param1 string
Preliminary parameters that merchants can use if needed.
param2 string
Preliminary parameters that merchants can use if needed.
product array* Array length is up to 3.
name string
RequireThe product name of the ordered product.
quantity string
RequireThe quantity of the ordered product.
unit_price string
RequireThe unit price of the ordered product.
link string
RequireLink of the ordered product. For orders placed on the open market, it is mandatory to send it.
surcharge array* Array length is up to 3.
name string
The name of the surcharge. (e.g. coupon,, shipping fee)
quantity string
The quantity of the surcharge. Quantity can only be positive.
unit_price string
The unit price of the surcharge. , cannot be included, and can have postive or negative values. (e.g. -100.50, 9.15)
ship_to object
city string
Shipping city. (e.g . Hanoi, Brisbane, Houston)
country string
Shipping country. The type of country in ISO 3166 format.
first_name string
The first name of the recipient of the shipment.
last_name string
The last name of the recipient of the shipment.
phone_number string
The phone number of the recipient of the shipment.
postal_code string
The postal code of the shipping address.
state string
State or province of the shipping address. Required only when the shipping country is US or CA. (e.g. MA, NY, CA)
Refer to State, Province and Territory Codes for the United States and Canada.
street1 string
The street of the shipping address. (e.g. 123 Main street, 56 Le Loi street)
bill_to object
city string
Billing city. (e.g . Hanoi, Brisbane, Houston)
country string
Billing country. The type of country in ISO 3166 format.
first_name string
The First Name of the billing card holder.
last_name string
The Last Name of the billing card holder.
phone_number string
The phone number of the billing card holder.
postal_code string
The billing zip code(postal code).
state string
Billing State information. Available if your billing address is in the United States(US) or Canada(CA). Please refer to Area Code.
street1 string
The street of the shipping address. (e.g. 123 Main street, 56 Le Loi street)
settings object
display_type string
-
P
: Pop-up
-
R
: Replace
autoclose string
One of Y OR N. if not sent, N is senty by default.
-
Y
: Go to the merchant page.
-
N
: Go to the completion page of the payment (default)
site_foreign_currency string
* If you used the payment_method parameter, you can only send a P000(Credit Card).
* When using DCC at a merchant, only DCC supported currencies can be displayed in the payment window.
DCC supported currencies can be found in DCC Currency Codes.
* The price is based on the real-time exchange rate inquired through the Eximbay DCC Provider.
After the card information is finally entered, it may be changed to the currency of the card issuance country.
call_from_app string
Classification of client environment. One of Y OR N. If parameter is sent by empty, N is sent to the default.
-
Y
: App(iOS, AOS) evironment
-
N
: Web browser environment (default)
call_from_scheme string
The App URL Scheme required to return from an external app to the merchant app.
issuer_country string
ostype string
This is the client environment that opens the payment window. If parameter is sent by empty, P is sent to the default.
-
P
: PC (default)
-
M
: Mobile
SDK Error Codes
For the error code that appears when requesting the SDK, check the error code.