Stripe: Add support for Swish (#4149)

* Stripe: Add support for Swish

* Update src/pretix/plugins/stripe/payment.py

Co-authored-by: Martin Gross <gross@rami.io>

---------

Co-authored-by: Martin Gross <gross@rami.io>
This commit is contained in:
Raphael Michel
2024-05-17 13:33:03 +02:00
committed by GitHub
parent a6a93555b6
commit 7188e44fe5
3 changed files with 40 additions and 4 deletions

View File

@@ -133,7 +133,7 @@ logger = logging.getLogger('pretix.plugins.stripe')
# - Zip: ✗
#
# Real-time payments
# - Swish:
# - Swish:
# - PayNow: ✗
# - PromptPay: ✗
# - Pix: ✗
@@ -441,6 +441,14 @@ class StripeSettingsHolder(BasePaymentProvider):
'before they work properly.'),
required=False,
)),
('method_swish',
forms.BooleanField(
label=_('Swish'),
disabled=self.event.currency != 'SEK',
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'),
@@ -1907,3 +1915,27 @@ class StripePayPal(StripeRedirectMethod):
verbose_name = _('PayPal via Stripe')
public_name = _('PayPal')
method = 'paypal'
class StripeSwish(StripeRedirectMethod):
identifier = 'stripe_swish'
verbose_name = _('Swish via Stripe')
public_name = _('Swish')
method = 'swish'
confirmation_method = 'automatic'
explanation = _(
'This payment method is available to users of the Swedish apps Swish and BankID. Please have your app '
'ready.'
)
def _payment_intent_kwargs(self, request, payment):
return {
"payment_method_data": {
"type": "swish",
},
"payment_method_options": {
"swish": {
"reference": payment.order.full_code,
},
}
}