collab: Require billing address in all Stripe checkouts #32980
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
I've successfully implemented the required billing address collection feature for Stripe Checkout sessions. Here's what was done:
1. Added New Data Structures (
stripe_client.rs):StripeBillingAddressCollectionenum withAutoandRequiredvariantsbilling_address_collectionfield toStripeCreateCheckoutSessionParams2. Updated Stripe Client Implementation (
real_stripe_client.rs):StripeBillingAddressCollectionto Stripe'sCheckoutSessionBillingAddressCollectionTryFromimplementation to map the billing address collection field when creating checkout sessions3. Updated Billing Service (
stripe_billing.rs):billing_address_collectiontoRequiredin bothcheckout_with_zed_pro()andcheckout_with_zed_pro_trial()methods4. Updated Test Infrastructure (
fake_stripe_client.rs):billing_address_collectionfield toStripeCreateCheckoutSessionCallcreate_checkout_sessionimplementation to capture the new field5. Updated Tests (
stripe_billing_tests.rs):billing_address_collectionis set toRequiredin all three test cases:test_checkout_with_zed_protest_checkout_with_zed_pro_trial(regular trial)test_checkout_with_zed_pro_trial(extended trial)The implementation follows the pattern established in the codebase and ensures that whenever a Stripe Checkout session is created for Zed Pro subscriptions (both regular and trial), the billing address will be required from customers. This aligns with the Stripe documentation you provided, which shows that setting
billing_address_collection=requiredwill ensure the billing address is always collected during checkout.Release Notes: