diff --git a/src/pretix/plugins/stripe/payment.py b/src/pretix/plugins/stripe/payment.py index 0db7b68ea4..756488c7cf 100644 --- a/src/pretix/plugins/stripe/payment.py +++ b/src/pretix/plugins/stripe/payment.py @@ -116,6 +116,7 @@ logger = logging.getLogger('pretix.plugins.stripe') # - PayNow: ✗ # - UPI: ✗ # - Netbanking: ✗ +# - TWINT: ✓ # # Bank transfers # - ACH Bank Transfer: ✗ @@ -448,6 +449,14 @@ class StripeSettingsHolder(BasePaymentProvider): 'before they work properly.'), required=False, )), + ('method_twint', + forms.BooleanField( + label='TWINT', + disabled=self.event.currency != 'CHF', + help_text=_('Some payment methods might need to be enabled in the settings of your Stripe account ' + 'before they work properly.'), + required=False, + )), ('method_affirm', forms.BooleanField( label=_('Affirm'), @@ -1793,3 +1802,25 @@ class StripeSwish(StripeRedirectMethod): }, } } + + +class StripeTwint(StripeRedirectMethod): + identifier = 'stripe_twint' + verbose_name = _('TWINT via Stripe') + public_name = 'TWINT' + method = 'twint' + confirmation_method = 'automatic' + explanation = _( + 'This payment method is available to users of the Swiss app TWINT. Please have your app ' + 'ready.' + ) + + def is_allowed(self, request: HttpRequest, total: Decimal=None) -> bool: + return super().is_allowed(request, total) and request.event.currency == "CHF" and total <= Decimal("5000.00") + + def _payment_intent_kwargs(self, request, payment): + return { + "payment_method_data": { + "type": "twint", + }, + } diff --git a/src/pretix/plugins/stripe/signals.py b/src/pretix/plugins/stripe/signals.py index 9e97706264..70234c4976 100644 --- a/src/pretix/plugins/stripe/signals.py +++ b/src/pretix/plugins/stripe/signals.py @@ -48,13 +48,14 @@ def register_payment_provider(sender, **kwargs): StripeAffirm, StripeAlipay, StripeBancontact, StripeCC, StripeEPS, StripeGiropay, StripeIdeal, StripeKlarna, StripeMultibanco, StripePayPal, StripePrzelewy24, StripeSEPADirectDebit, - StripeSettingsHolder, StripeSofort, StripeSwish, StripeWeChatPay, + StripeSettingsHolder, StripeSofort, StripeSwish, StripeTwint, + StripeWeChatPay, ) return [ StripeSettingsHolder, StripeCC, StripeGiropay, StripeIdeal, StripeAlipay, StripeBancontact, StripeSofort, StripeEPS, StripeMultibanco, StripePrzelewy24, StripeWeChatPay, - StripeSEPADirectDebit, StripeAffirm, StripeKlarna, StripePayPal, StripeSwish + StripeSEPADirectDebit, StripeAffirm, StripeKlarna, StripePayPal, StripeSwish, StripeTwint, ]