Introduction of Toss Pay API

The following is the API for using the payment service through Toss.
If this is your first time working on development using Toss Pay, refer to a more thorough instruction first.

The development guideline for Toss Pay is updated at any time. Please check it regularly as it may be updated without any notification in advance.

>> Go to ‘Getting Started with Toss Pay’


The browsers that support Toss Pay service are as follows.

Android, and iOS only run in the environment of TLS 1.2 or above, and for the devices, the minimum support version of Toss App is the standard.
If Toss App is not updated to its latest version, payment may not be processed properly, thus, use the latest version of Toss App, if possible.

  • support from IE11, Safari 7, Chrome 38, and Firefox 27
  • support from Android 5.0 Lollipop
  • support from iOS 11
  • for using Java, jdk 1.8 or above is recommended


Toss Pay does not support iframe officially.
Payment may not be processed properly if iframe is used, therefore, integration of page-shifting is recommended.


Additionally, Toss Pay promotes Server to Server calls.
If you call payment API directly to Toss domain on the client side through a web browser,
security accidents may occur due to the data related to payment being exposed externally, therefore, please be cautious.

Payment Status

Once a payment is generated, the payment status is changed, as the payment is processed, and the action that a seller or a purchaser can request changes for each payment status. The following is the list of payment statuses and the explanation for each status.

List of Payment Status

PAY_STANDBY
Payment on standby
This is the status in which a payment is generated, and the purchaser’s payment is on standby. In addition, if the ‘expiration period’ is reached, the payment is automatically canceled.
PAY_APPROVED
Purchaser authentication complete
This is the status in which purchaser authentication for payment is completed and the final authorization of the merchant is on standby
(When a payment is generated, one goes through this phase only if ‘autoExecute’ is set as false.
Even in this status, if the ‘valid period expires,’ it is automatically canceled.).
PAY_CANCEL
Payment cancelation
This is the transaction in which the purchaser cancels payment before the payment is completed or the valid period is expired (the case in which a transaction is terminated without any transfer of the amount).
PAY_PROGRESS
Payment in progress
This is the case in which the purchaser has authorized payment and the payment amount from the purchaser’s account is being withdrawn.
PAY_COMPLETE
Payment complete
This is the case in which payment authorization and withdrawal of the purchaser and the merchant have been completed.
REFUND_PROGRESS
Refund in progress.
This is the status in which the entire or partial amount is in the progress of a refund, and another refund cannot be processed until it is completed.
REFUND_SUCCESS
Refund successful
This is the status in which the entire or partial refund is completed, and the refunded amount has been deposited to the account of the purchaser.
SETTLEMENT_COMPLETE
Settlement complete
This is the status in which settlement is completed for the payment that has been completed, thus a refund is no longer available (a year has passed since the date of authorization or purchase confirmation).
SETTLEMENT_REFUND_COMPLETE
Refund settlement complete
This is the status in which a refund is no longer available since the settlement for the entire or partial amount is completed (a year has passed since the date of authorization or purchase confirmation, or the settlement of a refund for the entire amount is completed).
                            
                            
                            
                            
                            
                            
                        

HTTP Response Codes

HTTP RESPONSE CODES

200
OK : success
400
Bad Request : parameter error
401
Unauthorized : merchant key error
404
Not Found : request not found
50x
Server error : server error
                            
                            
                            
                            
                            
                            
                        

Payment Generation

Payment is generated.

Please refer to the following document for the method of completing the process after receiving payment authentication from the purchaser after payment generation is completed.
Start Toss Pay> 3. Receiving purchaser authentication

ENDPOINT

(POST)
https://pay.toss.im/api/v2/payments

PARAMETERS

