stripe-payments - Stripe API : create customer and charge in one request

标签 stripe-payments

假设我有一位新客户正在结账,并希望存储他们的卡以供将来使用。如果我正在阅读 docs是的,我需要分别调用 Stripe,一个调用使用该卡创建客户,另一个调用对该卡进行收费。

考虑到创建费用的端点接受卡的 token 或字典,我很惊讶客户参数的情况并非如此。

我尝试在创建费用请求中为客户发送字典,但没有成功。

我是否被迫调用两个电话?如果是的话,Stripe 是否接受功能请求?

最佳答案

问:我是否被迫调用两个电话?

答:是的,在创建 Stripe 客户后,您必须对 Stripe API 进行两次调用。

如果您的数据库中已存在客户,您只需调用一次 Stripe API,如下所示。在这里,我们创建一笔费用并传递检索到的客户 ID:

Stripe::Charge.create(
  :amount   => 1500,
  :currency => "usd",
  :customer => customer_id
)

Stripe 文档中概述了如何收费:https://stripe.com/docs/tutorials/charges

问:如果是的话,Stripe 是否接受功能请求?

答:我不能 100% 确定 Stripe 是否接受所有语言的功能请求,但它可用于 Go:https://github.com/stripe/stripe-go/blob/master/README.md#development

我会仔细检查每个自述文件的开发部分或直接联系 Stripe 的开发人员 (freenode #stripe)

关于stripe-payments - Stripe API : create customer and charge in one request,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27230939/

相关文章:

javascript - 如何从 Rails Controller 调用 Stripe Checkout

checkout - Stripe 结帐价格错误 - 无效整数

stripe-payments - Stripe API 转账到银行账户

ios - 如何在iOS项目中正确实现Stripe?

ios - Stripe Basic PaymentIntent 确认付款错误

javascript - 使用 Jquery AJAX 进行 Stripe 支付? (仅限 JavaScript)

javascript - 如何验证 Stripe 的 webhook 签名?

stripe-payments - Stripe - 可用于零数量订阅

javascript - Stripe API - 使用 Javascript 检索所有收据(发票)

javascript - 无法从 StripePaymentIntent 对象检索元数据