我今天早些时候把这个放在一起:
import stripe
stripe.api_key = "sk_test_key"
stripe.Token.create(
card={
"number": '4242424242424242',
"exp_month": 12,
"exp_year": 2018,
"cvc": '123'
},
)
stripe.Customer.create(
description="test test test",
source="tok_visa"
)
stripe.Customer.list(limit=1)
stripe.Subscription.create(
customer="id",
items=[
{
"plan": "1",
},
],
)
运行此返回此
read-only@bash: Traceback (most recent call last):
File "main.py", line 28, in <module> "plan": "1",
File "/tmp/stripe/api_resources/subscription.py", line 33, in create return super(Subscription, cls).create(**params)
File "/tmp/stripe/api_resources/abstract/createable_api_resource.py", line 17, in create response, api_key = requestor.request('post', url, params, headers)
File "/tmp/stripe/api_requestor.py", line 152, in request resp = self.interpret_response(rbody, rcode, rheaders)
File "/tmp/stripe/api_requestor.py", line 359, in interpret_response self.handle_error_response(rbody, rcode, resp, rheaders)
File "/tmp/stripe/api_requestor.py", line 177, in handle_error_response raise err
stripe.error.InvalidRequestError: Request req_ZmLk0oWGjmrkut: No such customer: id
这似乎是一个错误,或者我只是在“客户”中输入了错误的值
关于做什么的任何想法?