apiKey string mandatory Max Length: 30
Merchant key
Please be cautious not to expose it on the web browser or the outside.
If testing is completed, please change it to ‘Key for Actual Transaction’ before the operation begins.
orderNo string mandatory Max Length: 50
Product order number of the merchant
The order number should be no longer than 50 letters, and only the ‘numbers, alphabet letters, and special letters such as _-:.^@’ can be used.
A unique value should be used for the order number each time, and the order number used before the completion of purchaser authentication (PAY_APPROVED) may be reused.
However, it may not be used again after user authentication is completed.
The merchants should manage the numbers to prevent any duplication, otherwise, errors will occur.
productDesc string mandatory Max Length: 255
Product explanation
The product explanation may not be left blank nor include backslash (\) and quotation marks (",'), and it should be no longer than 255 letters. If Korean letters are included in this value, be cautious with encoding.
Reference for Toss Econding Method
retUrl string mandatory Max Length: 255
The web page URL of the merchant to connect to after purchaser authentication is completed
At the time user authentication is completed, the user is directed to the payment completion page along with authentication data. At the same time, the authentication data that is delivered can be found in the link below (However, the authentication data may differ by payment method).
Reference for Purchaser Authentication Completion
retCancelUrl string mandatory Max Length: 255
The merchant’s cancelation page for the user who suspends payment after entering the Toss Pay screen
If this value is used, the Toss server generates the cancelation button to execute reCancelUrl, and the purchaser can move to the cancelation page of the merchant without forcibly terminating the browser or app. Please use this for the purchasers’ convenience.
As soon as the purchaser terminates the payment screen, the purchaser is redirected to retCancelUrl set by the merchant and the payment status is forcibly canceled in the Toss server.
If it is necessary to distinguish the canceled transactions at the store, please categorize the transactions independently by utilizing order numbers, etc.
retAppScheme string Max Length: 255
The app scheme value of the merchant to connect to after the payment is completed
If the payment implementation environment of the merchant is App to App, the user can be redirected to the merchant app by the declaration of retAppScheme value after Toss Pay is completed.
However, if the user’s point of entry is not an app but a general web browser, please be aware that payment may not be completed when the previous browser does not pop up if retAppScheme is included.
For iOS app payment, it is recommended to be implemented mandatorily. Considering the features of iOS, the automatic app conversion is not feasible, thus, the merchant’s app scheme value should be declared here to land on the merchant’s app after authentication is done. Please be aware that the issue of the automatic conversion not being available in mobile web browsers such as safari is an OS issue (ex. testshop://).
Reference for Toss App Guideline
autoExecute Max Length: 5
Setting automatic authorization
The ‘setting for automatic authorization’ may be used depending on the merchant’s product for sale.
If ‘true’ is declared, resultCallback is checked as a mandatory value.
Reference for the Setting for Automatic Authorization
resultCallback Max Length: 500
Payment result callback URL
This value is a mandatory value only if autoExecute is used as ‘true.’
Since the Toss server transmits the success result to the URL inserted here after the withdrawal is completed, it should be checked at the merchant’s server.
If the callback data is not received, please refer to 'Toss Setting for Firewall' since it may be a network issue.
callbackVersion Max Length: 2
Payment result callback version
This value is a mandatory value only if autoExecute is used as ‘true.
Since the response value delivered may differ according to the callback version, it is recommended to use the latest version (V2). If this value is not included, version V1 data is delivered.
V1 : The callback return value may be received in parameters.
V2 : The callback return value may be received in JSON.
amount integer mandatory Max Length: 7
Total payment amount
All the parameters related to the amount should be sent in the number format to prevent any errors.
amountTaxFree integer mandatory
Nontaxable amount out of the payment amount
If the product to be sold is a taxable item, please send 0 for the value. Since the nontaxable amount is a mandatory value, an error occurs if the value is left empty.
amountTaxable Max Length: 7
Taxable amount out of the payment amount
If no taxable amount is set separately and the nontaxable amount is sent as 0, the taxable amount and VAT are automatically calculated in the Toss Pay server.
amountVat integer Max Length: 7
VAT out of the payment amount
If there is no value, the taxable amount to be refunded is divided by 11, and it is rounded up at the first decimal digit.
amountServiceFee integer Max Length: 7
Service fee out of the payment amount
expiredTime string Max Length: 20
Payment expiration time (the default value is 15 minutes, able to set up to 60 minutes at the maximum)
Format : 2020-03-03 12:30:20
enablePayMethods string Max Length: 100
Payment method identifying variable
Depending on the necessity of the merchant, the payment method that is exposed on the payment screen can be controlled. It may be set in accordance with the option values below.

TOSS_MONEY Only Toss Money as a payment method is exposed.
CARD Out of the payment methods, only the card is exposed.
null or other values The basic payment method set in the store is exposed.
cashReceipt boolean Max Length: 5
Availability of cash receipt issuance
Please declare ‘true’ for using the cash receipt function and ‘false’ for not using it. However, since the default value is ‘true,’ it is not required to declare it.
For only the payments made with Toss Money, whether cash receipts will be issued or not may be selected.
cashReceiptTradeOption string Max Length: 10
Cash receipt issuance type
For products related to cultural expenses, please select the issuance type and send it.

CULTURE Cultural expense
GENERAL General (default)
PUBLIC_TP Transportation expense
cardOptions object
If you want to expose a certain card only on the payment screen, please add Toss card code to the options variable. For example, if you control the exposure of Samsung Card and Hyundai Card so that only those cards are available for making payments, please transfer the Toss card code as the following.
"cardOptions":
{"options": [{"cardCompanyCode":3},{"cardCompanyCode":5}]}
installment string Max Length: 10
Installment restriction type
For credit card payments, the user’s choice of installment may be restricted.

USE Use installment (default)
NOT_USE Do not use installment

response

code integer Max Length: 2
Response code
If this value is not received, it may be due to the firewall issue that is restricted by the merchant,
then check 'Toss Firewall Setting.'

0 Success
-1 Failure (provide msg and errorCode for the reason for failure)
checkoutPage string Max Length: 255
Toss Pay webpage URL for processing payment
Please display the value delivered by Toss as-is to the purchaser.
payToken string Max Length: 30
Toss Pay token
A unique token value is generated each time. The merchant must save and manage this value.
msg string Max Length: 120
Explanatory message for unsuccessful response
errorCode string Max Length: 40
Error codes

COMMON_PAY_ERROR An error has occurred.
COMMON_INVALID_PARAMETER Invalid requested value
Other error codes
Definition
POST https://pay.toss.im/api/v2/payments
Example Request
curl https://pay.toss.im/api/v2/payments \
    -H "Content-Type: application/json" \
    -d '{
        "orderNo":"1",
        "amount":10000,
        "amountTaxFree":0,
        "productDesc":"test",
        "apiKey":"sk_test_w5lNQylNqa5lNQe013Nq",
        "autoExecute":true,
        "resultCallback":"https://YOUR-SITE.COM/callback",
        "callbackVersion":"V2",
        "retUrl": "http://YOUR-SITE.COM/ORDER-CHECK?orderno=1",
        "retCancelUrl": "http://YOUR-SITE.COM/close"
        }'import java.nio.charset.StandardCharsets;

URL url = null;
URLConnection connection = null;
StringBuilder responseBody = new StringBuilder();
try {
	url = new URL("https://pay.toss.im/api/v2/payments");
	connection = url.openConnection();
	connection.addRequestProperty("Content-Type", "application/json");
	connection.setDoOutput(true);
	connection.setDoInput(true);

	org.json.simple.JSONObject jsonBody = new JSONObject();
	jsonBody.put("orderNo", "1");
	jsonBody.put("amount", 10000);
	jsonBody.put("amountTaxFree", 0);
	jsonBody.put("productDesc", "test");
	jsonBody.put("apiKey", "sk_test_w5lNQylNqa5lNQe013Nq");
    jsonBody.put("autoExecute", true);
    jsonBody.put("resultCallback", "http://"http://YOUR-SITE.COM/callback");
    jsonBody.put("callbackVersion", "V2");  
    jsonBody.put("retUrl", "http://YOUR-SITE.COM/ORDER-CHECK?orderno=1");
    jsonBody.put("retCancelUrl", "http://YOUR-SITE.COM/close");

	BufferedOutputStream bos = new BufferedOutputStream(connection.getOutputStream());
	
    bos.write(jsonBody.toJSONString().getBytes(StandardCharsets.UTF_8));
	bos.flush();
	bos.close();

	
    BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
	String line = null;
	while ((line = br.readLine()) != null) {
		responseBody.append(line);
	}
	br.close();
} catch (Exception e) {
	responseBody.append(e);
}
System.out.println(responseBody.toString());$arrayBody = array();
$arrayBody["orderNo"] = "1";
$arrayBody["amount"] = 10000;
$arrayBody["amountTaxFree"] = 0;
$arrayBody["productDesc"] = "test";
$arrayBody["apiKey"] = "sk_test_w5lNQylNqa5lNQe013Nq";
$arrayBody["autoExecute"] = true;
$arrayBody["resultCallback"] = "http://YOUR-SITE.COM/callback";
$arrayBody["callbackVersion"] = "V2";
$arrayBody["retUrl"] = "http://YOUR-SITE.COM/ORDER-CHECK?orderno=1";
$arrayBody["retCancelUrl"] = "http://YOUR-SITE.COM/close";
$jsonBody = json_encode($arrayBody);

$ch = curl_init('https://pay.toss.im/api/v2/payments');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonBody);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($jsonBody))
);

