stripe: Add billing address collection to checkout session.

This will require customers to include an address when setting
up, or updating, the credit card information for their account.
The billing address for the card will also be saved as the
billing address for the stripe customer object.

The customer object billing address appears on the invoices
that are generated by stripe.
This commit is contained in:
Lauryn Menard 2024-02-02 20:11:25 +01:00 committed by Tim Abbott
parent f71337aaf7
commit cbb6d962d5
1 changed files with 4 additions and 0 deletions

View File

@ -1083,6 +1083,8 @@ class BillingSession(ABC):
mode="setup",
payment_method_types=["card"],
success_url=f"{self.billing_session_url}/billing/event_status/?stripe_session_id={{CHECKOUT_SESSION_ID}}",
billing_address_collection="required",
customer_update={"address": "auto"},
)
Session.objects.create(
stripe_session_id=stripe_session.id,
@ -1107,6 +1109,8 @@ class BillingSession(ABC):
mode="setup",
payment_method_types=["card"],
success_url=f"{self.billing_session_url}/billing/event_status/?stripe_session_id={{CHECKOUT_SESSION_ID}}",
billing_address_collection="required",
customer_update={"address": "auto"},
)
Session.objects.create(
stripe_session_id=stripe_session.id,