diff --git a/src/pretix/plugins/stripe/tasks.py b/src/pretix/plugins/stripe/tasks.py index 9cf92b6bd..cbf04fd35 100644 --- a/src/pretix/plugins/stripe/tasks.py +++ b/src/pretix/plugins/stripe/tasks.py @@ -54,13 +54,28 @@ def stripe_verify_domain(event, domain): prov = StripeCC(event) account = get_stripe_account_key(prov) + # Yes, we could just use the **prov.api_kwargs + # But since we absolutely need to always issue this call with live keys, + # we're building our api_kwargs here by hand. + # Only if no live connect secret key is set, we'll fall back to the testmode keys. + # But this should never happen except in scenarios where pretix runs in devmode. + if prov.settings.connect_client_id and prov.settings.connect_user_id: + api_kwargs = { + 'api_key': prov.settings.connect_secret_key or prov.settings.connect_test_secret_key, + 'stripe_account': prov.settings.connect_user_id + } + else: + api_kwargs = { + 'api_key': prov.settings.secret_key, + } + if RegisteredApplePayDomain.objects.filter(account=account, domain=domain).exists(): return try: resp = stripe.ApplePayDomain.create( domain_name=domain, - **prov.api_kwargs + **api_kwargs ) except stripe.error.StripeError: logger.exception('Could not verify domain with Stripe')