充值

通过 Stripe 支付集成充值钱包余额。

获取充值配置

GET /api/v1/recharge/config

返回可用的充值档位、汇率和 Stripe 公钥。

const config = await client.getRechargeConfig()
// { tiers: [...], customAmountMin, customAmountMax, exchangeRate, stripePublishableKey }
config = client.get_recharge_config()

创建充值意向

POST /api/v1/recharge/create-intent

创建 Stripe PaymentIntent 用于钱包充值。

字段类型必填描述
tierstring100030005000custom
idempotencyKeystring幂等键(防重复)
customAmountnumber自定义金额(custom 档位时使用)
currencystring货币代码
const intent = await client.createRechargeIntent({
  tier: '1000',
  idempotencyKey: 'unique-key',
})
// { clientSecret, paymentIntentId, orderNo, amount }
intent = client.create_recharge_intent(
    tier="1000",
    idempotencyKey="unique-key",
)

确认支付

POST /api/v1/recharge/confirm

确认已完成的 Stripe 支付并记入钱包。

字段类型描述
paymentIntentIdstringStripe PaymentIntent ID
const order = await client.confirmRechargePayment('pi_xxx')
order = client.confirm_recharge_payment("pi_xxx")

充值历史

GET /api/v1/recharge/history
参数类型描述
limitnumber最大结果数
offsetnumber分页偏移
const history = await client.getRechargeHistory({ limit: 20 })
// { items: [...], total, limit, offset }
history = client.get_recharge_history(limit=20)