You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Pabbly中通过Stripe创建带订阅客户的API调用错误求助

问题解决:Pabbly关联Stripe创建订阅时的卡号提交错误

核心原因

Stripe的安全规则禁止直接向API提交原始信用卡信息,必须使用Stripe生成的**支付令牌(Token)**来替代卡号、有效期、CVV等敏感信息。而Pabbly在指定gateway_type: "Stripe"时,会直接将请求转发给Stripe API,因此必须遵循Stripe的要求。

解决方案步骤

  1. 生成Stripe测试支付令牌

    • 使用Stripe的测试工具生成对应测试卡号的令牌:比如测试卡号4111111111111111,可以通过Stripe.js客户端SDK在前端生成,或者在Stripe后台的测试面板中获取预先生成的测试令牌。
  2. 修改Pabbly的API请求参数

    • 删除请求体中的card_number、month、year、cvv字段
    • 添加stripe_token字段(或Pabbly API文档中指定的令牌字段名),值为你生成的Stripe测试令牌
    • 保持gateway_type: "Stripe"和其他客户、计划信息不变

修改后的示例请求:

curl --location 'https://payments.pabbly.com/api/v1/subscription' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic YTY2Njc4ZGYzOGYzMDllY2I5************************************' \
--header 'Cookie: SameSite=None' \
--data-raw '{
    "first_name": "john",
    "last_name": "smith",
    "email": "jhonsmith@xxxxx.com",
    "gateway_type": "Stripe",
    "gateway_id": "6503********",
    "street": "arera colony",
    "city": "Bhopal",
    "state": "MP",
    "zip_code": "462016",
    "country": "IN",
    "plan_id": "5e***************",
    "redirect_to": "https://www.pabbly.com/",
    "plan_amount": "10",
    "quantity": "1",
    "stripe_token": "tok_visa"
}'

(注:tok_visa是Stripe提供的测试令牌示例,实际需使用你生成的有效令牌)

  1. 验证请求
    • 发送修改后的请求,此时Stripe会通过令牌识别测试卡信息,不会再返回安全错误,同时Pabbly也不会提示卡号必填。

补充说明

  • 设置gateway_type: "test"能正常运行,是因为这是Pabbly自身的测试模式,不经过Stripe API,因此允许直接提交卡号。
  • 生产环境中,必须通过前端Stripe SDK生成令牌,绝对不能在后端直接处理或传输原始卡信息,否则会违反PCI合规要求。

内容的提问来源于stack exchange,提问作者Sanjay Mokariya

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 14:18:21