gpt4 book ai didi

grails - 从 strip 中的充电中检索卡信息

转载 作者:行者123 更新时间:2023-12-02 16:00:14 24 4
gpt4 key购买 nike

我正在使用以下方式触发收费:

charge = Charge.create(chargeParams)

在chargeParams中,我传递了与 strip 关联的卡ID,但在费用对象中,卡对象为空。我如何获取卡信息。从条纹收费。我也尝试了Charge.retrieve(id),但它也为卡返回了null。

最佳答案

您可以使用以下存储卡创建费用:

token = params[:stripeToken]

# create a Customer
customer = Stripe::Customer.create(
card: token,
description: 'description for payinguser@example.com',
email: 'payinguser@example.com'
)

# charge the Customer instead of the card
Stripe::Charge.create(
amount: 1000, # in cents
currency: 'usd',
customer: customer.id
)

进一步 reference

关于grails - 从 strip 中的充电中检索卡信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32047902/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com