Request a payment
Endpoint for calling the Excoinz Pay window.
Request Syntax
POST /payment/ready HTTP/1.1
Host: api.excoinz.com
EXCOINZ_SECRET: ${SECRET_KEY}
Authorization: Bearer ${ACCESS_TOKEN}
Content-Type: application/json
Setting the AccessToken Header is required.
All requests must be made from the registered server/domain.
If you need an id/secret for testing, please contact partner@excoinz.com
Request
Response
Sample
curl -X POST https://api.excoinz.com/payment/ready \
-H "EXCOINZ_SECRET: ${SECRET_KEY}" \
-H "Authorization: Bearer ${ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"client_id": "YOUR_CLIENT_ID",
"partner_order_id": "YOUR_PARTNER_ORDER_ID",
"partner_user_id": "YOUR_PARTNER_USER_ID",
"asset_symbol": "YOUR_ASSET_SYMBOL",
"amount": "YOUR_AMOUNT",
"approval_url": "YOUR_APPROVAL_URL",
"cancel_url": "YOUR_CANCEL_URL",
"fail_url": "YOUR_FAIL_URL",
"locale": "YOUR_LOCALE"
}'
const axios = require('axios');
const requestData = {
client_id: 'YOUR_CLIENT_ID',
partner_order_id: 'YOUR_PARTNER_ORDER_ID',
partner_user_id: 'YOUR_PARTNER_USER_ID',
asset_symbol: 'YOUR_ASSET_SYMBOL',
amount: 'YOUR_AMOUNT',
approval_url: 'YOUR_APPROVAL_URL',
cancel_url: 'YOUR_CANCEL_URL',
fail_url: 'YOUR_FAIL_URL',
locale: 'YOUR_LOCALE'
};
axios.post('https://api.excoinz.com/payment/ready', requestData, {
headers: {
'EXCOINZ_SECRET': 'YOUR_SECRET_KEY',
'Authorization': `Bearer YOUR_ACCESS_TOKEN`,
'Content-Type': 'application/json'
}
})
.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/ready";
private static final String SECRET_KEY = "YOUR_SECRET_KEY";
private static final String ACCESS_TOKEN = "YOUR_ACCESS_TOKEN";
public ResponseEntity<String> makePayment() {
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, Object> body = new HashMap<>();
body.put("client_id", "YOUR_CLIENT_ID");
body.put("partner_order_id", "YOUR_PARTNER_ORDER_ID");
body.put("partner_user_id", "YOUR_PARTNER_USER_ID");
body.put("asset_symbol", "YOUR_ASSET_SYMBOL");
body.put("amount", "YOUR_AMOUNT");
body.put("approval_url", "YOUR_APPROVAL_URL");
body.put("cancel_url", "YOUR_CANCEL_URL");
body.put("fail_url", "YOUR_FAIL_URL");
body.put("locale", "YOUR_LOCALE");
HttpEntity<Map<String, Object>> 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/ready';
$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",
"partner_order_id" => "YOUR_PARTNER_ORDER_ID",
"partner_user_id" => "YOUR_PARTNER_USER_ID",
"asset_symbol" => "YOUR_ASSET_SYMBOL",
"amount" => "YOUR_AMOUNT",
"approval_url" => "YOUR_APPROVAL_URL",
"cancel_url" => "YOUR_CANCEL_URL",
"fail_url" => "YOUR_FAIL_URL",
"locale" => "YOUR_LOCALE"
);
$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