kemBusiness
平台产品运作方式薪酬发放价格开发者常见问题
登录立即开始↗

开发者文档

使用 Kem Business API 收取 USDT 付款所需的一切:身份认证、支付端点,以及驱动订单状态的签名 Webhooks。

身份认证付款错误与限制Webhooks测试

身份认证

在仪表盘的「API 密钥」中创建密钥,并在每个请求中以 Bearer token 发送。测试密钥(sk_test_…)创建测试付款;正式密钥(sk_live_…)会转移真实资金。

Authorization: Bearer sk_live_...   # or sk_test_...
Base URL: https://api-business.kemapp.io

Complete business verification (KYB) before creating payments. In the current API this applies to both test and live keys, even though a test key can be created earlier. Owners, admins, developers and custom roles with API-key management permission can create keys; select the intended organization first.

Call this API from your server. Each key belongs to one business and one mode; no X-Org header is needed. Reads return only that key's mode. Keep secrets in your server's secret store, and revoke compromised keys in the dashboard. Dashboard sessions and their private endpoints use a separate authentication flow.

付款

创建付款并将客户引导至托管的 checkout_url——钱包、网络与确认全部由 Kem 处理。可通过查询付款跟踪状态,更推荐使用 Webhooks。

POST/v1/payments
curl -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_example",
  "status": "pending",
  "mode": "test",
  "amount": "25.000000",
  "amount_minor": 25000000,
  "amount_refunded_minor": 0,
  "fee_bps": null,
  "fee_minor": null,
  "net_minor": null,
  "currency": "USDT",
  "network": null,
  "merchant_reference": "order-1042",
  "customer_email": "[email protected]",
  "description": "Pro plan",
  "return_url": "https://yourshop.example/thanks",
  "metadata": {
    "order_id": "1042"
  },
  "checkout_url": "https://dashboard.business.kemapp.io/pay/pay_example",
  "checkout_expires_at": "2026-09-22T13:30:00+00:00",
  "transaction_id": null,
  "detected_at": null,
  "confirmation_pending": false,
  "created_at": "2026-09-22T13:00:00+00:00",
  "updated_at": "2026-09-22T13:00:00+00:00"
}

Returns HTTP 201. Example ids are placeholders. Save the returned id, mode and order reference, then use the returned checkout_url rather than constructing a checkout address.

amount
Required decimal string, e.g. 25 or 25.000000. Positive, at most six decimal places; no JSON number or scientific notation.
currency
USDT; defaults to USDT when omitted.
merchant_reference
Optional order/reference string. Store the returned payment id against your own order.
customer_email
Optional valid customer email.
description
Optional description displayed with the payment.
return_url
Optional destination after checkout. A browser redirect is not proof of successful payment.
metadata
Optional JSON object stored on the payment and returned by payment reads. It is not currently copied into webhook payloads.

Idempotency-Key — 可选但推荐——在默认的 24 小时窗口内,相同 key 和请求体会重放原始响应。

The default retention window is 24 hours and keys are scoped to the business. Within that window, the same key and body replay the original response; a changed body returns 409. After expiry, reuse can create another payment. Keep test and live idempotency keys distinct, and use a fresh key for each new order or simulation scenario.

GET/v1/payments— query: status, limit (1–100, default 20), cursor · returns has_more, next_cursor
GET/v1/payments/{id}
curl "https://api-business.kemapp.io/v1/payments?limit=20&status=succeeded" \
  -H "Authorization: Bearer sk_test_..."

List responses contain data, has_more and next_cursor. Pass next_cursor as cursor on the next request, retaining your filters. Both reads return HTTP 200. A payment belonging to another business or mode is returned as payment_not_found.

amount — decimal string with 6 places in responses ("25.000000"); amount_minor — the same value as an integer in micro-USDT.

fee_minor and net_minor are null while a payment is in flight and are frozen when it succeeds. Reconcile your payout against net_minor, not amount_minor — the difference is our fee (fee_bps).

