Skip to main content
The Tip Stack SDK API gives React and Next.js applications full programmatic control over the tipping flow. Instead of dropping in a static HTML snippet, you call three lightweight REST endpoints — initialize a session, trigger a tip intent, and subscribe to confirmed-tip events — and build your own UI on top.
Never expose your API key on the client side. Make the /sdk/init call from your backend and return only the sessionToken to your frontend.

Integration steps

1

Get your API key

Open your creator dashboard and navigate to Settings → Developer → API Keys. Generate a new secret key and store it securely in your server-side environment variables (e.g. .env.local for Next.js).
.env.local
2

Initialize an SDK session

Call POST /api/sdk/init from your server (an API route, a Server Component, or a Next.js Route Handler). Pass your API key in the Authorization header along with the creator’s ID and the origin URL of the embedding page.
app/api/tipstack/session/route.ts
A successful response looks like:
The sessionToken (prefixed sdk_sess_) authorizes all subsequent SDK calls for this page load. The embedUrl is a fully hosted checkout page you can render directly in an <iframe> — see Rendering the hosted checkout below.
3

Trigger a tip

Call POST /api/sdk/tip from the client using the sessionToken returned in the previous step. Supply the tip amount, the token mint address, the sender’s wallet address, and the creator’s ID.
The response returns an intentId and a status of requires_action, indicating the user must sign the transaction in their wallet to complete the tip.
4

Listen for confirmed tip events

Poll GET /api/sdk/events with your API key (server-side) to receive a list of confirmed tip events for a creator. Use the optional since query parameter to fetch only events after a given ISO timestamp.
app/api/tipstack/events/route.ts
Each event in the response array has this shape:
Up to 50 confirmed tips are returned per request, ordered newest-first.

Full React example

The component below combines all three steps into a self-contained TipButton. The /sdk/init call is proxied through your own Next.js API route so the API key never reaches the browser.
TipButton.tsx
The /sdk/init call in the example above goes through /api/tipstack/session — your own server-side route that holds the API key. Never call https://tipstack.fun/api/sdk/init directly from the browser; doing so would expose your secret API key to anyone who inspects network requests.

Rendering the hosted checkout

If you prefer a fully managed UI instead of building your own, render the embedUrl from /sdk/init inside an <iframe>. Tip Stack hosts and updates the checkout experience — you just provide the container.
EmbedCheckout.tsx
The embedUrl includes your chosen theme as a query parameter (e.g. ?theme=dark). To switch themes, re-initialize the session with a different theme value.

Listening for tip events in the client

To update your UI in real time when a tip is confirmed, poll your own events proxy on a short interval and compare the latest timestamp.
useTipEvents.ts

API reference

Initializes a new SDK session and validates the embedding origin.HeadersBodyResponse200 OK
Creates a tip intent within the current SDK session.HeadersBodyResponse200 OK
Returns confirmed tip events for a creator, newest-first.HeadersQuery parametersResponse200 OKReturns up to 50 tip_completed events. Each event includes eventId, type, amountUsdc, amountRaw, tokenSymbol, sender, timestamp, and txSignature.