collab: Add intent for updating payment method (#30306)
This PR adds a new `ManageSubscriptionIntent` for initiating a session to update the user's payment method. Release Notes: - N/A
This commit is contained in:
parent
e74ae89c84
commit
660b4cee76
1 changed files with 13 additions and 0 deletions
|
@ -429,6 +429,8 @@ enum ManageSubscriptionIntent {
|
||||||
///
|
///
|
||||||
/// This will open the Stripe billing portal without putting the user in a specific flow.
|
/// This will open the Stripe billing portal without putting the user in a specific flow.
|
||||||
ManageSubscription,
|
ManageSubscription,
|
||||||
|
/// The user intends to update their payment method.
|
||||||
|
UpdatePaymentMethod,
|
||||||
/// The user intends to upgrade to Zed Pro.
|
/// The user intends to upgrade to Zed Pro.
|
||||||
UpgradeToPro,
|
UpgradeToPro,
|
||||||
/// The user intends to cancel their subscription.
|
/// The user intends to cancel their subscription.
|
||||||
|
@ -589,6 +591,17 @@ async fn manage_billing_subscription(
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
ManageSubscriptionIntent::UpdatePaymentMethod => Some(CreateBillingPortalSessionFlowData {
|
||||||
|
type_: CreateBillingPortalSessionFlowDataType::PaymentMethodUpdate,
|
||||||
|
after_completion: Some(CreateBillingPortalSessionFlowDataAfterCompletion {
|
||||||
|
type_: stripe::CreateBillingPortalSessionFlowDataAfterCompletionType::Redirect,
|
||||||
|
redirect: Some(CreateBillingPortalSessionFlowDataAfterCompletionRedirect {
|
||||||
|
return_url: format!("{}/account", app.config.zed_dot_dev_url()),
|
||||||
|
}),
|
||||||
|
..Default::default()
|
||||||
|
}),
|
||||||
|
..Default::default()
|
||||||
|
}),
|
||||||
ManageSubscriptionIntent::Cancel => Some(CreateBillingPortalSessionFlowData {
|
ManageSubscriptionIntent::Cancel => Some(CreateBillingPortalSessionFlowData {
|
||||||
type_: CreateBillingPortalSessionFlowDataType::SubscriptionCancel,
|
type_: CreateBillingPortalSessionFlowDataType::SubscriptionCancel,
|
||||||
after_completion: Some(CreateBillingPortalSessionFlowDataAfterCompletion {
|
after_completion: Some(CreateBillingPortalSessionFlowDataAfterCompletion {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue