通过Stripe-payments创建订阅

时间:2017-11-17 23:37:04

标签: python stripe-payments subscription customer

我今天早些时候把它扔到了一起:

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

这似乎是一个错误,或者我只是将错误的价值放入&#34;客户&#34;

关于该做什么的任何想法?

0 个答案:

没有答案