付款生命周期

pending → detected → succeeded · failed · expired · refunded (legacy)

pending——等待付款 · detected——确认中 · succeeded——已完成(仅在 live 模式下履约)· failed / expired——终态。历史付款也可能具有 refunded 状态。

The default checkout window is 30 minutes. A pending payment with a submitted transaction hash gets a default 24-hour grace period after that window; confirmation_pending and payment.confirmation_delayed flag the delay. Detected payments wait for settlement or a terminal failure. Neither a hash, a redirect, nor a delayed-confirmation event proves payment. Use the payment's status and your stored mode before fulfilling an order.

错误与限制

所有错误使用同一信封。code 是稳定的——请依据 error.code 分支,而不是文案。

HTTP 4xx/5xx
{
  "error": {
    "code": "idempotency_conflict",
    "message": "Idempotency-Key reused with a different request"
  }
}
401 unauthorizedmissing or invalid API key
403 kyb_requiredbusiness verification is required; current payment creation requires approved KYB for test and live keys
403 forbiddenthe action is not allowed, such as simulating with a live key
404 payment_not_foundunknown payment id (or a live id with a test key)
409 idempotency_conflictIdempotency-Key reused with a different body — identical retries replay the original response
422 validation_errorrequest-schema validation failed, such as a missing field or malformed customer_email
422 invalid_amountamount must be a positive decimal string with at most six decimal places, within the supported integer range
422 invalid_currencypayment creation supports USDT only
422 amount_below_minimumamount is below the platform deposit minimum; the error message supplies the current minimum
422 invalid_return_urlthe return URL uses a disallowed scheme
422 invalid_eventunsupported simulation event; use succeeded, failed or expired
429 rate_limitedAPI keys share a default budget of 100 requests/minute across reads and writes; respect Retry-After
500 internal_errorunexpected server error; retry payment creation with the same Idempotency-Key and body

产品、可重复使用的支付链接和 Webhook 端点在仪表盘配置,而非通过公开 API 密钥端点管理。目前仪表盘和商户 API 均不提供商户主动发起退款的功能。

Webhooks

在仪表盘「Webhooks」中添加端点并选择事件。创建时会返回 whsec_… 签名密钥;获得授权的用户可在仪表盘中再次查看。

payment.createdA payment intent was created (API or checkout link).
payment.detectedThe transfer was seen on-chain / in the KEM ledger; confirming.
payment.succeededThe payment reached success. Fulfill only for a live payment associated with your order; simulation emits this event too.
payment.failedThe payment failed.
payment.expiredThe checkout window closed without payment.
payment.confirmation_delayedA transaction hash was submitted but remains unconfirmed past the checkout window. Hold the order; this is not proof of payment.
payment.refund.createdReserved/legacy refund event. The current merchant API and dashboard do not expose refund initiation.
payment.refund.succeededA previously initiated refund completed. Current integrations cannot initiate a merchant refund.
reconciliation.exceptionA reconciliation exception; this non-payment event has its own data object.
webhook.testA test delivery from the dashboard. data contains a message rather than a payment.

事件负载

{
  "id": "evt_example",
  "type": "payment.succeeded",
  "created": "2026-09-22T13:04:12+00:00",
  "data": {
    "payment": {
      "id": "pay_example",
      "status": "succeeded",
      "amount_minor": 25000000,
      "currency": "USDT",
      "merchant_reference": "order-1042",
      "network": null,
      "product_id": null,
      "payment_link_id": null,
      "fee_minor": 0,
      "net_minor": 25000000
    }
  }
}

This is a zero-fee success example. fee_minor and net_minor are nullable before success. Payment webhooks currently omit mode, customer_email and the original metadata. Keep your own payment-id-to-order/mode mapping; retrieve an unknown payment with the appropriate key before acting. A simulated payment.succeeded must not fulfill a live order.

验证签名

