Skip to content

Conversation

@morgankrey
Copy link
Contributor

@morgankrey morgankrey commented Jun 18, 2025

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):

  • Added StripeBillingAddressCollection enum with Auto and Required variants
  • Added billing_address_collection field to StripeCreateCheckoutSessionParams

2. Updated Stripe Client Implementation (real_stripe_client.rs):

  • Added conversion from StripeBillingAddressCollection to Stripe's CheckoutSessionBillingAddressCollection
  • Updated the TryFrom implementation to map the billing address collection field when creating checkout sessions
  • Added the necessary import

3. Updated Billing Service (stripe_billing.rs):

  • Set billing_address_collection to Required in both checkout_with_zed_pro() and checkout_with_zed_pro_trial() methods
  • Added the necessary import

4. Updated Test Infrastructure (fake_stripe_client.rs):

  • Added billing_address_collection field to StripeCreateCheckoutSessionCall
  • Updated the create_checkout_session implementation to capture the new field
  • Added the necessary import

5. Updated Tests (stripe_billing_tests.rs):

  • Added assertions to verify that billing_address_collection is set to Required in all three test cases:
    • test_checkout_with_zed_pro
    • test_checkout_with_zed_pro_trial (regular trial)
    • test_checkout_with_zed_pro_trial (extended trial)
  • Added the necessary import

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=required will ensure the billing address is always collected during checkout.

Release Notes:

  • N/A
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jun 18, 2025
@maxdeviant maxdeviant changed the title Agentic Pairing to require billing address in all stripe checkouts collab: Require billing address in all Stripe checkouts Jun 18, 2025
@maxdeviant maxdeviant enabled auto-merge (squash) June 24, 2025 13:29
@maxdeviant maxdeviant disabled auto-merge June 24, 2025 13:34
@maxdeviant maxdeviant enabled auto-merge (squash) June 24, 2025 13:35
@maxdeviant maxdeviant merged commit 13f1344 into main Jun 24, 2025
21 checks passed
@maxdeviant maxdeviant deleted the stripe-require-billing-address branch June 24, 2025 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

3 participants