$result = curl_exec($ch);
curl_close($ch);

echo "Response: ".$result;Dim data, httpRequest, postResponse

data = "apiKey=sk_test_w5lNQylNqa5lNQe013Nq"
data = data & "&orderNo=1"
data = data & "&amount=10000"
data = data & "&amountTaxFree=0"
data = data & "&productDesc=ASPtestProduct"
data = data & "&autoExecute=true"
data = data & "&resultCallback=http://YOUR-SITE.COM/callback"
data = data & "&callbackVersion=V2"
data = data & "&retUrl=http://YOUR-SITE.COM/ORDER-CHECK?orderno=1"
data = data & "&retCancelUrl=http://YOUR-SITE.COM/close"

Set httpRequest = Server.CreateObject("MSXML2.ServerXMLHTTP")
httpRequest.Open "POST", "https://pay.toss.im/api/v2/payments", False
httpRequest.SetRequestHeader "Content-Type", "application/json"
httpRequest.Send data

postResponse = httpRequest.ResponseText

Response.Write postResponseimport urllib, urllib2

url = "https://pay.toss.im/api/v2/payments"
params = {
    "orderNo": "1",
    "amount": 10000,
    "amountTaxFree": 0,
    "productDesc":"test",
    "apiKey": "sk_test_w5lNQylNqa5lNQe013Nq",
    "autoExecute": true,
    "resultCallback": "http://YOUR-SITE.COM/callback",
    "callbackVersion": "V2",
    "retUrl": "http://YOUR-SITE.COM/ORDER-CHECK?orderno=1",
    "retCancelUrl": "http://YOUR-SITE.COM/close"
}

response = urllib.urlopen(url, urllib.urlencode(params))
print(response.read())require 'net/http'
require 'json'

uri = URI.parse("https://pay.toss.im/api/v2/payments")

params = {
        "orderNo" => "1",
        "amount"=> 10000,
        "amountTaxFree"=> 0,
        "productDesc" => "test",
        "apiKey" => "sk_test_w5lNQylNqa5lNQe013Nq",
        "autoExecute" => true,
        "resultCallback" => "http://YOUR-SITE.COM/callback",
        "callbackVersion" => "V2",
        "retUrl": "http://YOUR-SITE.COM/ORDER-CHECK?orderno=1",
        "retCancelUrl": "http://YOUR-SITE.COM/close"
}

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.path)
request.set_form_data(params)
response = http.request(request)

p JSON.parse(response.body)
Example Response
{"code":0,"checkoutPage":"https://pay.toss.im/payfront/auth?payToken=example-payToken","payToken":"example-payToken"}

Payment result callback (resultCallback)

Once the payment processing is completed, the payment status changes, and Toss notifies the merchant server of the changes.

When you receive a payment complete callback, please change the payment complete status and process logics such as ‘deduction in inventory.’
When setting automatic authorization, (autoExecute: true) must be used.

* Before integrating callback, please be sure to check the firewall information!
* This functions only when there is a resultCallback parameter value in the payment case created.
* The following is callback V2, and we ask merchants to use the most recent version of callback. (Please refer to ethe xplanation of callbackVersion)
* Fields may be added without prior notice. Even if added, please proceed with integration so that errors do not occur.

PARAMETER

status string Max Length: 20
PAY_COMPLETE
Payment complete
Statuses other than ‘payment complete,’ such as refunds are not delivered.
payToken string Max Length: 30
Authorized payment token
orderNo string Max Length: 50
Merchant order number delivered in the payment creation stage
payMethod string Max Length: 10
Authorized payment method
For card authorization, the card data is also delivered.

TOSS_MONEY Toss Money
CARD Card
amount integer Max Length: 7
Amount requested for payment
The amount that was requested for payment in the beginning through the merchant is returned.
discountedAmount integer Max Length: 7
Discounted amount
The discounted amount is returned, and returned as 0 if there is no discount applied. The discount amount includes the instant discount automatically applied in the Toss app and Toss points. The discount conditions may vary depending on the store of payment.
paidAmount integer Max Length: 7
Authorized amount for payment method
This is solely the authorized amount for the payment method with the discounted amount deducted. Merchants that issue cash receipts themselves may issue them with this value.
paidTs string Max Length: 20
Authorization processing time of the payment case
Format : 2020-04-03 14:22:37
transactionId string Max Length: 40
Transaction ID
To distinguish transactions of payments, a unique value is created in Toss server and delivered.
cardCompanyCode integer Max Length: 2
Authorized card company code
cardAuthorizationNo string Max Length: 8
Card authorization number
spreadOut string Max Length: 8
Months of card installment payment selected by the user
Payments under 50,000 KRW and single payments are returned as 0.
noInterest boolean Max Length: 5
Application of interest-free installments

true Interest-free
false General
cardMethodType string Max Length: 10
Card type
You can distinguish the type of the authorized card

CREDIT Credit card
CHECK Debit card
PREPAYMENT Prepaid card
cardNumber string Max Length: 20
Masked card number
The middle digits of the 16-digit card number is masked.
cardUserType string Max Length: 20
Card user classification

PERSONAL Personal Card
PERSONAL_FAMILY Family Card
CORP_PERSONAL Corporate card linked with personal account of employee
CORP_PRIVATE Corporate Card
CORP_COMPANY Corporate card linked with corporate account (Only for Hana Card)
cardBinNumber string Max Length: 8
Card BIN Number
Card bin number given by card company (can be masked)
Not 100% trust data

cardNum4Print string Max Length: 4
Last 4 digits of the card selected by the user
If the payment method selected by the user is 'card', the last 4 digits of the card number are transmitted (masking may be included depending on the card company)
salesCheckLinkUrl string
Credit card sales slip call URL
URL that allows viewing sales slip of the authorized payment case’s sales slip
accountBankCode string Max Length: 3
Bank code
If the payment method selected by the user is 'Toss Money', the bank code defined by Toss is transmitted.
accountBankName string Max Length: 20
Bank name
Bank code list
accountNumber string Max Length: 30
Account number
The account number contains some masking.

