我正在开发一个项目,我想将金额转移给多个条带客户,我已经使用了条带转移方法,但出现以下错误
错误:请求 req_FlLAHrjOxkd4IO:您的 Stripe 账户中没有足够的可用资金。尝试使用 4000000000000077 测试卡创建费用,将资金直接添加到您的可用余额中。请参阅:https://stripe.com/docs/testing#available-balance
这是我的代码
charge = stripe.Charge.create(
amount=5000,
currency="usd",
source='tok_visa',
description="Adding funds to test account"
)
charge_id = charge.id
# Assuming you have defined 'total_charges', 'user.id', 'seller_amount', and 'referral_amount' earlier in your code
session = stripe.PaymentIntent.create(
amount=total_charges,
currency="usd",
transfer_group=f"ORDER10_{user.id}",
)
stripe.Transfer.create(
amount=seller_amount,
currency='usd',
destination='acct_1OrzGLI3hFSHp0X5',
transfer_group=f"ORDER10_{user.id}",
)
stripe.Transfer.create(
amount=referral_amount,
currency='usd',
destination="acct_1OrzPRI5g3KKKWKv",
transfer_group=f"ORDER10_{user.id}",
)
创建转账时您想要做的是将相应的费用 ID 包含在
source_transaction
参数中:https://stripe.com/docs/api/transfers/create#create_transfer-source_transaction
要记住的要点是,使用
source_transaction
时,如果付款仍处于待处理状态,则转账将从待处理余额中提取资金。如果付款已经可用,则转账将从可用余额中提取资金。
如果您不指定
source_transaction
,它将始终尝试使用您的可用余额中的资金,如果付款资金尚不可用,并且您不指定 source_transaction
,那么您可能会运行陷入资金不足的问题。