> For the complete documentation index, see [llms.txt](https://docs.pagsmile.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pagsmile.com/reference/payin/submit-a-payin/korea/creditcard.md).

# Credit Card

This page describes how to submit a CreditCard payin in Korea using Pagsmile Checkout Web SDK.

The integration flow contains four steps:

1. Create a payin order and get the `prepay_id`.
2. Include Pagsmile script.
3. Initialize Pagsmile SDK with the `prepay_id`.
4. Trigger the payment.

{% hint style="info" %}
Korea CreditCard payins support partial refund.
{% endhint %}

{% hint style="info" %}
Korea CreditCard payins only support integer amounts. Decimal amounts are not supported. The minimum amount is `100 KRW`. The maximum amount is not specified because it may be configured based on the user or product.
{% endhint %}

***

### CreditCard

For CreditCard payments, use the following parameter values:

| Parameter                                         | Type   | Description               |
| ------------------------------------------------- | ------ | ------------------------- |
| method<mark style="color:red;">\*</mark>          | string | Fixed value: `CreditCard` |
| order\_currency<mark style="color:red;">\*</mark> | string | Fixed value: `KRW`        |

***

### Step 1: Get prepay\_id

<mark style="color:green;">`POST`</mark> `https://gateway-test.pagsmile.com/trade/create`

Use this endpoint to create a payin order and get the `prepay_id`.

#### Request Body

| Parameter       | Type   | Required | Constraints                                              | Description                                                 |
| --------------- | ------ | -------- | -------------------------------------------------------- | ----------------------------------------------------------- |
| app\_id         | string | Yes      | Max length: 32 characters                                | The merchant application ID assigned by Pagsmile.           |
| out\_trade\_no  | string | Yes      | Max length: 64 characters; must be unique                | The merchant-side order ID.                                 |
| method          | string | Yes      | Fixed value: `CreditCard`                                | Payment method.                                             |
| order\_amount   | string | Yes      | Integer only; minimum: `100 KRW`                         | Payment amount.                                             |
| order\_currency | string | Yes      | Fixed value: `KRW`                                       | Payment currency.                                           |
| subject         | string | Yes      | Max length: 128 characters                               | Order title or product name.                                |
| content         | string | Optional | Max length: 255 characters                               | Order description.                                          |
| notify\_url     | string | Yes      | Valid URL                                                | The URL used to receive asynchronous payment notifications. |
| return\_url     | string | Optional | Valid URL                                                | The URL to redirect the customer after payment.             |
| buyer\_id       | string | Yes      | Merchant-defined unique ID                               | The unique customer ID in the merchant system.              |
| timestamp       | string | Yes      | Format: `yyyy-MM-dd HH:mm:ss`; max length: 19 characters | Request timestamp.                                          |
| trade\_type     | string | Yes      | Fixed value: `web`                                       |                                                             |

#### Request Sample

```json
{
  "app_id": "162************38",
  "out_trade_no": "2026070306193308916",
  "method": "CreditCard",
  "order_amount": "1000",
  "order_currency": "KRW",
  "subject": "trade pay test",
  "content": "trade pay test content",
  "notify_url": "http://merchant/callback/success",
  "return_url": "https://www.merchant.com",
  "buyer_id": "buyer_0101_0001",
  "timestamp": "2026-07-03 06:19:33",
  "trade_type": "web"
}
```

#### Response

```json
{
  "code": "10000",
  "msg": "Success",
  "prepay_id": "prepay_id_example",
  "trade_no": "trade_no_example",
  "out_trade_no": "2026070306193308916",
  "web_url": "",
  "trade_status": "PROCESSING"
}
```

***

### Step 2: Include Pagsmile Script

Add the Pagsmile Checkout Web SDK script to the `<head>` section of your checkout page.

```html
<head>
  <!-- Other head content -->
  <script src="https://res.pagsmile.com/lib/js/pagsmile.min.js"></script>
</head>
```

***

### Step 3: Initialize Pagsmile SDK

Use `Pagsmile.setPublishableKey` to initialize the SDK.

#### Request Parameters

<table><thead><tr><th width="136.5234375">Parameter</th><th width="98.7734375">Type</th><th width="103.546875">Required</th><th width="158.04296875">Constraints</th><th>Description</th></tr></thead><tbody><tr><td>app_id</td><td>string</td><td>Yes</td><td>Max length: 32 characters</td><td>The merchant application ID assigned by Pagsmile.</td></tr><tr><td>public_key</td><td>string</td><td>Yes</td><td>Starts with <code>Pagsmile_pk_</code></td><td>The publishable public key assigned by Pagsmile.</td></tr><tr><td>env</td><td>string</td><td>Yes</td><td>One of: <code>sandbox</code>, <code>prod</code></td><td>The SDK environment. Use <code>sandbox</code> for testing and <code>prod</code> for production.</td></tr><tr><td>region_code</td><td>string</td><td>Yes</td><td>Fixed value: <code>KOR</code></td><td>code used to initialize the SDK for Korea Wallet payins.</td></tr><tr><td>prepay_id</td><td>string</td><td>Yes</td><td>Returned from Step 1</td><td>The Pagsmile prepay ID returned from the Create Payin request.</td></tr></tbody></table>

#### Sample

```html
<script>
  document.addEventListener('DOMContentLoaded', function() {
    Pagsmile.setPublishableKey({
      app_id: "1649*********8673",
      public_key: "Pagsmile_pk_86fc***************************************************",
      env: "sandbox",
      region_code: "KOR",
      prepay_id: "prepay_id_example"
    }).then((clientInstance) => {
      // Successfully initialized.
      document.getElementById("submit-pay").addEventListener("click", function(e) {
        clientInstance
          .createOrder()
          .then((res) => {
            console.log("res: ", res);
            // {
            //   status: "success",
            //   query: true
            // }
          })
          .catch((err) => {
            console.log("Error: ", err);
          });
      });
    }).catch((err) => {
      console.log("Initializing Pagsmile Error: ", err);
    });
  });
</script>
```

***

### Step 4: Trigger Payment

After the SDK is initialized successfully, call `clientInstance.createOrder()` when the customer clicks the payment button.

```javascript
clientInstance
  .createOrder()
  .then((res) => {
    console.log("res: ", res);
  })
  .catch((err) => {
    console.log("Error: ", err);
  });
```

{% hint style="info" %}
When `query` is returned as `true`, query the transaction status through the `/trade/query` API.
{% endhint %}

{% hint style="danger" %}
Use your own `app_id`, `public_key`, and `prepay_id` when testing or going live. Do not expose any secret key on the frontend.
{% endhint %}