HTTP response codes

HTTP Response Code

200
OK : success
400
Bad Request : parameter error
401
Unauthorized : merchant key error
404
Not Found : request not found
50x
Server error : server error
xxx
Server error : others
Definition
POST https://YOUR-SITE.COM/callback 
(Callback URL set by the merchant when creating payment) Content-Type application/json;charset=UTF-8
Example Request
{
 "status": "PAY_COMPLETE",
 "payToken": "example-payToken",
 "orderNo": "1",
 "payMethod": "CARD",
 "amount": 3000,
 "discountedAmount": 600,
 "paidAmount": 2300,
 "paidTs": "2020-04-03 14:22:37",
 "transactionId" : "dc3b951a-9781-462e-ab5a-b8a0bea0222a",
 "cardCompanyCode": 3,
 "cardAuthorizationNo": "87654321",
 "spreadOut": 0,
 "noInterest": false,
 "cardMethodType": "CREDIT",
 "cardUserType": "PERSONAL",
 "cardNumber": "654321******1234",
 "cardBinNumber": "654321",
 "cardNum4Print": "1234",
 "salesCheckLinkUrl": "https://pay.toss.im/payfront/web/external/sales-check?payToken=example-payToken&transactionId=2da1ca05-d91d-410f-976d-7a610242da8a",
 //"paidPoint": 0, // Legacy point amount faded out to 0 won since 2020.08.06 
}                            
                        

Merchant payment authorization

This is a logic processed only in merchants that use ‘false’ as the default automatic authorization setting.
The merchant becomes the main agent to make the final authorization of the payment case and process is as completed.

Please refer to the following document for details regarding payment authorization
Start using Toss Pay > Authorize payment

There are only 2 mandatory parameters. Please state ‘which payment case’ will be finally authorized in ‘which merchant.’
Depending on the needs, verification of payment cases may be conducted for the payment case.

* Response fields may be added without prior notice. Even if added, please proceed with integration so that errors do not occur.

endpoint

(POST)
https://pay.toss.im/api/v2/execute

parameters

apiKey string mandatory Max Length: 30
Merchant key
Please make sure that this is not exposed in the web browser or outside.
payToken string mandatory Max Length: 30
Toss Pay token (Token value of the payment to be authorized)
orderNo string Max Length: 50
Merchant’s product order number
When the orderNo is sent with the payment authorization, it is checked whether it matches. If the payment case connected to the payToken and the orderNo do not match, the authorization is processed as a failure, and the validity is verified once again.

RESPONSE

code integer Max Length: 2
Response code

0 Success
-1 Failure (Reason for failure is provided as msg and errorCode)
mode string Max Length: 4
Payment environment

LIVE For actual transactions
TEST For testing
approvalTime string Max Length: 20
Authorization processing time of the payment case (yyyy-MM-dd HH:mm:ss)
This is the payment case processing time according to the request. Please manage the variable as the same variable is returned for refunds.
stateMsg string Max Length: 120
Status response text value
amount integer Max Length: 7
Product price
Total amount requested when the payment was created
discountedAmount integer Max Length: 7
Discounted amount
The discounted amount is returned, and returned as 0 if there is no discount applied. The discount amount includes the instant discount automatically applied in the Toss app and Toss points. The discount conditions may vary depending on the store of payment.
paidAmount integer Max Length: 7
Authorized amount for payment method
This is solely the authorized amount for the payment method with the discounted amount deducted. Merchants that issue cash receipts themselves may issue them with this value.
payMethod string Max Length: 10
Payment method

TOSS_MONEY Toss Money
CARD Card
orderNo string Max Length: 50
Authorized product order number
payToken string Max Length: 30
Authorized payment token
transactionId string Max Length: 40
Transaction ID
To distinguish transactions of payments, a unique value is created in Toss server and delivered. This can be used as an identifying value when calling a sales slip or processing a refund.
cashReceiptMgtKey string Max Length: 36
Cash receipt management number identification value
This is not a National Tax Service approval number, but rather an identification value created by Tospay itself.
Cash receipt issuance can be distinguished by the presence of the relevant field.
cardCompanyName string Max Length: 2
Authorized card company name
Please refer to the table below.
cardCompanyCode integer Max Length: 2
Card company code
The card company codes defined by Toss are as follows,
and we are preparing to support non-supported card companies. (Based on purchasing card company)


cardCompanyName cardCompanyCode
Shinhan 1
Hyundai 2
Samsung 3
Kookmin 4
Lotte 5
Hana 6
Woori 7
Nonghyup 8
Citi (Currently not supported) 9
BC 10
cardAuthorizationNo string Max Length: 8
Card company authorization number available for the purchaser to check
The normal card company authorization number can be viewed in the live key payment.
spreadOut integer Max Length: 2
Months of card installment payment selected by the user
Payments under 50,000 KRW and single payments are returned as 0.
noInterest boolean Max Length: 5
Application of interest-free installments

true Interest-free
false General
salesCheckLinkUrl string
Credit card sales slip call URL
This is a URL in which you can check the sales slip of the authorized card payment case. The transaction history can be viewed after the purchaser completes additional authentication.
Note for Toss sales slips
cardMethodType string Max Length: 10
Card type
You can distinguish the type of the authorized card. For example, if you wish to find out the ratio of credit card payments of a store, use this value!
There are three options as follows.
CREDIT Credit card
CHECK Debit card
PREPAYMENT Prepaid card
cardNumber string Max Length: 20
Masked card number
The middle digits of the 16-digit card number is masked.
cardUserType string Max Length: 20
Card user classification

PERSONAL Personal Card
PERSONAL_FAMILY Family Card
CORP_PERSONAL Corporate card linked with personal account of employee
CORP_PRIVATE Corporate Card
CORP_COMPANY Corporate card linked with corporate account (Only for Hana Card)
cardBinNumber string Max Length: 8
Card BIN Number
Card bin number given by card company (can be masked)
Not 100% trust data

