Checkout flow
What happens from purchase click to credited wallet.
neonFin keeps checkout wiring small in your app.
The user flow
- The user clicks
PurchaseButton. PurchaseDialoglists the matching prices configured in neonFin.- The user picks a package.
- The client calls
createCheckout(priceId). - neonFin creates a Stripe or Polar checkout and returns the checkout URL.
- Desktop users complete checkout in a popup; mobile/touch users redirect.
- The provider sends a webhook to neonFin after payment.
- neonFin credits the wallet.
- The original page or returning page refreshes the balance.
Why webhooks matter
The webhook is the source of truth for payment. Do not grant credits just because a browser returns from checkout. A user can close the tab, refresh the page, or return before the provider has fully settled the payment.
neonFin verifies the provider webhook, finds the order, and grants credits idempotently. Retried webhooks do not duplicate credits.
Checkout return handling
The default components handle the return path:
PurchaseDialogstores the pending order id inlocalStorage.- Popup checkout keeps your page mounted and polls the order while the customer pays.
- Redirect checkout is resumed by
NeonfinProviderwhen the user returns. - The provider context polls until the order is paid, failed, refunded, or the popup is closed.
- When the order is paid, it stores the issued code and refreshes balances.
That means most apps do not need a custom checkout callback page.
Refunds and subscriptions
Refund events reverse the original credit grant. Subscription renewals grant the same number of credits as the original subscription price. Cancellation events are recorded but do not remove credits already granted for paid periods.