The Payment APIs are essential to integrating Toss Payments, whether you are only using our APIs or our SDKs.
Use your test API key starting with test_
to use the APIs in test mode. In test mode, live data or funds are not affected.
This guide walks you through a select number of Payment APIs in English. To see the full list of Toss Payment APIs, see the Core API reference page (Korean).
The Toss Payments Core APIs all use Basic authorization. Add a colon to the end of your secret key. Encode the secret key and colon in base 64. Add the encoded secret key and colon to the Basic auth header as below.
Add the header below to get the API response in English.
Use the idempotency key header to ensure sensitive API requests only occur once. Requests sent with the same idempotency key will return the same response even on multiple requests. The idempotency key should be a unique and random value up to 300 characters long. An idempotency key is valid for 15 days.
Create a payment window. Use this API as an alternative to the SDK.
- method 필수 · string
Specify the customer's payment method with an enumerated value.
CARD
: Card and digital wallet paymentsVIRTUAL_ACCOUNT
: Virtual account paymentsMOBILE_PHONE
: Mobile phone paymentsTRANSFER
: Bank transfer paymentsFOREIGN_EASY_PAY
: PayPal, Alipay and other foreign digital wallet payments
- amount 필수 · number
Amount to charge the customer.
- currency string
Curreny of the payment amount. Default is
KRW
. OnlyUSD
is supported forFOREIGN_EASY_PAY
payments. - orderId 필수 · string
Order ID for payment. Generate a random string between 6 and 64 characters, using upper and lowercase letters, numerals,
-
, and_
. (No other special characters are allowed.) - orderName 필수 · string
Name of an order. E.g., bottled water and 1 other item. The maximum length is 100 characters.
- successUrl string
URL where the customer is redirected if the payment is successfully authenticated. The origin must be included.
Upon redirection, the below query parameters are added to the URL. Validate the values and authorize the payment.
* Required for all domestic payments and PayPal
- failUrl string
URL where the customer is redirected if the payment authenticaion fails. The origin must be included.
Upon redirection, the below query parameters are added to the URL. Use the error message to inform the customer of the issue.
* Required for all domestic payments and PayPal
- pendingUrl string
URL where the customer is redirected after completing the payment. Integrate the
PAYMENT_STATUS_CHANGED
webhook to get the result of the payment asynchronously.* Required for all
FOREIGN_EASY_PAY
payments except PayPal - flowMode string
Mode of the payment window.
DEFAULT
is the default setting and returns the Toss Payments window.Set the paramter to
DIRECT
to return the card or digital wallet payment window directly. When set to direct mode, either one of theeasyPay
orcardCompany
parameters are required. - easyPay string
- cardCompany string
- provider string
FOREIGN_EASY_PAY
provider codes.With the exception of PayPal, the below foreign easypay providers must be integrated asynchronously, meaning you must get the result of the payment through the
PAYMENT_STATUS_CHANGED
webook.Payment Method(Provider) Code Alipay ALIPAY
AlipayHK ALIPAYHK
BillEase BILLEASE
Boost BOOST
BPI BPI
DANA DANA
GCash GCASH
PayPal PAYPAL
Rabbit LINE Pay RABBIT_LINE_PAY
Touch 'n Go eWallet TOUCHNGO
TrueMoney Wallet TRUEMONEY
- appScheme string
App scheme of your app. This is used to redirect the customer back to your app after payment is completed on an external payment app.
-
Returns a Payment object if successful. Provide the customer with the
checkout.url
to open the payment window.Returns an error object if unsuccessful.
Authorize payments to finalize the transaction.
- paymentKey 필수 · string
A unique key given to each payment, issued by Toss Payments. The maximum length is 200 characters.
- orderId 필수 · string
Order ID for payment. Generate a random string between 6 and 64 characters, using upper and lowercase letters, numerals,
-
, and_
. (No other special characters are allowed.) - amount 필수 · number
Amount to charge the customer.
-
Returns a Payment object if successful. Provide the customer with the
checkout.url
to open the payment window.Returns an error object if unsuccessful.
Cancel payments. Full and partial cancellations are available.
- paymentKey 필수 · string
The payment key. The maximum length is 200 characters.
- cancelReason 필수 · string
The reason for canceling payments. The maximum length is 200 characters.
- cancelAmount 필수 · number
The amount to be canceled. The default value is 0.
- refundReceiveAccount obejct
The information of customer's refund account information. This parameter is required only for virtual account payments. You don’t need this object when canceling payments with other payment methods.
- bank 필수 · string
The bank code of customers’ accounts for refunds. Please refer to the bank codes.
- accountNumber 필수 · string
The account number to receive refunds. Only numbers should be entered. (
-
is not allowed.) The maximum length is 20 characters. - holderName 필수 · string
The name of account holder. The maximum length is 60 characters.
- taxFreeAmount number
The tax-exempted amount out of the amount to be canceled. The default value is 0.
* This parameter will work only for duty-free stores or stores selling both tax-free and taxable products. Stores selling taxable products cannot use this function. For more information, please refer to how to take care of taxes.
- currency number
The tax-exempted amount out of the amount to be canceled. The default value is 0.
* This parameter will work only for duty-free stores or stores selling both tax-free and taxable products. Stores selling taxable products cannot use this function. For more information, please refer to how to take care of taxes.
- refundableAmount number ・ deprecated
This is for the available amount for refunds. Use this parameter to make sure you don't cancel more than the actual refundable amount.
If the available amount for refunds is different from refundableAmount, an error is sent without processing the cancellation.
* Deprecated parameter. Use
IDEMPOTENCY_KEY
in request header to cancel payments safely.
-
Returns a Payment object if successful. Check the
cancels
array for details.Returns an error object if unsuccessful.
In keyed transactions, customers manually enter a card number. Keyed transactions require separate terms. Contact Toss Payments to use this API.
- amount 필수 · integer
The amount to be paid.
- orderId 필수 · string
The order ID. Generate a random string between 6 and 64 characters, using upper and lowercase letters, numerals, -, and _. (No other special characters are allowed.)
- cardNumber 필수 · string
The card number. The maximum length is 20 characters.
- cardExpirationYear 필수 · string
The card expiration year.
- cardExpirationMonth 필수 · string
The card expiration month.
- cardPassword string
The first two digits of the card password (PIN).
- orderName 필수 · string
The name of an order. E.g., bottled water and 1 other item. The maximum length is 100 characters.
- customerIdentityNumber 필수 · string
The card holder information. This string has 6 digits of the card holder’s date of birth (YYMMDD) or 10 digits of a business registration number.
- cardInstallmentPlan integer
The monthly installment period. You can configure the monthly installment period manually. You can enter values between 2 and 12. Entering 0 will trigger a one-time payment, not an installment.
- useFreeInstallmentPlan boolean
Whether or not to apply an interest-free installment plan supported by the card company. The default value is false. If the value is true, an interest-free installment plan will be applied for the months set at
cardInstallmentPlan
.* The interest-free installment plan fees incurred by this parameter is paid by the store.
- taxFreeAmount integer
This is the tax-exempted amount out of the amount to be canceled. The default value is 0 for any missing parameters.
* This parameter will work only for duty-free stores or stores selling both tax-free and taxable products. Stores selling taxable products cannot use this function. For more information, please refer to how to take care of taxes.
- customerEmail string
The customer’s email address. Customers will be alerted about their payment result through this email. The maximum length is 100 characters.
- customerName string
The customer’s name. The maximum length is 100 characters.
- vbv string
This is used for the 3D Secure(3DS) authentication when customers are making card payments overseas. It is a required object if you have to send the 3DS authentication result.
- cavv string
The authentication value for the 3DS authentication session
- xid string
The transaction ID.
- eci string
The code value for the 3DS authentication result.
-
Returns a Payment object if successful.
Returns an error object if unsuccessful. See the related errors.