我在用stripeapi进行测试,但我无法让这个基本的“市场”场景正常工作。这个场景是买家从卖家那里购买,而应用程序需要付费。在
我的设置:
# 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
)
这将导致错误:
^{pr2}$我做错什么了?在
代码中主要发生两件事:
问题是你在自己的账户中创建客户,但你在关联账户的范围内创建费用。当您传递
stripe_account
时,实际上是告诉Stripe在另一个已连接帐户下运行API调用。您的已连接帐户无法访问基本帐户的客户。在简单的修复方法是将
stripe_account
传递给createcustomerapi调用。在相关问题 更多 >
编程相关推荐