Check entitlements and verify purchases from TypeScript/Node.js backends. Plain REST API — use fetch, axios, or any HTTP client. One call to gate a feature.
Your Tierux API key is a server-side secret. Store it in environment variables — never in client code, never in a public repo.
// .env (never commit) TIERUX_API_KEY=pe_live_xxxxxxxxxxxxxxxxxxxx // config.ts export const TIERUX_API_KEY = process.env.TIERUX_API_KEY!; export const TIERUX_BASE = 'https://tierux.com/api';
After your app sends a purchase token to your backend, call Tierux to verify it server-side.
// verify-purchase.ts export async function verifyGooglePlayPurchase(params: { appId: string; userId: string; packageName: string; productId: string; purchaseToken: string; }) { const res = await fetch( `${TIERUX_BASE}/v1/purchases/google-play/verify`, { method: 'POST', headers: { 'Authorization': `Bearer ${TIERUX_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify(params), } ); return res.json() as Promise<{ ok: boolean; entitlement: string; active: boolean; expiresAt: string; status: string; }>; }
Gate a feature by checking the user's entitlement state from your backend. One GET call — no caching, no state machine to maintain.
// check-entitlement.ts export async function isEntitled( userId: string, entitlement: string ): Promise<boolean> { const res = await fetch( `${TIERUX_BASE}/v1/entitlements/${userId}/${entitlement}`, { headers: { 'Authorization': `Bearer ${TIERUX_API_KEY}`, }, } ); const data = await res.json(); return data.active === true; }
Tierux is framework-agnostic. Use it with Express, Fastify, Next.js API routes, or any other Node.js backend.
// Next.js API route example export async function POST(request: Request) { const { purchaseToken, productId, userId } = await request.json(); const result = await verifyGooglePlayPurchase({ appId: 'app_123', userId, packageName: 'com.yourapp', productId, purchaseToken, }); return Response.json({ active: result.active, entitlement: result.entitlement, expiresAt: result.expiresAt, }); }
For iOS purchases, send the StoreKit 2 JWS to the Apple verify endpoint. Same response shape, same entitlement logic.
// Apple verification const res = await fetch( `${TIERUX_BASE}/v1/purchases/apple/verify`, { method: 'POST', headers: { 'Authorization': `Bearer ${TIERUX_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ appId: 'app_123', userId, transactionId, jwsRepresentation, }), } );
Gate features from any backend — one REST call per entitlement, platform-agnostic.
Deep dive on how Tierux verifies tokens server-side for Google Play and Apple.
Full integration path with curl examples and all available endpoints.
Free tier — unlimited apps, 1 paywall. No credit card, no revenue share.
Start free