From 55746445bbd9f3bcff3e43700258044f60e4393e Mon Sep 17 00:00:00 2001 From: Jet Li Date: Thu, 16 Jan 2025 05:01:57 +0000 Subject: [PATCH] Remove useless on_behalf_of --- apps/payment/backend/business/stripe_manager.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/payment/backend/business/stripe_manager.py b/apps/payment/backend/business/stripe_manager.py index 5a1d4d2..44f4beb 100644 --- a/apps/payment/backend/business/stripe_manager.py +++ b/apps/payment/backend/business/stripe_manager.py @@ -228,6 +228,18 @@ class StripeManager: transaction.stripe_checkout_session_url, ) + # Check connected account capabilities + connected_account = stripe.Account.retrieve( + transaction.to_stripe_account_id + ) + if ( + connected_account.capabilities.get("card_payments") != "active" + or connected_account.capabilities.get("transfers") != "active" + ): + raise Exception( + f"Connected account {transaction.to_stripe_account_id} lacks required capabilities." + ) + if not transaction.stripe_product_id: product = stripe.Product.create( name="{}-{}".format( @@ -261,7 +273,6 @@ class StripeManager: "destination": transaction.to_stripe_account_id, }, }, - on_behalf_of=transaction.to_stripe_account_id, mode="payment", success_url="{}/work-space".format( self.site_url_root