Add Mollie checkout flow, billing UI, and payment UX polish #71
@@ -109,7 +109,7 @@ export default function PricingSection() {
|
|||||||
const [loadingPlan, setLoadingPlan] = useState<string | null>(null)
|
const [loadingPlan, setLoadingPlan] = useState<string | null>(null)
|
||||||
const { user } = useAuth()
|
const { user } = useAuth()
|
||||||
|
|
||||||
// * Show toast when redirected from Polar Checkout with canceled=true
|
// * Show toast when redirected from Mollie Checkout with canceled=true
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (searchParams.get('canceled') === 'true') {
|
if (searchParams.get('canceled') === 'true') {
|
||||||
toast.info('Checkout was canceled. You can try again whenever you’re ready.')
|
toast.info('Checkout was canceled. You can try again whenever you’re ready.')
|
||||||
@@ -196,7 +196,7 @@ export default function PricingSection() {
|
|||||||
limit,
|
limit,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 3. Redirect to Polar Checkout
|
// 3. Redirect to Mollie Checkout
|
||||||
if (url) {
|
if (url) {
|
||||||
window.location.href = url
|
window.location.href = url
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ export interface CreateCheckoutParams {
|
|||||||
plan_id: string
|
plan_id: string
|
||||||
interval: string
|
interval: string
|
||||||
limit: number
|
limit: number
|
||||||
|
country: string
|
||||||
|
vat_id?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function createCheckoutSession(params: CreateCheckoutParams): Promise<{ url: 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 {
|
export interface Order {
|
||||||
id: string
|
id: string
|
||||||
total_amount: number
|
total_amount: number
|
||||||
|
|||||||
Reference in New Issue
Block a user