Stripe payments 捕获条带源创建中的错误

Stripe payments 捕获条带源创建中的错误,stripe-payments,Stripe Payments,我正在运行以下代码,但失败了 stripe_card_response = customer.sources.create(source=source) 我得到的答复如下: File "/opt/python/run/venv/local/lib/python3.6/site-packages/stripe/stripe_object.py", line 50, in __getattr__ raise AttributeError(*err.args) Att

我正在运行以下代码,但失败了

stripe_card_response = customer.sources.create(source=source)
我得到的答复如下:

  File "/opt/python/run/venv/local/lib/python3.6/site-packages/stripe/stripe_object.py", line 50, in __getattr__
    raise AttributeError(*err.args)
AttributeError: sources
在我的python代码中,我会捕获与此失败相关的错误,以便打印它吗


谢谢

我认为您可能正在使用不再受支持的旧语法。要将源附加到客户,您需要执行以下操作:

customer = stripe.Customer.modify(customer.id, source=source)

条带表示。创建仍然有效