Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: cleanup pending subscription flags (#36692)

Kevin Grüneberg2c6c5d11e440
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/PaymentMethods/NewPaymentMethodElement.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/PaymentMethods/NewPaymentMethodElement.tsx
index 3ef69b313e2..9070143191f 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/PaymentMethods/NewPaymentMethodElement.tsx
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/PaymentMethods/NewPaymentMethodElement.tsx
@@ -5,19 +5,15 @@
*/
import { PaymentElement, useElements, useStripe } from '@stripe/react-stripe-js'
-import { PaymentMethod } from '@stripe/stripe-js'
-import { getURL } from 'lib/helpers'
import { forwardRef, useImperativeHandle } from 'react'
import { toast } from 'sonner'
const NewPaymentMethodElement = forwardRef(
(
{
- pending_subscription_flow_enabled,
email,
readOnly,
}: {
- pending_subscription_flow_enabled: boolean
email?: string | null | undefined
readOnly: boolean
},
@@ -30,33 +26,15 @@ const NewPaymentMethodElement = forwardRef(
if (!stripe || !elements) return
await elements.submit()
- if (pending_subscription_flow_enabled) {
- // To avoid double 3DS confirmation, we just create the payment method here, as there might be a confirmation step while doing the actual payment
- const { error, paymentMethod } = await stripe.createPaymentMethod({
- elements,
- })
- if (error || paymentMethod == null) {
- toast.error(error?.message ?? ' Failed to process card details')
- return
- }
- return paymentMethod
- } else {
- const { error, setupIntent } = await stripe.confirmSetup({
- elements,
- redirect: 'if_required',
- confirmParams: {
- return_url: getURL(),
- expand: ['payment_method'],
- },
- })
-
- if (error || !setupIntent.payment_method) {
- toast.error(error?.message ?? ' Failed to save card details')
- return
- }
-
- return setupIntent.payment_method as PaymentMethod
+ // To avoid double 3DS confirmation, we just create the payment method here, as there might be a confirmation step while doing the actual payment
+ const { error, paymentMethod } = await stripe.createPaymentMethod({
+ elements,
+ })
+ if (error || paymentMethod == null) {
+ toast.error(error?.message ?? ' Failed to process card details')
+ return
}
+ return paymentMethod
}
useImperativeHandle(ref, () => ({
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PaymentMethodSelection.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PaymentMethodSelection.tsx
index 17f21a4d483..3754491fbd1 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PaymentMethodSelection.tsx
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/PaymentMethodSelection.tsx
@@ -286,7 +286,6 @@ const PaymentMethodSelection = forwardRef(function PaymentMethodSelection(
<Elements stripe={stripePromise} options={stripeOptionsPaymentMethod}>
<NewPaymentMethodElement
ref={paymentRef}
- pending_subscription_flow_enabled={true}
email={selectedOrganization?.billing_email ?? undefined}
readOnly={readOnly}
/>
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/SubscriptionPlanUpdateDialog.tsx b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/SubscriptionPlanUpdateDialog.tsx
index 5dafba54723..dbebba34731 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/SubscriptionPlanUpdateDialog.tsx
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/Subscription/SubscriptionPlanUpdateDialog.tsx
@@ -555,9 +555,7 @@ export const SubscriptionPlanUpdateDialog = ({
ref={paymentMethodSelection}
selectedPaymentMethod={selectedPaymentMethod}
onSelectPaymentMethod={(pm) => setSelectedPaymentMethod(pm)}
- createPaymentMethodInline={
- subscriptionPreview.pending_subscription_flow === true
- }
+ createPaymentMethodInline={true}
readOnly={paymentConfirmationLoading || isConfirming || isUpdating}
/>
</div>
diff --git a/apps/studio/components/interfaces/Organization/NewOrg/NewOrgForm.tsx b/apps/studio/components/interfaces/Organization/NewOrg/NewOrgForm.tsx
index 40233432b40..a1c811a09ad 100644
--- a/apps/studio/components/interfaces/Organization/NewOrg/NewOrgForm.tsx
+++ b/apps/studio/components/interfaces/Organization/NewOrg/NewOrgForm.tsx
@@ -120,9 +120,7 @@ const NewOrgForm = ({ onPaymentMethodReset, setupIntent, onPlanSelected }: NewOr
({
clientSecret: setupIntent ? setupIntent.client_secret! : '',
appearance: getStripeElementsAppearanceOptions(resolvedTheme),
- ...(setupIntent?.pending_subscription_flow_enabled_for_creation === true
- ? { paymentMethodCreation: 'manual' }
- : {}),
+ paymentMethodCreation: 'manual',
}) as const,
[setupIntent, resolvedTheme]
)
@@ -553,9 +551,6 @@ const NewOrgForm = ({ onPaymentMethodReset, setupIntent, onPlanSelected }: NewOr
<Panel.Content>
<NewPaymentMethodElement
ref={paymentRef}
- pending_subscription_flow_enabled={
- setupIntent?.pending_subscription_flow_enabled_for_creation === true
- }
email={user.profile?.primary_email}
readOnly={newOrgLoading || paymentConfirmationLoading}
/>
diff --git a/apps/studio/data/organizations/organization-billing-subscription-preview.ts b/apps/studio/data/organizations/organization-billing-subscription-preview.ts
index 0f0adef3bb0..beb079b520e 100644
--- a/apps/studio/data/organizations/organization-billing-subscription-preview.ts
+++ b/apps/studio/data/organizations/organization-billing-subscription-preview.ts
@@ -43,7 +43,6 @@ export type OrganizationBillingSubscriptionPreviewResponse = {
ref: string
}[]
billed_via_partner?: boolean
- pending_subscription_flow?: boolean
}
export async function previewOrganizationBillingSubscription({