cardNum4Print string Max Length: 4
Last 4 digits of the card selected by the user
If the payment method selected by the user is 'card', the last 4 digits of the card number are transmitted (masking may be included depending on the card company)
accountBankCode string Max Length: 3
Bank code
If the payment method (payMethod) selected by the user is ‘Toss Money,’ the bank code defined by Toss is delivered.
accountBankName string Max Length: 20
Bank name
Bank code list
accountNumber string Max Length: 30
Account number
The account number contains some masking.
msg string Max Length: 120
Explanation message when the response is not successful
errorCode string Max Length: 40
Error codes

PAYMENT_EXISTING_PAYMENT The payment already exists.
COMMON_INVALID_API_KEY Invalid API key
COMMON_BREAK_TIME_OF_BANK Bank system maintenance hours: Please try again later.
other codes
Definition
POST https://pay.toss.im/api/v2/execute
Example Request
curl "https://pay.toss.im/api/v2/execute" \
    -H "Content-Type: application/json" \
    -d '{
        "payToken":"example-payToken",
        "apiKey":"sk_test_w5lNQylNqa5lNQe013Nq"
        }'import java.nio.charset.StandardCharsets;

URL url = null;
URLConnection connection = null;
StringBuilder responseBody = new StringBuilder();
try {
	url = new URL("https://pay.toss.im/api/v2/execute");
	connection = url.openConnection();
	connection.addRequestProperty("Content-Type", "application/json");
	connection.setDoOutput(true);
	connection.setDoInput(true);

	org.json.simple.JSONObject jsonBody = new JSONObject();
	jsonBody.put("payToken", "example-payToken");
	jsonBody.put("apiKey", "sk_test_w5lNQylNqa5lNQe013Nq");

	BufferedOutputStream bos = new BufferedOutputStream(connection.getOutputStream());
    bos.write(jsonBody.toJSONString().getBytes(StandardCharsets.UTF_8));
	bos.flush();
	bos.close();

    BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
	String line = null;
	while ((line = br.readLine()) != null) {
		responseBody.append(line);
	}
	br.close();
} catch (Exception e) {
	responseBody.append(e);
}
System.out.println(responseBody.toString());$arrayBody = array();
$arrayBody["payToken"] = "example-payToken";
$arrayBody["apiKey"] = "sk_test_w5lNQylNqa5lNQe013Nq";
$jsonBody = json_encode($arrayBody);

$ch = curl_init('https://pay.toss.im/api/v2/execute');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonBody);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($jsonBody))
);

$result = curl_exec($ch);
curl_close($ch);

echo "Response: ".$result;Dim data, httpRequest, postResponse

data = "apiKey=sk_test_w5lNQylNqa5lNQe013Nq"
data = data & "&payToken=example-payToken"

Set httpRequest = Server.CreateObject("MSXML2.ServerXMLHTTP")
httpRequest.Open "POST", "https://pay.toss.im/api/v2/execute", False
httpRequest.SetRequestHeader "Content-Type", "application/json"
httpRequest.Send data

postResponse = httpRequest.ResponseText

Response.Write postResponseimport urllib, urllib2

url = "https://pay.toss.im/api/v2/execute"
params = {
    "payToken": "example-payToken",
    "apiKey": "sk_test_w5lNQylNqa5lNQe013Nq"
}

response = urllib.urlopen(url, urllib.urlencode(params))
print(response.read())require 'net/http'
require 'json'

uri = URI.parse("https://pay.toss.im/api/v2/execute")

params = {
        "payToken" => "example-payToken",
        "apiKey" => "sk_test_w5lNQylNqa5lNQe013Nq"
}

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.path)
request.set_form_data(params)
response = http.request(request)

p JSON.parse(response.body)
Example Response
{
    "code": 0,
    "mode": "LIVE",
    "orderNo": "TossTest20190718",
    "amount": 2000,
    "approvalTime": "2019-07-18 11:28:02",
    "stateMsg": "결제 완료",
    "discountedAmount": 0,
    "paidAmount": 2000,
    "payMethod": "CARD", //"TOSS_MONEY"
    "payToken": "example-payToken",
    "transactionId": "2da1ca05-d91d-410f-976d-7a610242da8a",
   
    //when payMethod is CARD
    "cardCompanyCode": 3,
    "cardCompanyName": "삼성",
    "cardAuthorizationNo": "87654321",
    "spreadOut": 0,
    "noInterest": false,
    "salesCheckLinkUrl": "https://pay.toss.im/payfront/web/external/sales-check?payToken=example-payToken&transactionId=2da1ca05-d91d-410f-976d-7a610242da8a",
    "cardMethodType": "CREDIT",
    "cardNumber": "654321******1234"
    "cardUserType": "PERSONAL",
    "cardNum4Print": "1234",
    "cardBinNumber": "654321"

    //when payMethod is TOSS_MONEY
    //"cashReceiptMgtKey": "0123456-abcd-9abcd0Df",
    //"accountBankCode" : "88",
    //"accountBankName" : "신한은행",
    //"accountNumber" : "110******676"
				
}

            

Payment refund

A part of or the entire amount of the completed payment is refunded to the purchaser.
The already-refunded transaction may not be restored, so the merchant must check it before providing a refund.

* Response fields may be added without prior notice. Even if added, please proceed with integration so that errors do not occur.

endpoint

(POST)
https://pay.toss.im/api/v2/refunds

parameters

apiKey string mandatory Max Length: 30
Merchant key
Please be cautious not to be exposed to a web browser or the outside
payToken string mandatory Max Length: 30
Toss Pay token
refundNo string Max Length: 36
Refund number
If not inserted, it is automatically created and can be checked in the refund completion response.
It is recommended to use a unique value for every request.
If you use refundNo, duplication of refund requests can be prevented, and it can be reused if you cannot receive the processing response due to network or other issues.
idempotent boolean Max Length: 5
Idempotence applied or not
true : used (default), false : not used
If you want to apply idempotency, declare it as true. If not, declare it as false.
If not entered, idempotency is enabled by default, so even if the same request is performed repeatedly, the same result is responded with success ("code": 0).
reason string Max Length: 255
Reason for refund
For the reason for refund, only Korean letters, numbers, alphabet letters, and special letters _-:.^@()[]#/!%?& can be used.
amount
Amount to be refunded
If the amount is not inserted, the entire remaining amount of the payment to be refunded is refunded, and for a partial refund, use the ‘amount’ mandatorily.
If you need a partial refund of the transaction to which instant discount is applied, the merchant needs to deliver only the requested amount necessary for a refund. Calculation is automatically processed in Toss Pay server.
amountTaxFree Max Length: 7
Non-taxable amount out of the amount to be refunded
The non-taxable amount out of the amount to be refunded; if there is none, set it as 0.
amountTaxable integer Max Length: 7
Taxable amount out of the amount to be refunded
amountVat integer Max Length: 7
VAT out of the amount to be refunded
If there is no value, divide the taxable amount to be refunded by 11 and round up the number at the first decimal digit.
amountServiceFee integer Max Length: 7
Service fee out of the amount to be refunded
You can insert it only if you set the service fee when payment was generated.

