curl Node.js PHP Python
คัดลอก
curl -X POST https://api.tungkao.com/v1/slip/verify \
-H "Authorization: Bearer $TUNGKAO_KEY" \
-H "Content-Type: application/json" \
-d '{"qr_payload":"0041000600000101030040220014…","expected_amount":"500.00","receivers":[{"bank":"KBANK","account_number":"1234567890"}]}'// Node.js 18+ (ไม่ต้องติดตั้งอะไรเพิ่ม)
const res = await fetch("https://api.tungkao.com/v1/slip/verify", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.TUNGKAO_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
"qr_payload": "0041000600000101030040220014…",
"expected_amount": "500.00",
"receivers": [
{
"bank": "KBANK",
"account_number": "1234567890"
}
]
}),
});
const data = await res.json();
console.log(data);<?php
$ch = curl_init("https://api.tungkao.com/v1/slip/verify");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("TUNGKAO_KEY"), "Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
"qr_payload" => "0041000600000101030040220014…",
"expected_amount" => "500.00",
"receivers" => [
[
"bank" => "KBANK",
"account_number" => "1234567890"
]
]
]),
]);
$data = json_decode(curl_exec($ch), true);
print_r($data);import os, requests # pip install requests
r = requests.post(
"https://api.tungkao.com/v1/slip/verify",
headers={"Authorization": f"Bearer {os.environ['TUNGKAO_KEY']}"},
json={
"qr_payload": "0041000600000101030040220014…",
"expected_amount": "500.00",
"receivers": [
{
"bank": "KBANK",
"account_number": "1234567890"
}
]
},
timeout=30,
)
print(r.json())