Validate a transaction
Endpoint for validating transaction results
Request Syntax
POST /payment/validate HTTP/1.1
Host: api.excoinz.com
EXCOINZ_SECRET: ${SECRET_KEY}
Content-Type: application/json
Proceed via the TID used in the payment request
All requests must be made from the registered server/domain.
Request
Response
Sample
curl -X POST https://api.excoinz.com/payment/validate \
-H "EXCOINZ_SECRET: ${SECRET_KEY}" \
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"client_id": "YOUR_CLIENT_ID",
"tid": "YOUR_TID",
"partner_order_id": "YOUR_PARTNER_ORDER_ID",
"partner_user_id": "YOUR_PARTNER_USER_ID"
}'
const axios = require('axios');
const SECRET_KEY = 'YOUR_SECRET_KEY';
const ACCESS_TOKEN = 'YOUR_ACCESS_TOKEN';
const requestData = {
client_id: 'YOUR_CLIENT_ID',
tid: 'YOUR_TID',
partner_order_id: 'YOUR_PARTNER_ORDER_ID',
partner_user_id: 'YOUR_PARTNER_USER_ID'
};
const config = {
headers: {
'EXCOINZ_SECRET': SECRET_KEY,
'Authorization': `Bearer ${ACCESS_TOKEN}`,
'Content-Type': 'application/json'
}
};
axios.post('https://api.excoinz.com/payment/validate', requestData, config)
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error);
});
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.util.HashMap;
import java.util.Map;
@Service
public class ExcoinzService {
private static final String ENDPOINT_URL = "https://api.excoinz.com/payment/validate";
private static final String SECRET_KEY = "YOUR_SECRET_KEY";
private static final String ACCESS_TOKEN = "YOUR_ACCESS_TOKEN";
public ResponseEntity<String> validatePayment() {
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("EXCOINZ_SECRET", SECRET_KEY);
headers.setBearerAuth(ACCESS_TOKEN);
Map<String, String> body = new HashMap<>();
body.put("client_id", "YOUR_CLIENT_ID");
body.put("tid", "YOUR_TID");
body.put("partner_order_id", "YOUR_PARTNER_ORDER_ID");
body.put("partner_user_id", "YOUR_PARTNER_USER_ID");
HttpEntity<Map<String, String>> entity = new HttpEntity<>(body, headers);
ResponseEntity<String> response = restTemplate.exchange(ENDPOINT_URL, HttpMethod.POST, entity, String.class);
return response;
}
}
<?php
$url = 'https://api.excoinz.com/payment/validate';
$SECRET_KEY = 'YOUR_SECRET_KEY';
$ACCESS_TOKEN = 'YOUR_ACCESS_TOKEN';
$headers = array(
"EXCOINZ_SECRET: $SECRET_KEY",
"Authorization: Bearer $ACCESS_TOKEN",
"Content-Type: application/json"
);
$data = array(
"client_id" => "YOUR_CLIENT_ID",
"tid" => "YOUR_TID",
"partner_order_id" => "YOUR_PARTNER_ORDER_ID",
"partner_user_id" => "YOUR_PARTNER_USER_ID"
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if ($error = curl_error($ch)) {
die('cURL error: ' . $error);
}
curl_close($ch);
echo $response;
?>
Last updated