response

code integer Max Length: 2
Response code

0 Success
-1 fail (the reason for failure is provided with msg and errorCode)
refundNo string Max Length: 36
Refund number
If a refund is requested, the refundNO that the merchant delivered is returned. If it is not inserted, it is automatically created in the server and the same value identical to the transactionId value is returned.
refundableAmount integer Max Length: 7
Refundable amount
The remaining amount that can be refunded after a refund is successfully completed
discountedAmount integer Max Length: 7
Discounted amount
The remaining amount discounted after the refund is completed is delivered, and 0 is returned if it is a refund of the entire amount or if a discount is not applied.
For example, if you paid 9,000 won by getting a 10% discount on 10,000 won and then get a partial refund of 4,000 won, 600 won is discounted from the payment of 6,000 won, so 600 won is returned for the value for discountedAmount.
The merchant only delivers the amount requested for a refund, and Toss Pay server automatically designates priorities and deducts the discount amount.
paidAmount integer Max Length: 7
Payment method authorized amount
The remaining authorized amount of the payment method after a refund is successfully completed
refundedAmount integer Max Length: 7
Refund requested amount
The amount delivered for a refund request from the merchant
refundedDiscountAmount integer Max Length: 7
Actual amount instantly discounted out of the refund requested amount
If there is no deducted amount that is automatically deducted instantly at Toss server out of the amount delivered for a refund request, 0 is returned,
refundedPaidAmount integer Max Length: 7
Payment method amount actually deducted out of refund requested amount
If there is no deducted payment method amount that is automatically deducted at Toss server out of the amount delivered for a refund request, 0 is returned.
approvalTime string Max Length: 20
Refund processing time of the payment (yyyy-MM-dd HH:mm:ss)
cashReceiptMgtKey string Max Length: 36
Cash receipt management number identification value
This is not a National Tax Service approval number, but rather an identification value created by Tospay itself.
Cash receipt issuance can be distinguished by the presence of the relevant field.
payToken string Max Length: 30
Payment token refunded
transactionId string Max Length: 40
Transaction Id
The merchant needs to manage it since it is the option value necessary for checking the sales slip of the refunded transaction.
cardMethodType string Max Length: 10
Card type
You can distinguish the type of the authorized card

CREDIT Credit card
CHECK Debit card
PREPAYMENT Prepaid card
cardNumber string Max Length: 20
Masked card number
The middle digits of the 16-digit card number is masked.
cardUserType string Max Length: 20
Card user type

PERSONAL Personal Card
PERSONAL_FAMILY Family Card
CORP_PERSONAL Corporate card linked with personal account of employee
CORP_PRIVATE Corporate Card
CORP_COMPANY Corporate card linked with corporate account (Only for Hana Card)
cardBinNumber string Max Length: 8
Card BIN Number
Card bin number given by card company (can be masked)
Not 100% trust data

cardNum4Print string Max Length: 4
Last 4 digits of the card selected by the user
If the payment method selected by the user is 'card', the last 4 digits of the card number are transmitted (masking may be included depending on the card company)
salesCheckLinkUrl string
Credit card sales slip call URL
URL that allows viewing sales slip of the authorized payment case’s sales slip
accountBankCode string Max Length: 3
Bank code
If the payment method (payMethod) selected by the user is ‘Toss Money,’ the bank code defined by Toss is delivered.
accountBankName string Max Length: 20
Bank name
Bank code list
accountNumber string Max Length: 30
Account number
The account number contains some masking.
msg string Max Length: 120
Message for failed response
errorCode string Max Length: 40
Error codes

INACTIVE_USER In active user. Refund is not available.td>
COMMON_REFUND_ERROR Refund is not available.
REFUND_EXCEED_DAILY The refund amount shall not exceed the daily refund limit of the store.
Other error codes
Definition
POST https://pay.toss.im/api/v2/refunds
Example Request
curl "https://pay.toss.im/api/v2/refunds" \
    -H "Content-Type: application/json" \
    -d '{
        "payToken":"example-payToken",
        "apiKey":"sk_test_w5lNQylNqa5lNQe013Nq"
        }'import java.nio.charset.StandardCharsets;

URL url = null;
URLConnection connection = null;
StringBuilder responseBody = new StringBuilder();
try {
	url = new URL("https://pay.toss.im/api/v2/refunds");
	connection = url.openConnection();
	connection.addRequestProperty("Content-Type", "application/json");
	connection.setDoOutput(true);
	connection.setDoInput(true);

	org.json.simple.JSONObject jsonBody = new JSONObject();
	jsonBody.put("payToken", "example-payToken");
	jsonBody.put("amount", "5000");
	jsonBody.put("apiKey", "sk_test_w5lNQylNqa5lNQe013Nq");

	BufferedOutputStream bos = new BufferedOutputStream(connection.getOutputStream());
	
    bos.write(jsonBody.toJSONString().getBytes(StandardCharsets.UTF_8));
	bos.flush();
	bos.close();

	
    BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
	String line = null;
	while ((line = br.readLine()) != null) {
		responseBody.append(line);
	}
	br.close();
} catch (Exception e) {
	responseBody.append(e);
}
System.out.println(responseBody.toString());$arrayBody = array();
$arrayBody["payToken"] = "example-payToken";
$arrayBody["amount"] = 5000;
$arrayBody["apiKey"] = "sk_test_w5lNQylNqa5lNQe013Nq";
$jsonBody = json_encode($arrayBody);

$ch = curl_init('https://pay.toss.im/api/v2/refunds');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonBody);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'Content-Length: ' . strlen($jsonBody))
);

$result = curl_exec($ch);
curl_close($ch);

echo "Response: ".$result;Dim data, httpRequest, postResponse

data = "apiKey=sk_test_w5lNQylNqa5lNQe013Nq"
data = data & "&payToken=example-payToken"
data = data & "&amount=1000"

