【问题标题】:Retrieve Card Info from Charge in Stripe从 Stripe 中的 Charge 中检索卡信息
【发布时间】:2015-08-17 10:18:01
【问题描述】:

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

charge = Charge.create(chargeParams)

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

【问题讨论】:

  • 你能发布你的chargeParams吗?

标签: grails stripe-payments


【解决方案1】:

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

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

【讨论】:

  • 我知道如何使用存储的卡。(通过传递卡 ID)。但我想取卡。信息。从充电对象。我找到了另一种方法。我可以使用 Token.retrieve(id) 然后使用 token.card。
猜你喜欢
  • 1970-01-01
  • 2019-03-20
  • 2018-05-21
  • 2019-10-29
  • 2018-12-11
  • 2019-09-15
  • 2021-11-19
  • 1970-01-01
  • 2020-03-28
相关资源
最近更新 更多