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