每次推送都带有 Kem-Signature。对「<t>.」加原始请求字节验证 HMAC,并做恒定时间比较;拒绝与当前时间相差超过 300 秒的时间戳,并按事件 id 去重。

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| > 300s
# also deduplicate the event body id before applying business effects
import crypto from "node:crypto";

export function verifyKemSignature(rawBody, header, secret) {
  if (!Buffer.isBuffer(rawBody) || typeof header !== "string") return false;
  const match = /^t=([0-9]{1,16}),v1=([0-9a-fA-F]{64})$/.exec(header.trim());
  if (!match) return false;

  const timestamp = Number(match[1]);
  if (!Number.isSafeInteger(timestamp)) return false;
  if (Math.abs(Date.now() / 1000 - timestamp) > 300) return false;

  const expected = crypto.createHmac("sha256", secret)
    .update(match[1] + ".")
    .update(rawBody) // exact bytes, before JSON parsing
    .digest();
  const received = Buffer.from(match[2], "hex");
  return crypto.timingSafeEqual(expected, received);
}
import hashlib
import hmac
import re
import time

def verify_kem_signature(raw_body: bytes, header: str, secret: str) -> bool:
    if not isinstance(header, str):
        return False
    match = re.fullmatch(r"t=([0-9]{1,16}),v1=([0-9a-fA-F]{64})", header.strip())
    if match is None:
        return False
    if abs(time.time() - int(match[1])) > 300:
        return False

    expected = hmac.new(
        secret.encode(), (match[1] + ".").encode() + raw_body, hashlib.sha256
    ).digest()
    return hmac.compare_digest(expected, bytes.fromhex(match[2]))

Verify before parsing JSON: use a Buffer from express.raw in Node, or raw request bytes such as request.get_data() in Flask. Do not reserialize a parsed object. These examples reject malformed headers, invalid signatures, and timestamps over five minutes in the past or future. Keep the receiver's clock synchronized.

投递与重试

请尽快返回 2xx。失败的投递会按退避策略重试,最终进入死信:

1m · 5m · 30m · 2h · 12h · 24h

There are seven attempts including the initial delivery. The delays above apply between retries. Deliveries may repeat or arrive out of order: deduplicate by the top-level event id, durably record or queue the event before acknowledging it, and keep fulfillment idempotent per payment. The timestamp/signature is refreshed on each retry. Review failed deliveries in Webhooks; use a payment read when you need its latest state.

测试

KYB 获批后,使用测试密钥创建付款并模拟 succeeded、failed 或 expired。这些调用可测试付款事件和 Webhooks,无需真实转账:

curl -X POST https://api-business.kemapp.io/v1/payments/{id}/_simulate/succeeded \
  -H "Authorization: Bearer sk_test_..."

Replace {id} with a test payment id. Supported event names are succeeded, failed and expired; live keys are rejected. Create a fresh payment for each terminal outcome. Use simulation for test payments rather than sending real funds. Test and live payments can notify the same subscribed webhook endpoint, so retain the mode from creation.

BUILT IN THE GULF · SETTLED IN USDT ·
kemBusiness

收款,
就用稳定币。

打开后台,今天就收下你的第一笔 USDT 付款 — 或与我们在 20 分钟通话中一起走一遍流程。

打开后台↗预约通话↗

已是 kem 用户? 登录

产品

  • 登录
  • 创建账户
  • 预约演示

Kem 服务大众

  • 消费者 App
  • iOS — App Store
  • Android — Google Play

公司

  • Tether 投资
  • 隐私政策
  • 条款与条件

Kem 是一个加密服务生态系统,让世界各地的人们获得财务自由。

© 2026 Kem · 本网站内容,包括通过本网站提供的所有信息、材料和文件,均属 KEM TECHNOLOGIES HOLDING Ltd(注册于阿布扎比全球市场,公司编号 000008598)的机密及专有财产。未经 KEM TECHNOLOGIES HOLDING Ltd 事先书面同意,严禁全部或部分地使用、披露、分发或复制这些内容。 [email protected]

立足海湾。