The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Add info box if payment method is invoice
Joshen Lim2151247a9f96
diff --git a/studio/components/interfaces/Organization/BillingSettingsV2/PaymentMethods/PaymentMethods.tsx b/studio/components/interfaces/Organization/BillingSettingsV2/PaymentMethods/PaymentMethods.tsxindex 0cdc7c38da4..2c9274ef638 100644--- a/studio/components/interfaces/Organization/BillingSettingsV2/PaymentMethods/PaymentMethods.tsx+++ b/studio/components/interfaces/Organization/BillingSettingsV2/PaymentMethods/PaymentMethods.tsx@@ -19,9 +19,10 @@ import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-queimport { useCheckPermissions, useStore } from 'hooks'import { BASE_PATH } from 'lib/constants'import { getURL } from 'lib/helpers'-import { Badge, Button, Dropdown, IconCreditCard, IconMoreHorizontal, IconPlus } from 'ui'+import { Alert, Badge, Button, Dropdown, IconCreditCard, IconMoreHorizontal, IconPlus } from 'ui'import ChangePaymentMethodModal from './ChangePaymentMethodModal'import DeletePaymentMethodModal from './DeletePaymentMethodModal'+import Link from 'next/link'const PaymentMethods = () => {const { ui } = useStore()@@ -82,99 +83,124 @@ const PaymentMethods = () => {)}{isSuccess && (- <FormPanel- footer={- <div className="flex items-center justify-between py-4 px-8">- {!canUpdatePaymentMethods ? (- <p className="text-sm text-scale-1000">- You need additional permissions to manage payment methods- </p>- ) : (- <div />- )}- <Button- type="default"- icon={<IconPlus />}- disabled={!canUpdatePaymentMethods}- onClick={() => setShowAddPaymentMethodModal(true)}- >- Add new card- </Button>- </div>- }- >- <FormSection>- <FormSectionContent fullWidth loading={false}>- {(paymentMethods?.length ?? 0) === 0 ? (- <div className="flex items-center space-x-2 opacity-50">- <IconCreditCard />- <p className="text-sm">No payment methods</p>- </div>- ) : (- <div className="space-y-3">- {paymentMethods?.map((paymentMethod) => {- const isActive = subscription?.payment_method_id === paymentMethod.id- return (- <div- key={paymentMethod.id}- className="flex items-center justify-between"- >- <div className="flex items-center space-x-8">- <img- alt="Credit card brand"- src={`${BASE_PATH}/img/payment-methods/${paymentMethod.card.brand- .replace(' ', '-')- .toLowerCase()}.png`}- width="32"- />- <p className="prose text-sm font-mono">- **** **** **** {paymentMethod.card.last4}- </p>- <p className="text-sm tabular-nums">- Expires: {paymentMethod.card.exp_month}/- {paymentMethod.card.exp_year}- </p>- </div>- {isActive && <Badge color="green">Active</Badge>}- {canUpdatePaymentMethods && !isActive ? (- <Dropdown- size="tiny"- align="end"- overlay={[- ...(subscription?.plan.id !== 'free'- ? [- <Dropdown.Item- key="make-default"- onClick={() => setSelectedMethodForUse(paymentMethod)}- >- Use this card- </Dropdown.Item>,- <Dropdown.Separator key="card-separator" />,- ]- : []),- <Dropdown.Item- key="delete-method"- onClick={() => setSelectedMethodToDelete(paymentMethod)}- >- Delete card- </Dropdown.Item>,- ]}- >- <Button- type="outline"- icon={<IconMoreHorizontal />}- className="hover:border-gray-500 px-1"+ <>+ {subscription?.payment_method_type === 'invoice' && (+ <Alert+ withIcon+ variant="info"+ title="Your payment method is currently through invoice"+ actions={[+ <Link+ key="payment-method-support"+ href={`/support/new?category=billing&subject=Request%20to%20change%20payment%20method`}+ >+ <a target="_blank" rel="noreferrer">+ <Button type="default">Contact support</Button>+ </a>+ </Link>,+ ]}+ >+ You get a monthly invoice and payment link via email. To change your payment+ method, please contact us via our support form.+ </Alert>+ )}+ <FormPanel+ footer={+ <div className="flex items-center justify-between py-4 px-8">+ {!canUpdatePaymentMethods ? (+ <p className="text-sm text-scale-1000">+ You need additional permissions to manage payment methods+ </p>+ ) : (+ <div />+ )}+ <Button+ type="default"+ icon={<IconPlus />}+ disabled={!canUpdatePaymentMethods}+ onClick={() => setShowAddPaymentMethodModal(true)}+ >+ Add new card+ </Button>+ </div>+ }+ >+ <FormSection>+ <FormSectionContent fullWidth loading={false}>+ {(paymentMethods?.length ?? 0) === 0 ? (+ <div className="flex items-center space-x-2 opacity-50">+ <IconCreditCard />+ <p className="text-sm">No payment methods</p>+ </div>+ ) : (+ <div className="space-y-3">+ {paymentMethods?.map((paymentMethod) => {+ const isActive = subscription?.payment_method_id === paymentMethod.id+ return (+ <div+ key={paymentMethod.id}+ className="flex items-center justify-between"+ >+ <div className="flex items-center space-x-8">+ <img+ alt="Credit card brand"+ src={`${BASE_PATH}/img/payment-methods/${paymentMethod.card.brand+ .replace(' ', '-')+ .toLowerCase()}.png`}+ width="32"/>- </Dropdown>- ) : null}- </div>- )- })}- </div>- )}- </FormSectionContent>- </FormSection>- </FormPanel>+ <p className="prose text-sm font-mono">+ **** **** **** {paymentMethod.card.last4}+ </p>+ <p className="text-sm tabular-nums">+ Expires: {paymentMethod.card.exp_month}/+ {paymentMethod.card.exp_year}+ </p>+ </div>+ {isActive && <Badge color="green">Active</Badge>}+ {canUpdatePaymentMethods && !isActive ? (+ <Dropdown+ size="tiny"+ align="end"+ overlay={[+ ...(subscription?.plan.id !== 'free' &&+ subscription?.payment_method_type === 'card'+ ? [+ <Dropdown.Item+ key="make-default"+ onClick={() =>+ setSelectedMethodForUse(paymentMethod)+ }+ >+ Use this card+ </Dropdown.Item>,+ <Dropdown.Separator key="card-separator" />,+ ]+ : []),+ <Dropdown.Item+ key="delete-method"+ onClick={() => setSelectedMethodToDelete(paymentMethod)}+ >+ Delete card+ </Dropdown.Item>,+ ]}+ >+ <Button+ type="outline"+ icon={<IconMoreHorizontal />}+ className="hover:border-gray-500 px-1"+ />+ </Dropdown>+ ) : null}+ </div>+ )+ })}+ </div>+ )}+ </FormSectionContent>+ </FormSection>+ </FormPanel>+ </>)}</>)}