【发布时间】:2015-11-16 11:27:38
【问题描述】:
我正在使用 Stripe API 进行测试,但无法让这个基本的“市场”场景正常工作。场景是买家从卖家那里买东西,应用是收费的。
我的设置:
# Seller has already connected their account to the application
# through "Stripe Connect Standalone". Below will attempt to charge a customer.
import stripe
# application's sk from stripe
stripe.api_key = "sk...."
# Build customer
customer = stripe.Customer.create(
email = customer.email,
card = token_from_stripe_checkout
)
# Now do a charge
charge = stripe.Charge.create(
amount = 2000,
currency = "usd",
customer = customer.id,
application_fee = 500,
stripe_account = seller.stripe_user_id # which is something like: acct_xxxxxxxxx
)
这会导致错误:
File "/home/btw/app.py", line 177, in stripe_test
stripe_account=seller.stripe_user_id
File "/usr/local/lib/python2.7/dist-packages/stripe/resource.py", line 357, in create
response, api_key = requestor.request('post', url, params, headers)
File "/usr/local/lib/python2.7/dist-packages/stripe/api_requestor.py", line 141, in request
resp = self.interpret_response(rbody, rcode, rheaders)
File "/usr/local/lib/python2.7/dist-packages/stripe/api_requestor.py", line 269, in interpret_response
self.handle_api_error(rbody, rcode, resp, rheaders)
File "/usr/local/lib/python2.7/dist-packages/stripe/api_requestor.py", line 156, in handle_api_error
rbody, rcode, resp, rheaders)
InvalidRequestError: Request req_xxxxxxx: No such customer: cus_xxxxxxxxx
我做错了什么?
【问题讨论】:
-
您确定这是发生错误的地方吗?这似乎不可信。你有其他与 Stripe 相关的代码吗?
-
@EdCottrell 我想是的。我没有任何其他条纹代码。堆栈跟踪行位于
stripe_account = seller.stripe_user_id。
标签: python stripe-payments stripe.net stripe-connect