简体   繁体   English

创建条带卡的异常

[英]Exception creating a card in stripe

I'm trying to add a card to a customer with the following code: 我正在尝试使用以下代码向客户添加卡片:

cu = stripe.Customer.retrieve(customer_id)
cu.cards.create(card=token)

However, I am getting the following exception: 但是,我得到以下异常:

'ListObject' object has no attribute 'create'

It seems cu.cards does not have a "create" method. 似乎cu.cards没有“创建”方法。

I'm using the 1.12.0 library for python. 我正在使用1.12.0库来进行python。

What am I doing wrong here? 我在这做错了什么?

Welp, I was dumb, and I guess I'll just leave this question and answer here in case anyone else can benefit from it. 韦尔普,我是愚蠢的,我想我会留下这个问题并在这里回答,以防其他任何人从中受益。

I was not using the latest version of the api on my account. 我没有在我的帐户上使用最新版本的api。 Apparently you can click on Account Settings->API Keys, and upgrade the API that your account uses. 显然,您可以单击“帐户设置” - >“API密钥”,然后升级您的帐户使用的API。 I was using a rather old version of the api. 我使用的是相当旧的api版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM