5042).
Networks: Production = Arc Mainnet (chain ID
5042, RPC https://rpc.mainnet.arc.io, explorer https://explorer.arc.io). Development/test = Arc Testnet (chain ID 5042002, RPC https://rpc.testnet.arc.network, explorer https://testnet.arcscan.app, test USDC from faucet.circle.com). Default to Mainnet unless you are explicitly developing against testnet.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 an API key:
- API Key (
arc_live_...) — for server-side SDK calls and direct API requests. Pass it as thex-api-keyheader. Never expose this in the browser.
.env.local file along with the Arc Mainnet connection details:.env.local
For Arc Testnet development only, use
ARC_RPC_URL="https://rpc.testnet.arc.network" and CHAIN_ID="5042002" with test USDC from faucet.circle.com.3
Install the SDK
Add the FlareHQ SDK and The
viem (the Arc 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 POST requests to the Register your webhook URL in the dashboard under Settings > Webhooks. FlareHQ will generate a
webhookUrl you attached at initialization when payment events occur.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.

