asset debug
注意 该文档下的接口仅在 debug 环境有效,仅用作 debug/test 目的,请不要在生产环境使用该文档下的接口。
1. 确认(confirm) stripe setup_intent
POST /bp/asset/debug/stripe_setup_intent/confirm
接口功能: 确认(confirm) stripe setup_intent 对象,确认完成并成功后,该 setup_intent 就绑定了有效的支付方式。
请求头部参数 (Headers)
- X-BytePower-Session-Token:登录后获取用户的 session。
- X-BytePower-Sign:请求体签名
请求体
- content-type: "application/json"
| Parameters | Type | Required | Desc |
|---|---|---|---|
| setup_intent_id | string | true | 待 confirm 的 setup_intent id |
| product_id | string | false | confirm setup_intent 后需要购买的 bytepower product_id,服务端根据该 product_id 获取 stripe 平台配置,并进行 setup_intent 的 confirm。该参数是新版本添加,不传该参数默认会使用 Default stripe 配置创建 setup_intent |
| card | card object | true | 银行卡信息 |
card 数据结构见 card 对象说明。
- 请求体示例:
{
"setup_intent_id": "seti_1P13VDJVLLsB4FeS8Zw9PuvS",
"card": {
"number": "5555555555554444",
"exp_month": "10",
"exp_year": "2025",
"cvc": "872"
},
"product_id": "BUYCR5KERJIJ5ZMX"
}响应
- HTTP 状态码:200
| 参数 | Type | Desc |
|---|---|---|
| stripe_setup_intent | object | stripe setup_intent 信息 |
stripe_setup_intent 数据结构见 stripe_setup_intent 对象说明
响应示例:
{
"stripe_setup_intent": {
"client_secret": "seti_1LLeMFJeDjdpBmRtt3DLRafc_secret_M3luBC3YKrbUagrYv179TAPA4I6lE5C",
"customer_id": "cus_M3lueBoXO9uQTF",
"id": "seti_1LLeMFJeDjdpBmRtt3DLRafc",
"payment_method_id": "pm_1P13VDJVLLsB4FeS9NLPEty0",
"status": "requires_payment_method"
}
}HTTP 状态码:4xx 描述:错误 响应示例:
{
"error": {
"error_type": "invalid_parameter",
"message": "xxxxx"
}
}error_type:
- invalid_parameter (请求参数错误)
- config_invalid (console 配置问题)
- backend unavailable (stripe 第三方错误)
2. 确认(confirm) stripe payment_intent
POST /bp/asset/debug/stripe_payment_intent/confirm
接口功能: 确认(confirm) stripe payment_intent 对象,确认完成并成功后,该 payment_intent 就支付成功了。
请求头部参数 (Headers)
- X-BytePower-Session-Token:登录后获取用户的 session。
- X-BytePower-Sign:请求体签名
请求体
- content-type: "application/json"
| Parameters | Type | Required | Desc |
|---|---|---|---|
| payment_intent_id | string | true | 待 confirm 的 payment_intent id |
| product_id | string | false | confirm payment_intent 后需要购买的 bytepower product_id,服务端根据该 product_id 获取 stripe 平台配置,并进行 payment_intent 的 confirm。该参数是新版本添加,不传该参数默认会使用 Default stripe 配置创建 payment_intent |
| card | card object | false | 银行卡信息,与 payment_method_id 二选一 |
| payment_method_id | string | false | 使用的 payment_method_id,与 card 二选一 |
card 数据结构见 card 对象说明。
在 confirm payment_intent 时,card 与 payment_method_id 二选一即可。 如果是首先创建了 setup_intent 或有其它可用的 payment_method_id,此处可以使用 setup_intent 里面的 payment_method_id 或现有的 payment_method_id 进行 confirm 和 支付;如果是直接创建了 payment_intent,没有关联支付方式,则此处可以使用卡号。
- 请求体示例:
{
"payment_intent_id": "pi_1P13VDJVLLsB4FeS8Zw9PuvS",
"card": {
"number": "5555555555554444",
"exp_month": "10",
"exp_year": "2025",
"cvc": "872"
},
"product_id": "BUYCR5KERJIJ5ZMX"
}{
"payment_intent_id": "pi_1P13VDJVLLsB4FeS8Zw9PuvS",
"payment_method_id": "pm_1P13fcJVLLsB4FeS7JcL73cx",
"product_id": "BUYCR5KERJIJ5ZMX"
}响应
- HTTP 状态码:200
| 参数 | Type | Desc |
|---|---|---|
| stripe_payment_intent | object | stripe payment_intent 信息 |
stripe_payment_intent 数据结构见 stripe_payment_intent 对象说明
响应示例:
{
"stripe_payment_intent": {
"id": "pi_3P13fbJVLLsB4FeS1hXgTglx",
"client_secret": "pi_3P13fbJVLLsB4FeS1hXgTglx_secret_qfnZDx5o1UwcPgCqAObfdJNAx",
"status": "succeeded",
"payment_method_id": "pm_1P13fcJVLLsB4FeS7JcL73cx",
"customer_id": "cus_PqlBxlzePliAKG",
"amount": 1000,
"currency": "usd"
}
}HTTP 状态码:4xx 描述:错误 响应示例:
{
"error": {
"error_type": "invalid_parameter",
"message": "xxxxx"
}
}error_type:
- invalid_parameter (请求参数错误)
- config_invalid (console 配置问题)
- backend unavailable (stripe 第三方错误)
3. 修改 stripe subscription 的默认支付方式
POST /bp/asset/debug/stripe_sub/{sub_id}/default_payment_method
接口功能: 修改 stripe 订阅的默认支付方式
请求头部参数 (Headers)
- X-BytePower-Session-Token:登录后获取用户的 session。
- X-BytePower-Sign:请求体签名
请求体
- content-type: "application/json"
| Parameters | Type | Required | Desc |
|---|---|---|---|
| payment_method_name | string | true | payment_method 名字,如 pm_card_authenticationRequiredChargeDeclinedInsufficientFunds,其它名字请参考 stripe 官方文档 |
| config_name | string | true | bytepower console 配置的 stripe 第三方平台配置名字,如 Default |
- 请求体示例:
{
"payment_method_name": "pm_card_authenticationRequiredChargeDeclinedInsufficientFunds",
"config_name": "Default"
}响应
- HTTP 状态码:200
{}
响应示例:
{}HTTP 状态码:4xx 描述:错误 响应示例:
{
"error": {
"error_type": "invalid_parameter",
"message": "xxxxx"
}
}error_type:
- invalid_parameter (请求参数错误)
- backend unavailable (stripe 第三方错误)
4. 创建 paddle 的 adjustment 事件并发送给 bytepower
POST /bp/asset/debug/paddle/adjustment_event
接口功能: 模拟 paddle 的 adjustment 事件通知,创建 paddle adjustment event 并把该事件发送给 bytepower server 的 paddle callback 地址。该接口生成的 paddle 事件只包含了一些测试必要的字段,没有生成全部的字段,后续有必要再补充。
请求头部参数 (Headers)
- X-BytePower-Session-Token:登录后获取用户的 session。
- X-BytePower-Sign:请求体签名
请求体
- content-type: "application/json"
| Parameters | Type | Required | Desc |
|---|---|---|---|
| transaction_id | string | true | paddle 平台真实的 transaction_id |
| event_type | string | true | paddle 平台的事件名称,仅支持 adjustment.created 或 adjustment.updated |
| action | string | true | adjustment 的 action,取值可为 credit, refund, chargeback, chargeback_reverse, chargeback_warning, chargeback_warning_reverse 或 credit_reverse |
| status | string | true | adjustment 的 status,取值可为 pending_approval, approved, rejected 或 reversed |
| config_name | string | false | bytepower console 配置的 paddle 第三方平台配置名字,如 Default,不填默认为 Default |
action 和 status 等事件相关字段的详细解释请参考 paddle 的文档:adjustment.created adjustment.updated
- 请求体示例:
{
"transaction_id": "txn_01kkdd2v99eaw7s791qengg533",
"event_type": "adjustment.created",
"action": "chargeback_warning",
"status": "approved",
"config_name": "Default"
}响应
- HTTP 状态码:200
| 参数 | Type | Desc |
|---|---|---|
| event | object | 创建的 paddle event |
| response | string | bytepower paddle callback 的返回 |
| status | string | 事件发送状态 |
响应示例:
{
"event": {
"event_id": "evt_debug_1773216845109637056",
"event_type": "adjustment.updated",
"occurred_at": "2026-03-11T08:14:05Z",
"notification_id": "ntf_debug_1773216845109637056",
"data": {
"id": "adj_debug_1773216845109637056",
"action": "chargeback_warning",
"type": "full",
"transaction_id": "txn_01kkdd2v99eaw7s791qengg533",
"subscription_id": "sub_01kkdd3akbpb9d403amnevg8nq",
"customer_id": "ctm_01kex7ktnjg40256hvy4dcgb4c",
"reason": "Debug adjustment event",
"currency_code": "USD",
"status": "approved",
"totals": {
"subtotal": "459",
"tax": "41",
"total": "500"
},
"created_at": "2026-03-11T08:14:05Z",
"updated_at": "2026-03-11T08:14:05Z"
}
},
"response": "",
"status": "sent"
}HTTP 状态码:4xx 描述:错误 响应示例:
{
"error": {
"error_type": "invalid_parameter",
"message": "xxxxx"
}
}error_type:
- invalid_parameter (请求参数错误)
- backend unavailable (stripe 第三方错误)
数据结构
card
| 参数 | 类型 | 说明 |
|---|---|---|
| number | string | 卡号 |
| exp_month | string | 过期月份,如 10 |
| exp_year | string | 过期年份,如 2028 |
| cvc | string | 信用卡 cvc |
示例如下:
{
"number": "4242424242424242",
"exp_month": "10",
"exp_year": "2025",
"cvc": "872"
}