【问题标题】:How to retrive Stripe card ID added via Stripe customer portal?如何检索通过 Stripe 客户门户添加的 Stripe 卡 ID?
【发布时间】:2021-02-23 20:06:47
【问题描述】:

如何检索通过 Stripe 客户门户添加的 Stripe 卡 ID?

当我尝试通过以下方式访问它时它不可见:

test = stripe.Customer.list_sources(
    'cus_Izw...',
     object="card",
     limit=3,
)

我在回复中看到了这一点:

{
    "data": [],
    "has_more": false,
    "object": "list",
    "url": "/v1/customers/cus_Izw.../sources"
}

【问题讨论】:

    标签: stripe-payments


    【解决方案1】:

    通过客户门户添加的卡是 PaymentMethods 而不是 Sources。为了列出它们,您可以使用/v1/payment_methods。在 Python 中,它看起来像:

    stripe.PaymentMethod.list(
      customer="cus_xxx",
      type="card",
    )
    

    【讨论】:

    • 看起来不错,但是响应中没有卡ID,例如:card_Izza42koJ6LKGpF
    • 是的,PaymentMethod 是一个 pm_xxx,卡信息是卡属性的一部分:stripe.com/docs/api/payment_methods/…
    猜你喜欢
    • 2014-02-22
    • 2018-05-21
    • 2015-02-14
    • 2021-12-30
    • 2020-03-28
    • 2015-05-08
    • 1970-01-01
    • 2020-11-15
    • 2017-04-20
    相关资源
    最近更新 更多