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.
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.
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.
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
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. |
CULTURE | Cultural expense |
GENERAL | General (default) |
PUBLIC_TP | Transportation expense |
USE | Use installment (default) |
NOT_USE | Do not use installment |
0 | Success |
-1 | Failure (provide msg and errorCode for the reason for failure) |
COMMON_PAY_ERROR | An error has occurred. |
COMMON_INVALID_PARAMETER | Invalid requested value |
Other error codes |
POST https://pay.toss.im/api/v2/payments
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 postResponse
import 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)
{"code":0,"checkoutPage":"https://pay.toss.im/payfront/auth?payToken=example-payToken","payToken":"example-payToken"}
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.
TOSS_MONEY | Toss Money |
CARD | Card |
true | Interest-free |
false | General |
CREDIT | Credit card |
CHECK | Debit card |
PREPAYMENT | Prepaid card |
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) |
POST https://YOUR-SITE.COM/callback
(Callback URL set by the merchant when creating payment)
Content-Type application/json;charset=UTF-8
{
"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
}
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.
0 | Success |
-1 | Failure (Reason for failure is provided as msg and errorCode) |
LIVE | For actual transactions |
TEST | For testing |
TOSS_MONEY | Toss Money |
CARD | Card |
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 |
true | Interest-free |
false | General |
CREDIT | Credit card |
CHECK | Debit card |
PREPAYMENT | Prepaid card |
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) |
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 |
POST https://pay.toss.im/api/v2/execute
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 postResponse
import 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)
{
"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"
}
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.
0 | Success |
-1 | fail (the reason for failure is provided with msg and errorCode) |
CREDIT | Credit card |
CHECK | Debit card |
PREPAYMENT | Prepaid card |
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) |
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 |
POST https://pay.toss.im/api/v2/refunds
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 postResponse
import 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)
{
"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"
}
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.
0 | Success |
-1 | Fail (the reason for failure is provided with msg and errorCode) |
LIVE | For actual transactions |
TEST | For testing |
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 |
TOSS_MONEY | Toss Money |
CARD | Card |
true | interest-free |
false | general |
CREDIT | Credit card |
CHECK | Debit card |
PREPAYMENT | Prepaid card |
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) |
PAY | payment |
REFUND | refund |
POST https://pay.toss.im/api/v2/status
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 postResponse
import 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)
{
"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"
}