Set httpRequest = Server.CreateObject("MSXML2.ServerXMLHTTP")
httpRequest.Open "POST", "https://pay.toss.im/api/v2/refunds", False
httpRequest.SetRequestHeader "Content-Type", "application/json"
httpRequest.Send data

postResponse = httpRequest.ResponseText

Response.Write postResponseimport urllib, urllib2

url = "https://pay.toss.im/api/v2/refunds"
params = {
    "payToken": "example-payToken",
    "amount": 5000,
    "apiKey": "sk_test_w5lNQylNqa5lNQe013Nq"
}

response = urllib.urlopen(url, urllib.urlencode(params))
print(response.read())require 'net/http'
require 'json'

uri = URI.parse("https://pay.toss.im/api/v2/refunds")

params = {
        "payToken" => "example-payToken",
        "amount"=> 5000,
        "apiKey" => "sk_test_w5lNQylNqa5lNQe013Nq"
}

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.path)
request.set_form_data(params)
response = http.request(request)

p JSON.parse(response.body)
Example Response
{ 
 "code": 0,
 "refundNo": "3243c76e-e9cf-4669-881b-33a3b82ddf49",
 "approvalTime": "2020-04-29 11:32:52",
 "cashReceiptMgtKey": "0123456-abcd-9abcd0Df", 
 "refundableAmount": 2000,
 "discountedAmount": 0,
 "paidAmount": 1000,
 "refundedAmount": -2000,
 "refundedDiscountAmount": 0,
 "refundedPaidAmount": -2000,
 "payToken": "example-payToken",
 "transactionId": "3243c76e-e9cf-4669-881b-33a3b82ddf49"
 "cardMethodType": "CREDIT",
 "cardNumber": "654321******1234"
 "cardUserType": "PERSONAL",
 "cardNum4Print": "1234",
 "cardBinNumber": "654321"

//payMethod 가 TOSS_MONEY 일때
//"cashReceiptMgtKey": "0123456-abcd-9abcd0Df",
//"accountBankCode" : "88",
//"accountBankName" : "신한은행",
//"accountNumber" : "110******676"
				
}


            

Check payment status

You can view transaction status of the generated payment case.
Depending on the situation, it can be used when the authorization or refund response has not been received.

* Response fields may be added without prior notice. Even if added, please proceed with integration so that errors do not occur.

endpoint

(POST)
https://pay.toss.im/api/v2/status

parameters

apiKey string mandatory Max Length: 30
Merchant key
Please be cautious not to be exposed to a web browser or the outside.
payToken or orderNo string mandatory Max Length: 50
Toss Pay token or merchant order number

response

code integer Max Length: 2
Error code

0 Success
-1 Fail (the reason for failure is provided with msg and errorCode)
mode string Max Length: 4
Payment environment

LIVE For actual transactions
TEST For testing
payToken string Max Length: 30
Toss Pay token
Please insert pay token of the transaction that needs its status viewed.
payStatus string Max Length: 30
Payment status

PAY_STANDBY Payment on standby
PAY_APPROVED Purchaser authentication complete
PAY_CANCEL Payment cancelation
PAY_PROGRESS Payment in progress
PAY_COMPLETE Payment complete
REFUND_PROGRESS Refund in progress
REFUND_SUCCESS Successfully refunded
SETTLEMENT_COMPLETE Settlement complete
SETTLEMENT_REFUND_COMPLETE Refund settlement complete
orderNo string Max Length: 50
Order number of store integrated with Toss Pay
payMethod string Max Length: 10
Payment method

TOSS_MONEY Toss Money
CARD Card
amount integer Max Length: 7
Total payment amount delivered by merchant to Toss
discountedAmount integer Max Length: 7
discounted amount
The discounted amount is returned, or 0 if no discount is applied. The discount amount includes the instant discount automatically applied in the Toss app and the amount of Toss points used. Discount conditions may vary depending on the payment store.
discountAmountV2 integer Max Length: 7
Instantly discounted amount
The instantly discounted amount on Toss Pay screen is returned, and if there is no discount applied, 0 is returned.
paidPointV2 integer Max Length: 7
Toss point usage amount
The amount of toss points used for payment is returned, and if not used, it is returned as 0.
paidAmount integer Max Length: 7
Payment method authorized amount
It is the payment method authorized amount excluding the discounted amount out of the total amount requested by the merchant.
The merchant that does not use Toss’ automatically issued cash receipt may issue a cash receipt through this field.
refundableAmount integer Max Length: 7
Refundable Balance
Remaining refundable amount after successful refund
amountTaxFree integer Max Length: 7
Applied non-taxable amount out of total payment amount
amountTaxable integer Max Length: 7
Applied taxable amount out of total payment amount
If you send 0 for non-taxable amount (amountTaxFree) in the payment generation phase, tax will be automatically imposed in Toss server, and you can check it with this field.
amountVat integer Max Length: 7
Applied VAT amount out of total payment amount
If you send 0 for non-taxable amount (amountTaxFree) in the payment generation phase, tax will be automatically imposed in Toss server, and you can check it with this field.
amountServiceFee integer Max Length: 7
Applied service fee out of the total payment amount
disposableCupDeposit integer Max Length: 7
disposable cup deposit
accountBankCode string Max Length: 3
Bank code
If the payment method selected by the user is 'Toss Money', the bank code defined by Toss is transmitted.
accountBankName string Max Length: 20
Bank name
Bank code list
accountNumber string Max Length: 30
Account number
The account number contains some masking.
card list
Card information that goes down only if the case is for card payment
noInterest boolean Max Length: 5
Application of interest on card

true interest-free
false general
spreadOut integer Max Length: 2
Card installment month selected by user
For the amount less than 50,000 won and the lump sum payment, 0 is returned.
cardCompanyName string Max Length: 2
Authorization card company name
cardCompanyCode integer Max Length: 2
Card company code
cardAuthorizationNo string Max Length: 8
Card company authorization number that purchaser can check
cardMethodType string Max Length: 10
Card type
You can distinguish the type of the authorized card. For example, if you want to check the credit card payment ratio of the store, please use this value!
CREDIT Credit card
CHECK Debit card
PREPAYMENT Prepaid card
cardUserType string Max Length: 20
Card user classification

