డెవలపర్ డాక్యుమెంటేషన్
Kem Business API తో USDT చెల్లింపులు స్వీకరించడానికి కావలసినదంతా: ప్రామాణీకరణ, పేమెంట్ endpoints, మీ ఆర్డర్ స్థితిని నడిపే సంతకం చేసిన webhooks.
ప్రామాణీకరణ
డాష్బోర్డ్లో «API keys» విభాగంలో కీలను సృష్టించి, ప్రతి అభ్యర్థనలో secret key ను Bearer token గా పంపండి. టెస్ట్ కీలు (sk_test_…) టెస్ట్ చెల్లింపులను సృష్టిస్తాయి; లైవ్ కీలు (sk_live_…) నిజమైన డబ్బును కదిలిస్తాయి.
Authorization: Bearer sk_live_... # or sk_test_...
Base URL: https://api-business.kemapp.ioచెల్లింపులు
చెల్లింపును సృష్టించి కస్టమర్ను దాని hosted checkout_url కు పంపండి — వాలెట్లు, నెట్వర్క్లు, నిర్ధారణలు Kem చూసుకుంటుంది. స్థితిని చెల్లింపును fetch చేసి లేదా ఇంకా మంచిది, webhooks ద్వారా ట్రాక్ చేయండి.
/v1/paymentscurl -X POST https://api-business.kemapp.io/v1/payments \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-1042" \
-d '{
"amount": "25.000000",
"currency": "USDT",
"merchant_reference": "order-1042",
"customer_email": "[email protected]",
"description": "Pro plan",
"return_url": "https://yourshop.example/thanks",
"metadata": {"order_id": "1042"}
}'{
"id": "pay_01J...",
"status": "pending",
"mode": "test",
"amount": "25.000000",
"amount_minor": 25000000,
"currency": "USDT",
"merchant_reference": "order-1042",
"checkout_url": "https://pay.kemapp.io/pay_01J...",
"checkout_expires_at": "2026-07-13T13:30:00+00:00",
"created_at": "2026-07-13T13:00:00+00:00"
}Idempotency-Key — ఐచ్ఛికం కానీ సిఫార్సు — అదే key తో మళ్లీ ప్రయత్నిస్తే నకలు బదులు అసలు చెల్లింపే తిరిగి వస్తుంది.
/v1/payments— query: status, limit (1–100, default 20), cursor · returns has_more, next_cursor/v1/payments/{id}amount — decimal string with 6 places ("25.000000"); amount_minor — the same value as an integer in micro-USDT.
చెల్లింపు జీవితచక్రం
pending → detected → succeeded · failed · expired
pending — బదిలీ కోసం వేచి ఉంది · detected — చైన్పై కనిపించింది, నిర్ధారణలో · succeeded — మీ వాలెట్లో నిధులు ఖరారు (దీనిపై ఆర్డర్ నెరవేర్చండి) · failed / expired — తుది. రీఫండ్ మార్పులు webhook ఈవెంట్లుగా వస్తాయి.
checkout window: 30 minutes, then → expired
లోపాలు & పరిమితులు
అన్ని లోపాలు ఒకే envelope వాడతాయి. కోడ్లు స్థిరమైనవి — సందేశంపై కాదు, error.code పై బ్రాంచ్ చేయండి.
HTTP 4xx/5xx
{
"error": {
"code": "idempotency_conflict",
"message": "Idempotency-Key reused with a different request"
}
}| 401 unauthorized | missing or invalid API key |
| 404 not_found | unknown payment id (or a live id with a test key) |
| 409 idempotency_conflict | Idempotency-Key reused with a different body — identical retries replay the original response |
| 422 (validation) | malformed body — bad amount, unsupported currency |
| 429 rate_limited | over the per-key budget: 100 writes/min, 1000 reads/min |
ఉత్పత్తులు, చెల్లింపు లింకులు, webhook endpoints, రీఫండ్లు డాష్బోర్డ్ నుండి నిర్వహించబడతాయి — వాటికి పబ్లిక్ REST endpoints ఇంకా లేవు.
Webhooks
డాష్బోర్డ్లో «Webhooks» విభాగంలో endpoint జోడించి కావలసిన ఈవెంట్లను ఎంచుకోండి. ప్రతి endpoint కు సొంత whsec_… సంతక రహస్యం ఉంటుంది — సృష్టించేటప్పుడు ఒక్కసారే చూపబడుతుంది.
| payment.created | A payment intent was created (API or checkout link). |
| payment.detected | The transfer was seen on-chain / in the KEM ledger; confirming. |
| payment.succeeded | Funds are confirmed in your business wallet. Fulfill on this event. |
| payment.failed | The payment failed. |
| payment.expired | The checkout window closed without payment. |
| payment.refund.created | A refund was initiated from the dashboard. |
| payment.refund.succeeded | The refund settled back to the customer. |
ఈవెంట్ payload
{
"id": "payment_event_01J...",
"type": "payment.succeeded",
"created": "2026-07-13T13:04:12+00:00",
"data": {
"payment": {
"id": "pay_01J...",
"status": "succeeded",
"amount_minor": 25000000,
"currency": "USDT",
"merchant_reference": "order-1042",
"network": "TRON",
"product_id": null,
"payment_link_id": null
}
}
}సంతకాల ధృవీకరణ
ప్రతి డెలివరీలో Kem-Signature హెడర్ ఉంటుంది. మీ endpoint రహస్యంతో «<t>.» + ముడి బాడీపై HMAC ను మళ్లీ లెక్కించి constant-time పోలిక చేయండి. సరిపోలనివి తిరస్కరించండి.
Kem-Signature: t=<unix_timestamp>,v1=<hmac_sha256_hex>
signed_input = "<t>." + raw_request_body
v1 = HMAC_SHA256(endpoint_secret, signed_input) # secret: whsec_...
# reject replays: drop the delivery when |now - t| > 300simport crypto from "node:crypto";
export function verifyKemSignature(rawBody, header, secret) {
// header: "t=1720000000,v1=hex"
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
const expected = crypto
.createHmac("sha256", secret) // secret: whsec_...
.update(`${parts.t}.`)
.update(rawBody) // the RAW request bytes
.digest("hex");
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}import hashlib, hmac
def verify_kem_signature(raw_body: bytes, header: str, secret: str) -> bool:
parts = dict(p.split("=") for p in header.split(","))
expected = hmac.new(
secret.encode(), f"{parts['t']}.".encode() + raw_body, hashlib.sha256
).hexdigest()
return hmac.compare_digest(expected, parts["v1"])డెలివరీ & రీట్రైలు
త్వరగా 2xx తో స్పందించండి. విఫల డెలివరీలు backoff తో మళ్లీ ప్రయత్నించబడి, ఆపై dead-letter అవుతాయి:
1m · 5m · 30m · 2h · 12h · 24h
పరీక్ష
టెస్ట్ key తో డబ్బు కదల్చకుండా చెల్లింపును పూర్తి జీవితచక్రం ద్వారా నడపవచ్చు — పరివర్తనలను simulate చేసి మీ webhooks రావడం చూడండి:
curl -X POST https://api-business.kemapp.io/v1/payments/{id}/_simulate/succeeded \
-H "Authorization: Bearer sk_test_..."