결제 조회하기
결제 조회 API로 승인 또는 취소된 거래 내역의 세부 정보를 확인할 수 있습니다.
결제 조회를 요청할 때 key_field파라미터에 transaction_id 또는
order_id 를 보낼 수 있습니다.
order_id : 엑심베이에서 거래를 구분하기 위해 발급하는 고유 아이디로 일치하는 결제 건의 세부 정보를
확인할 수 있습니다.
transaction_id : 가맹점에서 주문 건을 구분하기 위해 발급한 고유 아이디로, 결제 건의 최종 상태에
대한 세부 정보를 조회할 수 있습니다.
주문 아이디(order_id)로 결제 조회
주문 아이디로 결제를 조회하기 위해서는 아래와 같이 결제 조회 API로 요청을 보낼 때 key_field에 order_id를 넣어서 보내야 합니다.
요청
curl --request POST 'https://api-test.eximbay.com/v1/payments/retrieve' \
--header 'Authorization: Basic dGVzdF8xODQ5NzA1QzY0MkMyMTdFMEIyRDo=' \
--header 'Content-Type: application/json' \
--data '{
"mid" : "1849705C64",
"key_field" : "order_id",
"payment" : {
"order_id" : "20220902101716",
"currency" : "USD",
"amount" : "1",
"transaction_id" : "20220902101716",
"lang" : "EN"
}
}'
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json");
headers.add("Authorization", "Basic dGVzdF8xODQ5NzA1QzY0MkMyMTdFMEIyRDo=");
URI url = URI.create("https://api-test.eximbay.com/v1/payments/retrieve");
String body = "{\n" +
"\"mid\" : \"1849705C64\",\n" +
"\"key_field\" : \"order_id\", \n" +
"\"payment\" : {\n" +
"\"order_id\" : \"20220902101716\",\n" +
"\"currency\" : \"USD\",\n" +
"\"amount\" : \"1\",\n" +
"\"transaction_id\" : \"20220902101716\",\n" +
"\"lang\" : \"EN\"\n" +
" }\n" +
"}";
HttpEntity<String> entity = new HttpEntity<>(body, headers);
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
System.out.println(response.getBody());
<?php
$url = 'https://api-test.eximbay.com/v1/payments/retrieve';
$data = '{
"mid" : "1849705C64",
"key_field" : "order_id",
"payment" : {
"order_id" : "20220902101716",
"currency" : "USD",
"amount" : "1",
"transaction_id" : "20220902101716",
"lang" : "EN"
}
}';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Authorization: Basic dGVzdF8xODQ5NzA1QzY0MkMyMTdFMEIyRDo='));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($ch);
echo $response;
curl_close($ch);
?>
import requests
import json
url = "https://api-test.eximbay.com/v1/payments/retrieve"
headers = {
"Authorization": "Basic dGVzdF8xODQ5NzA1QzY0MkMyMTdFMEIyRDo=",
"Content-Type": "application/json"
}
request = {
"mid" : "1849705C64",
"key_field" : "order_id",
"payment" : {
"order_id" : "20220902101716",
"currency" : "USD",
"amount" : "1",
"transaction_id" : "20220902101716",
"lang" : "EN"
}
}
response = requests.post(url, headers=headers, data=json.dumps(request))
print(response.text)
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api-test.eximbay.com/v1/payments/retrieve',
'headers': {
'Authorization': 'Basic dGVzdF8xODQ5NzA1QzY0MkMyMTdFMEIyRDo=',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"mid": "1849705C64",
"key_field": "order_id",
"payment": {
"order_id": "20220902101716",
"currency": "USD",
"amount": "1",
"transaction_id": "20220902101716",
"lang": "EN"
}
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
string uri = "https/api-test.eximbay.com/v1/payments/retrieve";
string body = "{\n" +
"\"mid\" : \"1849705C64\",\n" +
"\"key_field\" : \"order_id\", \n" +
"\"payment\" : {\n" +
"\"order_id\" : \"20220902101716\",\n" +
"\"currency\" : \"USD\",\n" +
"\"amount\" : \"1\",\n" +
"\"transaction_id\" : \"20220902101716\",\n" +
"\"lang\" : \"EN\"\n" +
" }\n" +
"}";
WebClient webClient = new WebClient();
webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
webClient.Headers[HttpRequestHeader.Authorization] = "Basic dGVzdF8xODQ5NzA1QzY0MkMyMTdFMEIyRDo=";
webClient.Encoding = UTF8Encoding.UTF8;
string responseJSON = webClient.UploadString(uri, body);
Console.Write(responseJSON);
val restTemplate = RestTemplate()
val headers = HttpHeaders()
headers.add("Content-Type", "application/json")
headers.add("Authorization", "Basic dGVzdF8xODQ5NzA1QzY0MkMyMTdFMEIyRDo=")
var url = URI.create("https/api-test.eximbay.com/v1/payments/retrieve")
val body = "{\n" +
"\"mid\" : \"1849705C64\",\n" +
"\"key_field\" : \"order_id\", \n" +
"\"payment\" : {\n" +
"\"order_id\" : \"20220902101716\",\n" +
"\"currency\" : \"USD\",\n" +
"\"amount\" : \"1\",\n" +
"\"transaction_id\" : \"20220902101716\",\n" +
"\"lang\" : \"EN\"\n" +
" }\n" +
"}"
var entity = HttpEntity<String>(body, headers)
var response = restTemplate.exchange(url, HttpMethod.POST, entity, String::class.java)
println(response.body)
조회한 ref 와 일치하는 결제의 세부 정보가 Payment 객체로 돌아옵니다.
{
"rescode": "0000",
"resmsg": "Success.",
"mid": "1849705C64",
"payment": {
"order_id": "20220902101716",
"currency": "USD",
"amount": "1",
"transaction_id": "1849705C6420220902000010",
"status": "AUTH",
"auth_code": "485760",
"transaction_date": "20220902101749",
"balance": "1.00"
},
"card_info": {
"card_number1": "4111",
"card_number4": "1111"
}
}
거래 아이디(transaction_id)로 결제 조회
거래 아이디로 결제를 조회하기 위해서는 아래와 같이 결제 조회 API로 요청을 보낼 때 key_field에 transaction_id를 넣어서 보내야 합니다.
요청
curl --request POST 'https://api-test.eximbay.com/v1/payments/retrieve' \
--header 'Authorization: Basic dGVzdF8xODQ5NzA1QzY0MkMyMTdFMEIyRDo=' \
--header 'Content-Type: application/json' \
--data '{
"mid" : "1849705C64",
"key_field" : "transaction_id",
"payment" : {
"order_id" : "20220902101716",
"currency" : "USD",
"amount" : "1",
"transaction_id" : "20220902101716",
"lang" : "EN"
}
}'
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json");
headers.add("Authorization", "Basic dGVzdF8xODQ5NzA1QzY0MkMyMTdFMEIyRDo=");
URI url = URI.create("https://api-test.eximbay.com/v1/payments/retrieve");
String body = "{\n" +
"\"mid\" : \"1849705C64\",\n" +
"\"key_field\" : \"transaction_id\", \n" +
"\"payment\" : {\n" +
"\"order_id\" : \"20220902101716\",\n" +
"\"currency\" : \"USD\",\n" +
"\"amount\" : \"1\",\n" +
"\"transaction_id\" : \"20220902101716\",\n" +
"\"lang\" : \"EN\"\n" +
" }\n" +
"}";
HttpEntity<String> entity = new HttpEntity<>(body, headers);
ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
System.out.println(response.getBody());
<?php
$url = 'https://api-test.eximbay.com/v1/payments/retrieve';
$data = '{
"mid" : "1849705C64",
"key_field" : "transaction_id",
"payment" : {
"order_id" : "20220902101716",
"currency" : "USD",
"amt" : "1",
"transaction_id" : "20220902101716",
"lang" : "EN"
}
}';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Authorization: Basic dGVzdF8xODQ5NzA1QzY0MkMyMTdFMEIyRDo='));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($ch);
echo $response;
curl_close($ch);
?>
import requests
import json
url = "https://api-test.eximbay.com/v1/payments/retrieve"
headers = {
"Authorization": "Basic dGVzdF8xODQ5NzA1QzY0MkMyMTdFMEIyRDo=",
"Content-Type": "application/json"
}
request = {
"mid" : "1849705C64",
"key_field" : "transaction_id",
"payment" : {
"order_id" : "20220902101716",
"currency" : "USD",
"amount" : "1",
"transaction_id" : "20220902101716",
"lang" : "EN"
}
}
response = requests.post(url, headers=headers, data=json.dumps(request))
print(response.text)
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api-test.eximbay.com/v1/payments/retrieve',
'headers': {
'Authorization': 'Basic dGVzdF8xODQ5NzA1QzY0MkMyMTdFMEIyRDo=',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"mid": "1849705C64",
"key_field": "transaction_id",
"payment": {
"order_id": "20220902101716",
"currency": "USD",
"amount": "1",
"transaction_id": "20220902101716",
"lang": "EN"
}
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
string uri = "https/api-test.eximbay.com/v1/payments/retrieve";
string body = "{\n" +
"\"mid\" : \"1849705C64\",\n" +
"\"key_field\" : \"transaction_id\", \n" +
"\"payment\" : {\n" +
"\"order_id\" : \"20220902101716\",\n" +
"\"currency\" : \"USD\",\n" +
"\"amount\" : \"1\",\n" +
"\"transaction_id\" : \"20220902101716\",\n" +
"\"lang\" : \"EN\"\n" +
" }\n" +
"}";
WebClient webClient = new WebClient();
webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
webClient.Headers[HttpRequestHeader.Authorization] = "Basic dGVzdF8xODQ5NzA1QzY0MkMyMTdFMEIyRDo=";
webClient.Encoding = UTF8Encoding.UTF8;
string responseJSON = webClient.UploadString(uri, body);
Console.Write(responseJSON);
val restTemplate = RestTemplate()
val headers = HttpHeaders()
headers.add("Content-Type", "application/json")
headers.add("Authorization", "Basic dGVzdF8xODQ5NzA1QzY0MkMyMTdFMEIyRDo=")
var url = URI.create("https/api-test.eximbay.com/v1/payments/retrieve")
val body = "{\n" +
"\"mid\" : \"1849705C64\",\n" +
"\"key_field\" : \"transaction_id\", \n" +
"\"payment\" : {\n" +
"\"order_id\" : \"20220902101716\",\n" +
"\"currency\" : \"USD\",\n" +
"\"amount\" : \"1\",\n" +
"\"transaction_id\" : \"20220902101716\",\n" +
"\"lang\" : \"EN\"\n" +
" }\n" +
"}"
var entity = HttpEntity<String>(body, headers)
var response = restTemplate.exchange(url, HttpMethod.POST, entity, String::class.java)
println(response.body)
조회한 transid 와 일치하는 결제의 세부 정보가 Payment 객체로 돌아옵니다.
{
"rescode": "0000",
"resmsg": "Success.",
"mid": "1849705C64",
"payment": {
"order_id": "20220922134409",
"currency": "USD",
"amount": "1",
"transaction_id": "1849705C6420220922000022",
"status": "SALE",
"auth_code": "680591",
"transaction_date": "20220902201749",
"balance": "1.00"
"payment_method": "P101"
},
"card_info": {
"card_number1": "4111",
"card_number4": "1111"
}
}