PERSONAL Personal Card
PERSONAL_FAMILY Family Card
CORP_PERSONAL Corporate card linked with personal account of employee
CORP_PRIVATE Corporate Card
CORP_COMPANY Corporate card linked with corporate account (Only for Hana Card)
cardNumber string Max Length: 20
Masked card number
The middle digits of 16-digit card numbers are masked.
cardBinNumber string Max Length: 8
Card BIN Number
Card bin number given by card company (can be masked)
Not 100% trust data

cardNum4Print string Max Length: 4
Last 4 digits of the card selected by the user
If the payment method selected by the user is 'card', the last 4 digits of the card number are transmitted (masking may be included depending on the card company)
salesCheckLinkUrl string
Credit card sales slip call URL
transactions list
Transactions
stepType string Max Length: 7
Requested Transaction Type

PAY payment
REFUND refund
transactionId string Max Length: 40
Transaction id
To distinguish transactions of payments, a unique value is created in Toss server and delivered. It is recommended to use this value for transaction reconciliation.
transactionAmount integer Max Length: 7
Amount delivered by merchant of requested transaction type (stepType)
The requested amount delivered by the merchant is returned.
For a ‘refund’ request, a negative (-) amount is returned.
discountedAmount integer Max Length: 7
Applied discount amount out of requested transaction type (stepType)
The discount amount includes the instant discount automatically applied in the Toss app and Toss points.
paidAmount integer Max Length: 7
Applied payment method amount out of requested transaction type (stepType)
For example, if it is a ‘refund’ request, the actual refunded payment method amount out of the refund requested amount is returned.
regTs string Max Length: 20
Request processing time
createdTs string Max Length: 20
User’s initial payment request time
The time payment is generated
paidTs string Max Length: 20
Time for completing payment
Definition
POST https://pay.toss.im/api/v2/status
Example Request
curl "https://pay.toss.im/api/v2/status" \
    -H "Content-Type: application/json" \
    -d '{
        "payToken":"example-payToken",
        "apiKey":"sk_test_w5lNQylNqa5lNQe013Nq"
        }'import java.nio.charset.StandardCharsets;

URL url = null;
URLConnection connection = null;
StringBuilder responseBody = new StringBuilder();
try {
	url = new URL("https://pay.toss.im/api/v2/status");
	connection = url.openConnection();
	connection.addRequestProperty("Content-Type", "application/json");
	connection.setDoOutput(true);
	connection.setDoInput(true);

	org.json.simple.JSONObject jsonBody = new JSONObject();
	jsonBody.put("orderNo", "1");
	jsonBody.put("apiKey", "sk_test_w5lNQylNqa5lNQe013Nq");

	BufferedOutputStream bos = new BufferedOutputStream(connection.getOutputStream());
	
    bos.write(jsonBody.toJSONString().getBytes(StandardCharsets.UTF_8));
	bos.flush();
	bos.close();

	
    BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8));
	String line = null;
	while ((line = br.readLine()) != null) {
		responseBody.append(line);
	}
	br.close();
} catch (Exception e) {
	responseBody.append(e);
}
System.out.println(responseBody.toString());$arrayBody = array();
$arrayBody["orderNo"] = "1";
$arrayBody["apiKey"] = "sk_test_w5lNQylNqa5lNQe013Nq";
$jsonBody = json_encode($arrayBody);
// echo "Request: ".$request."
"; $ch = curl_init('https://pay.toss.im/api/v2/status'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonBody); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($jsonBody)) ); $result = curl_exec($ch); curl_close($ch); echo "Response: ".$result;
Dim data, httpRequest, postResponse data = "apiKey=sk_test_w5lNQylNqa5lNQe013Nq" data = data & "&orderNo=1" Set httpRequest = Server.CreateObject("MSXML2.ServerXMLHTTP") httpRequest.Open "POST", "https://pay.toss.im/api/v2/status", False httpRequest.SetRequestHeader "Content-Type", "application/json" httpRequest.Send data postResponse = httpRequest.ResponseText Response.Write postResponseimport urllib, urllib2 url = "https://pay.toss.im/api/v2/status" params = { "orderNo": "1", "apiKey": "sk_test_w5lNQylNqa5lNQe013Nq" } response = urllib.urlopen(url, urllib.urlencode(params)) print(response.read())require 'net/http' require 'json' uri = URI.parse("https://pay.toss.im/api/v2/status") params = { "orderNo" => "1", } http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri.path) request.set_form_data(params) response = http.request(request) p JSON.parse(response.body)
Example Response
{
    "code": 0,
    "mode": "LIVE",
    "payToken": "rDgrfe4YRBnTNLo5lwpqb9",
    "orderNo": "TEST-2023-02-09T06:44:04.217Z",
    "payStatus": "PAY_COMPLETE",
    "payMethod": "CARD",
    "amount": 1000,
    "discountedAmount": 0,
    "discountAmountV2": 0,
    "paidPointV2": 0,
  //"paidPoint": 0, // Response as 0 won for legacy point amount faded out after 2020.08.06
    "paidAmount": 1000,
    "refundableAmount": 1000,
    "amountTaxable": 909,
    "amountTaxFree": 0,
    "amountVat": 91,
    "amountServiceFee": 0,
    "disposableCupDeposit": 0,
    //when payMethod is TOSS_MONEY
    //"accountBankCode" : "88",
    //"accountBankName" : "신한은행"
    //"accountNumber" : "110******676"
    "card": {
        "noInterest": false,
        "spreadOut": 0,
        "cardAuthorizationNo": "30019610",
        "cardMethodType": "CREDIT",
        "cardUserType": "PERSONAL",
        "cardNumber": "557042******700*",
        "cardBinNumber": "557042",
        "cardNum4Print": "700*",
        "salesCheckLinkUrl": "https://staging.toss.im/payfront/web/external/sales-check?payToken=rDgrfe4YRBnTNLo5lwpqb9&transactionId=81a6bafc-b7b6-4959-82ba-e74034f379ea",
        "cardCompanyName": "국민",
        "cardCompanyCode": 4
    },
    "transactions": [
        {
            "stepType": "PAY",
            "transactionId": "81a6bafc-b7b6-4959-82ba-e74034f379ea",
            "paidAmount": 1000,
            "transactionAmount": 1000,
            "discountedAmount": 0,
            "pointAmount": 0, 
            "regTs": "2023-02-09 15:44:25"
        }
    ],
    "createdTs": "2023-02-09 15:44:04",
    "paidTs": "2023-02-09 15:44:24"
}