collab: Add ability to add tax ID during Stripe Checkout (#34246)
### 1. **Added Tax ID Collection Types** - Created a new `StripeTaxIdCollection` struct with an `enabled` field - Added `tax_id_collection` field to `StripeCreateCheckoutSessionParams` ### 2. **Updated the Stripe Client Interface** - Modified the real Stripe client to handle tax ID collection conversion - Updated the fake Stripe client for testing purposes - Added proper imports across all affected files ### 3. **Enabled Tax ID Collection in Checkout Sessions** - Both `checkout_with_zed_pro` and `checkout_with_zed_pro_trial` methods now enable tax ID collection - The implementation correctly sets `tax_id_collection.enabled = true` for all checkout sessions ### 4. **Key Implementation Details** - Tax ID collection will be shown to new customers and existing customers without tax IDs - Collected tax IDs will be automatically saved to the customer's `tax_ids` array in Stripe - Business names will be saved to the customer's `name` property - The existing `customer_update.name = auto` setting ensures compatibility with tax ID collection Release Notes: - N/A
This commit is contained in:
parent
a58a75c0f6
commit
c09f484ec4
4 changed files with 25 additions and 6 deletions
|
@ -19,8 +19,8 @@ use crate::stripe_client::{
|
|||
StripeCustomerId, StripeCustomerUpdate, StripeCustomerUpdateAddress, StripeCustomerUpdateName,
|
||||
StripeMeter, StripePrice, StripePriceId, StripeSubscription, StripeSubscriptionId,
|
||||
StripeSubscriptionTrialSettings, StripeSubscriptionTrialSettingsEndBehavior,
|
||||
StripeSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod, UpdateSubscriptionItems,
|
||||
UpdateSubscriptionParams,
|
||||
StripeSubscriptionTrialSettingsEndBehaviorMissingPaymentMethod, StripeTaxIdCollection,
|
||||
UpdateSubscriptionItems, UpdateSubscriptionParams,
|
||||
};
|
||||
|
||||
pub struct StripeBilling {
|
||||
|
@ -252,6 +252,7 @@ impl StripeBilling {
|
|||
name: Some(StripeCustomerUpdateName::Auto),
|
||||
shipping: None,
|
||||
});
|
||||
params.tax_id_collection = Some(StripeTaxIdCollection { enabled: true });
|
||||
|
||||
let session = self.client.create_checkout_session(params).await?;
|
||||
Ok(session.url.context("no checkout session URL")?)
|
||||
|
@ -311,6 +312,7 @@ impl StripeBilling {
|
|||
name: Some(StripeCustomerUpdateName::Auto),
|
||||
shipping: None,
|
||||
});
|
||||
params.tax_id_collection = Some(StripeTaxIdCollection { enabled: true });
|
||||
|
||||
let session = self.client.create_checkout_session(params).await?;
|
||||
Ok(session.url.context("no checkout session URL")?)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue