- Overview
- Create a payment
- Authorize a payment
- Retrieve a payment
- Cancel a payment
- Keyed transactions
Whether you're using widgets or window, Payment APIs are integral to Toss Payments. Use your test API secret key starting with test_sk
or test_gsk
to use the APIs in test mode. In test mode, live data and payment methods are not affected. Use your live API secret key starting with live_sk
or live_gsk
to start accepting payments in production.
For the full list of Toss Payment APIs, see the Core API reference page (Korean).
All Payments APIs 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.
Get API responses in English by using the below request header.
Use the idempotency key header to ensure API POST requests are only made once. Requests sent with the same idempotency key will return the same response even on multiple requests, even in the case of an error. 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 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
Currency of the payment amount. Default is
KRW
. OnlyUSD
is supported forFOREIGN_EASY_PAY
payments. - orderId 필수 · string
Unique identifier for the 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 the order. E.g.,
Bottled water etc.
. The maximum length is 100 characters. - successUrl string
The URL customers are redirected to upon payment request success. Check query parameters for
paymentKey
,orderId
, andamount
. ThesuccessUrl
must include the origin; for example,https://www.example.com/success
.* Required for all domestic payments and PayPal
- failUrl string
The URL customers are redirected upon payment request failure. Check query parameters for the error code and message. The
failUrl
must include the origin; for example,https://www.example.com/fail
.* Required for all domestic payments and PayPal
- pendingUrl string
The URL customers are redirected to after completing a Chinese or Southeast Asian 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
Payment window type. To open the hosted type window, use
DEFAULT
. To open the direct type window, inputDIRECT
and use thecardCompany
oreasyPay
parameters. - easyPay string
Code of the digital wallet you want to open. For example, if you input
TOSSPAY
, the Toss Pay payment window will open.* Some digital wallet providers do not work in test environments.
- cardCompany string
Code of the card payment you want to open. For example, if you input
HYUNDAI
, the Hyundai Card payment window will open.* Only Korean card companies are accepted.
- 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
webhook.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 service. After the customer completes the payment on an mobile ISP app, this app scheme is used to redirect them back to your ap. Specify your store's app scheme like this:
testapp://
.
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
Unique key given to each payment, issued by Toss Payments. The maximum length is 200 characters.
- orderId 필수 · string
Unique identifier 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.
Retrieve a payment using the paymentKey
.
- paymentKey 필수 · string
Unique key given to each payment, issued by Toss Payments. The maximum length is 200 characters.
Returns a Payment object if successful.
Returns an error object if unsuccessful.
Cancel payments. Full and partial cancellations are available.
- paymentKey 필수 · string
Unique key given to each payment, issued by Toss Payments. The maximum length is 200 characters.
- cancelReason 필수 · string
Reason for canceling payments. The maximum length is 200 characters.
- cancelAmount number
Amount to cancel. On default, the whole payment amount is canceled.
- refundReceiveAccount object
The customer's refund account information. This parameter is required only for virtual account payments.
- bank 필수 · string
Code of the bank. Refer to bank and securities codes.
- accountNumber 필수 · string
Bank account number of the customer. Limited to a string of only numbers up to 20 characters long.
- holderName 필수 · string
Name registered as the bank account holder. Maximum length is 60 characters.
- taxFreeAmount number
The tax-exempted amount out total cancel amount. 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 the tax guide.
- currency string
The currency of the payment. Required as
USD
for foreign digital wallet payments. - refundableAmount number ・ deprecated
The available amount for refunds. Use this parameter to ensure 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, the customer must manually enter their card information to make a payment. It is not permitted to save or tokenize the customer's card information.
Keyed transactions require a separate contract. Contact your sales associate for more information.
- amount 필수 · integer
Amount to charge the customer.
- orderId 필수 · string
Unique identifier for the payment. Generate a random string between 6 and 64 characters, using upper and lowercase letters, numerals,
-
, and_
. (No other special characters are allowed.) - cardNumber 필수 · string
Card number. The maximum length is 20 characters.
- cardExpirationYear 필수 · string
Card expiration year.
- cardExpirationMonth 필수 · string
Card expiration month.
- cardPassword string
The first two digits of the card password (PIN).
- orderName 필수 · string
Name of the order. E.g.,
Bottled water etc.
. The maximum length is 100 characters. - customerIdentityNumber 필수 · string
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
Monthly installment period. 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
The tax-exempted amount out total cancel amount. 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 the tax guide.
- customerEmail string
Customer’s email address. Customers will be alerted about their payment result through this email. The maximum length is 100 characters.
- customerName string
Customer’s name. The maximum length is 100 characters.
- vbv string
Information for 3D Secure(3DS) authentication. Required if you must have 3DS authentication results.
- cavv string
Authentication value for the 3DS authentication session
- xid string
Transaction ID.
- eci string
Code value for the 3DS authentication result.
Returns a Payment object if successful.
Returns an error object if unsuccessful. See the related errors.