diff --git a/src/pretix/plugins/stripe/payment.py b/src/pretix/plugins/stripe/payment.py index 2e447a5d3..923a1ba89 100644 --- a/src/pretix/plugins/stripe/payment.py +++ b/src/pretix/plugins/stripe/payment.py @@ -412,6 +412,18 @@ class StripeSettingsHolder(BasePaymentProvider): 'before they work properly.'), required=False, )), + ('method_pay_by_bank', + forms.BooleanField( + label=_('Pay by bank'), + disabled=self.event.currency not in ['EUR', 'GBP'], + help_text=' '.join([ + str(_('Some payment methods might need to be enabled in the settings of your Stripe account ' + 'before they work properly.')), + str(_('Currently only available for charges in GBP and customers with UK bank accounts, and ' + 'in private preview for France and Germany.')) + ]), + required=False, + )), ('method_wechatpay', forms.BooleanField( label=_('WeChat Pay'), @@ -1810,6 +1822,32 @@ class StripeRevolutPay(StripeRedirectMethod): } +class StripePayByBank(StripeRedirectMethod): + identifier = 'stripe_pay_by_bank' + verbose_name = _('Pay by bank via Stripe') + public_name = _('Pay by bank') + method = 'pay_by_bank' + redirect_in_widget_allowed = False + confirmation_method = 'automatic' + explanation = _( + 'Pay by bank allows you to authorize a secure Open Banking payment from your banking app. Currently available ' + 'only with a UK bank account.' + ) + + def is_allowed(self, request: HttpRequest, total: Decimal=None) -> bool: + return super().is_allowed(request, total) and self.event.currency == 'GBP' + + def _payment_intent_kwargs(self, request, payment): + return { + "payment_method_data": { + "type": "pay_by_bank", + "billing_details": { + "email": payment.order.email, + }, + }, + } + + class StripePayPal(StripeRedirectMethod): identifier = 'stripe_paypal' verbose_name = _('PayPal via Stripe') diff --git a/src/pretix/plugins/stripe/signals.py b/src/pretix/plugins/stripe/signals.py index 9a929457a..e968fa54c 100644 --- a/src/pretix/plugins/stripe/signals.py +++ b/src/pretix/plugins/stripe/signals.py @@ -46,15 +46,15 @@ def register_payment_provider(sender, **kwargs): from .payment import ( StripeAffirm, StripeAlipay, StripeBancontact, StripeCC, StripeEPS, StripeGiropay, StripeIdeal, StripeKlarna, StripeMobilePay, - StripeMultibanco, StripePayPal, StripePrzelewy24, StripeRevolutPay, - StripeSEPADirectDebit, StripeSettingsHolder, StripeSofort, StripeSwish, - StripeTwint, StripeWeChatPay, + StripeMultibanco, StripePayByBank, StripePayPal, StripePrzelewy24, + StripeRevolutPay, StripeSEPADirectDebit, StripeSettingsHolder, + StripeSofort, StripeSwish, StripeTwint, StripeWeChatPay, ) return [ StripeSettingsHolder, StripeCC, StripeGiropay, StripeIdeal, StripeAlipay, StripeBancontact, StripeSofort, StripeEPS, StripeMultibanco, StripePrzelewy24, StripeRevolutPay, StripeWeChatPay, - StripeSEPADirectDebit, StripeAffirm, StripeKlarna, StripePayPal, StripeSwish, StripeTwint, StripeMobilePay + StripeSEPADirectDebit, StripeAffirm, StripeKlarna, StripePayByBank, StripePayPal, StripeSwish, StripeTwint, StripeMobilePay ]