This commit is contained in:
Nikita
2025-12-21 13:37:19 -08:00
commit 8cd4b943a5
173 changed files with 44266 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
import { useBilling } from "@flowglad/react"
export function RegularPlanButton() {
const { createCheckoutSession, loaded, errors } = useBilling()
if (!loaded || !createCheckoutSession) {
return (
<button type="button" disabled>
Loading checkout
</button>
)
}
if (errors) {
return <p>Unable to load checkout right now.</p>
}
const handlePurchase = async () => {
await createCheckoutSession({
priceSlug: "",
quantity: 1,
successUrl: `${window.location.origin}/billing/success`,
cancelUrl: `${window.location.origin}/billing/cancel`,
autoRedirect: true,
})
}
return <button onClick={handlePurchase}>Buy now</button>
}