跳轉到主要內容
常用啟潤支付 API 操作的多語言完整程式碼範例。

建立產品

curl -X POST https://api.kyren.top/v1/products \
  -H "Content-Type: application/json" \
  -H "x-api-key: kyren_live_xxxxxxxxxxxx" \
  -d '{
    "name": "1000 AI Credits",
    "description": "充值 1000 個 AI API 額度",
    "price": "9.99",
    "currency": "USD",
    "metadata": {
      "credits": "1000"
    }
  }'

建立 Checkout Session

curl -X POST https://api.kyren.top/v1/checkouts \
  -H "Content-Type: application/json" \
  -H "x-api-key: kyren_live_xxxxxxxxxxxx" \
  -d '{
    "productId": "prod_abc123",
    "successUrl": "https://yoursite.com/success",
    "cancelUrl": "https://yoursite.com/cancel",
    "customerEmail": "customer@example.com",
    "metadata": {
      "userId": "user_456"
    }
  }'

查詢訂單列表

curl https://api.kyren.top/v1/orders?status=PAID&page=1&size=10 \
  -H "x-api-key: kyren_live_xxxxxxxxxxxx"

查詢帳戶餘額

curl https://api.kyren.top/v1/balance \
  -H "x-api-key: kyren_live_xxxxxxxxxxxx"

驗證 Webhook 簽名

請參閱 Webhook 簽名驗證 頁面,取得 Node.js、Python 和 Go 的完整驗證範例。