how it works

press buy, we handle the rest

01

press buy

a visitor clicks buy or add-credits. no account, no card, no problem — one action kicks off the whole chain.

02

log in, then charge

if they're signed out, checkout logs them in first — as a popup on desktop or a redirect on mobile — then charges the card on file.

03

add a card, then retry

no card yet? the add-card step opens automatically, and the charge retries the moment it's saved. idempotent, so nothing double-bills.

two ways to charge

a button, or the hook underneath

drop in <BuyButton> for marketplace purchases, or call useCheckout yourself for credit top-ups and custom buttons. both run the same seamless auth+charge flow.

  • BuyButton — one-click marketplace purchases (Stripe Connect)
  • useCheckout — top-ups and custom checkout on your own ui
  • interactionMode: popup on desktop, redirect on mobile — auto by default
  • idempotent charges that resume after a redirect and retry after add-card
buy.tsx
import { BuyButton } from "@hyperyai/sdk"
 
// drop-in "buy with Hypery" — runs login → charge → add-card → retry
<BuyButton
appId="app_123"
amountCents={499}
description="Pro upgrade"
onSuccess={(r) => toast.success(`paid ${r.paymentIntentId}`)}
onError={(e) => toast.error(e.message)}
/>

faq

questions

what does the checkout flow actually do?

one action runs the whole chain: press buy → log in if signed out → charge → add a card if there isn't one → retry → done. an unauthenticated visitor can click buy and be walked through all of it without you writing the glue.

popup or redirect?

both. interactionMode is 'auto' by default — a popup on desktop so checkout finishes in-page, and a redirect on mobile or when popups are blocked. redirect mode persists the pending checkout and resumes it automatically when the user returns.

what's the difference between BuyButton and useCheckout?

BuyButton is a drop-in 'buy with Hypery' button for marketplace purchases (a Stripe Connect charge credited to the seller). useCheckout is the hook underneath — use it on your own button, or for ai-credit top-ups, which BuyButton doesn't cover.

will a customer ever get double-charged?

no. purchases carry an idempotency key, so a charge that's resumed after a redirect or retried after adding a card settles exactly once.

add checkout to your ai app

let visitors buy in one click

drop in BuyButton or useCheckout and turn a signed-out visitor into a paid customer — login, card, and charge handled for you. see the full api in the checkout docs.

$npm install @hyperyai/sdk