The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Fix billing prices to use the price based on default_price_id
Joshen Lim9d50214262a1
diff --git a/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx b/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsxindex f6c89d7eea4..0e3bc5cd8a5 100644--- a/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx+++ b/studio/components/interfaces/Billing/AddOns/ComputeSizeSelection.tsx@@ -17,25 +17,33 @@ const ComputeSizeSelection: FC<Props> = ({ computeSizes, selectedComputeSize, on</p></div><Radio.Group type="cards" className="billing-compute-radio">- {computeSizes.map((option: any) => (- <Radio- hidden- key={option.id}- align="vertical"- label={option.name}- // @ts-ignore- description={- <div>- <p>{option.description}</p>- <p>{option.metadata.features}</p>- </div>- }- value={option.id}- optionalLabel={<div>${option.prices[0].unit_amount / 100} / month</div>}- checked={selectedComputeSize?.id === option.id}- onChange={() => onSelectOption(option)}- />- ))}+ {computeSizes.map((option: any) => {+ const defaultPriceId = option.metadata.default_price_id+ const price =+ defaultPriceId !== undefined+ ? option.prices.find((price: any) => price.id === defaultPriceId).unit_amount+ : option.prices[0].unit_amount++ return (+ <Radio+ hidden+ key={option.id}+ align="vertical"+ label={option.name}+ // @ts-ignore+ description={+ <div>+ <p>{option.description}</p>+ <p>{option.metadata.features}</p>+ </div>+ }+ value={option.id}+ optionalLabel={<div>${price / 100} / month</div>}+ checked={selectedComputeSize?.id === option.id}+ onChange={() => onSelectOption(option)}+ />+ )+ })}</Radio.Group></div>)diff --git a/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.utils.ts b/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.utils.tsindex 14f231a98b8..fb74ad37968 100644--- a/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.utils.ts+++ b/studio/components/interfaces/Billing/ProUpgrade/ProUpgrade.utils.ts@@ -4,11 +4,17 @@ export const formSubscriptionUpdatePayload = (selectedPaymentMethod: string,region: string) => {+ const defaultPriceId = selectedTier.metadata?.default_price_id+ const price =+ defaultPriceId !== undefined+ ? selectedTier.prices.find((price: any) => price.id === defaultPriceId).id+ : selectedTier.prices[0].id+const addons =region === 'af-south-1' || !selectedComputeSize.id ? [] : [selectedComputeSize.prices[0].id]const proration_date = Math.floor(Date.now() / 1000)return {- tier: selectedTier.prices[0].id,+ tier: price,addons,proration_date,payment_method: selectedPaymentMethod,