# KakaoPay for Payment Setup API To accept KakaoPay payments, you must: 1. Create a payment setup. 2. Confirm the payment. 3. Redirect the customer to KakaoPay. --- ## Create a payment setup Call the [Create a payment setup](https://api-reference.checkout.com/tag/Payment-Setups/#operation/createAPaymentSetup) endpoint. > **Information** > > Your base URL's `{prefix}` value is unique to your account and environment. To learn how to retrieve your base URLs for the sandbox and production environments, see [API endpoints](https://www.checkout.com/docs/developer-resources/api/api-endpoints.md). **Production** `POST` `https://{prefix}.api.checkout.com/payments/setups` **Sandbox** `POST` `https://{prefix}.api.sandbox.checkout.com/payments/setups` ### Request example ```json { "amount": 11000, "currency": "KRW", "reference": "ORD-5023-4E89", "customer": { "name": "Jia Tsang" }, "order": { "items": [ { "name": "Wireless headphones", "quantity": 1, "unit_price": 11000 } ] }, "payment_methods": { "kakaopay": { "terminal_type": "app", "os_type": "ios" } }, "settings": { "success_url": "https://example.com/payments/success", "failure_url": "https://example.com/payments/failure" } } ``` In the request body, provide the following: | Field | Description | | --- | --- | | `amount`
`number` | The payment amount, in the [minor currency unit](https://www.checkout.com/docs/payments/accept-payments/format-the-amount-value).

Minimum: 1

**Required** | | `currency`
`string` | Three-letter ISO 4217 [currency code](https://www.checkout.com/docs/developer-resources/codes/currency-codes.md).

Supported value: `KRW`

**Required** | | `customer`
`object` | The customer's details.

**Required** | | `customer.name`
`string` | The customer's name.

Max length: 255

**Required** | | `order`
`object` | The order details.

**Required** | | `order.items`
`array` | The list of items in the order.

Minimum items: 1

**Required** | | `order.items[].name`
`string` | The name of the item.

**Required** | | `order.items[].quantity`
`number` | The quantity of the item.

Minimum: 1

**Required** | | `order.items[].unit_price`
`number` | The unit price of the item, in the minor currency unit.

Minimum: 0

**Required** | | `payment_methods.kakaopay`
`object` | The KakaoPay payment method details.

**Required** | | `payment_methods.kakaopay.os_type`
`string` | The operating system of the customer's device.

Required if `terminal_type` is `wap` or `app`.

Supported values:

- `android`

- `ios` | | `payment_methods.kakaopay.terminal_type`
`string` | Supported values:

- `web`

- `wap`

- `app`

**Required** | | `reference`
`string` | A unique reference for the payment.

Max length: 80

**Required** | | `settings`
`object` | The payment settings.

**Required** | | `settings.failure_url`
`string` | The URL to redirect the customer to if the payment fails.

Format: URI

Max length: 1024

**Required** | | `settings.success_url`
`string` | The URL to redirect the customer to if the payment is successful.

Format: URI

Max length: 1024

**Required** | | `billing`
`object` | The customer's billing details. | | `billing.address`
`object` | The customer's billing address.

Required if `billing` is provided. | | `billing.address.address_line1`
`string` | The first line of the billing address.

Required if `billing` is provided. | | `billing.address.city`
`string` | The city of the billing address.

Required if `billing` is provided. | | `billing.address.country`
`string` | The country of the billing address.

Required if `billing` is provided. | | `description`
`string` | A description of the payment.

Max length: 100 | | `order.items[].reference`
`string` | A reference for the item. | | `order.shipping`
`object` | The shipping details for the order. | | `order.shipping.address`
`object` | The shipping address. | | `order.shipping.address.country`
`string` | The country of the shipping address. | ### Response example ```json { "id": "set_rcmepwrchqab2wsergcafvijfy", "processing_channel_id": "pc_wzjki6hw5puepb5fnvqlizj2e4", "amount": 11000, "currency": "KRW", "payment_type": "Regular", "reference": "ORD-5023-4E89", "description": "KakaoPay payment", "payment_methods": { "kakaopay": { "status": "ready", "flags": [] } }, "available_payment_methods": [ "kakaopay" ], "settings": { "success_url": "https://example.com/payments/success", "failure_url": "https://example.com/payments/failure" } } ``` The response returns a `payment_methods` object, which contains the payment methods enabled on your account. When all required fields are present, the `payment_methods.kakaopay` object shows a `ready` [status](https://www.checkout.com/docs/payments/accept-payments/accept-a-payment-using-the-payment-setup-api.md#Payment_method_status). --- ## Confirm the payment Checkout.com processes the payment when you call the [Confirm a payment setup](https://api-reference.checkout.com/tag/Payment-Setups/#operation/confirmAPaymentSetup) endpoint. Provide: - The payment setup `id` as the `{id}` path parameter. - `kakaopay` as the `{payment_method_name}` path parameter. ### Request example **Production** `POST` `https://{prefix}.api.checkout.com/payments/setups/{id}/confirm/kakaopay` **Sandbox** `POST` `https://{prefix}.api.sandbox.checkout.com/payments/setups/{id}/confirm/kakaopay` ### Response example If you receive a `202 Success` response with a payment `id` and a `status` field set to `Pending`, your request was successful. ```json { "id": "pay_sxzrgliy2w3e5gpnby3chlswwq", "status": "Pending", "reference": "ORD-5023-4E89", "customer": { "id": "cus_2g4ehcpm6phexgkzahlwxvbgne" }, "_links": { "self": { "href": "https://{prefix}.api.checkout.com/payments/pay_sxzrgliy2w3e5gpnby3chlswwq" }, "redirect": { "href": "https://psp.ac.alipay.com/page/simulation-wallet/acwallet/alipayconnectcode.html?code=281666040095AHvh5AIKT0a3kv8X6Zzv3kiv&pspName=KAKAOPAY&loadMode=2" } } } ``` --- ## Redirect the customer Redirect the customer to the `redirect.href` URL from the response. The customer completes the payment on the KakaoPay page and is then redirected back to your `settings.success_url` or `settings.failure_url`.