Prerequisites: Node.js 18+ or Bun, a flarehq.xyz account, and a project directory ready for a new dependency. The SDK is framework-agnostic but the examples below use Next.js API routes.
1
Create your FlareHQ account
Head to flarehq.xyz and sign up with your business email. You’ll receive a 6-digit verification code — enter it on the confirmation screen to activate your account.Once verified, complete the merchant onboarding form:
- Business name — displayed on hosted checkout pages
- Payout wallet — choose a Circle MPC wallet (provisioned automatically) or bring your own external address
2
Generate your API keys
In the FlareHQ dashboard, navigate to Settings > API Keys at flarehq.xyz/developer.Click Generate new key to create a key pair:
- Secret Key (
fhq_sec_test_...) — for server-side SDK calls and direct API requests. Never expose this in the browser. - Publishable Key (
fhq_pub_test_...) — safe to include in client-side code and frontend environments.
.env.local file along with the Arc testnet connection details:.env.local
3
Install the SDK
Add the FlareHQ SDK and The
viem (the Arc testnet client library) to your project:@flarehq/sdk package ships full TypeScript types, so you get autocomplete and inline documentation in any TypeScript or JavaScript project.4
Initialize the FlareHQ client
Create a shared client instance that you can import wherever you need to interact with the FlareHQ API. A dedicated module keeps your configuration in one place and makes testing straightforward.Import
src/lib/flarehq.ts
flarehq from this module in your route handlers and server-side functions. Never import it in client components — the secret key must stay server-side only.5
Create your first checkout session
Call A successful response looks like this:Redirect your customer to
POST /api/payments/initialize (or the equivalent SDK method) to create a payment session. The response includes a checkoutUrl you can redirect customers to or embed as a link.checkoutUrl. FlareHQ handles the payment UI, wallet connection, and on-chain settlement. The session expires after 120 minutes if no payment is made.6
Set up webhooks
FlareHQ sends signed POST requests to your webhook URL when payment events occur. Verifying the signature ensures the event genuinely came from FlareHQ and hasn’t been tampered with.Register your webhook URL in the dashboard under Settings > Webhooks. FlareHQ will generate a
src/app/api/webhooks/route.ts
FLAREHQ_WEBHOOK_SECRET for you — add it to your environment variables.Always verify the
x-flarehq-signature header before acting on a webhook. Skipping verification leaves your endpoint open to spoofed events.Next steps
You’ve got the foundations in place. Here are the most common directions to explore next:Hosted Checkout
Customise the checkout page with your logo, colours, and success redirect behaviour.
x402 Micro-Paywalls
Gate an API endpoint and charge AI agents or third-party clients per request.
Streaming Payments
Set up a per-second USDC stream to a contractor, subscription, or DAO treasury.
Escrow & Disputes
Hold funds in a milestone-gated contract with on-chain dispute resolution.

