From 704557f233f7a6c434c2aec38c59f75175b2835a Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Thu, 26 Mar 2026 20:24:54 +0100 Subject: [PATCH] feat: update frontend billing api for mollie (country, vat_id, payment method update) --- components/PricingSection.tsx | 4 ++-- lib/api/billing.ts | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/components/PricingSection.tsx b/components/PricingSection.tsx index abe8c1d..3d6c276 100644 --- a/components/PricingSection.tsx +++ b/components/PricingSection.tsx @@ -109,7 +109,7 @@ export default function PricingSection() { const [loadingPlan, setLoadingPlan] = useState(null) const { user } = useAuth() - // * Show toast when redirected from Polar Checkout with canceled=true + // * Show toast when redirected from Mollie Checkout with canceled=true useEffect(() => { if (searchParams.get('canceled') === 'true') { toast.info('Checkout was canceled. You can try again whenever you’re ready.') @@ -196,7 +196,7 @@ export default function PricingSection() { limit, }) - // 3. Redirect to Polar Checkout + // 3. Redirect to Mollie Checkout if (url) { window.location.href = url } else { diff --git a/lib/api/billing.ts b/lib/api/billing.ts index 49660a6..9f2d29c 100644 --- a/lib/api/billing.ts +++ b/lib/api/billing.ts @@ -72,6 +72,8 @@ export interface CreateCheckoutParams { plan_id: string interval: string limit: number + country: string + vat_id?: string } export async function createCheckoutSession(params: CreateCheckoutParams): Promise<{ url: string }> { @@ -81,6 +83,13 @@ export async function createCheckoutSession(params: CreateCheckoutParams): Promi }) } +/** Creates a Mollie checkout session to update the payment mandate. */ +export async function updatePaymentMethod(): Promise<{ url: string }> { + return apiRequest<{ url: string }>('/api/billing/update-payment-method', { + method: 'POST', + }) +} + export interface Order { id: string total_amount: number