Select an App for integration checks in the production Console (console.longplayai.com) and create a Sandbox Server Key with customers:write, entitlements:read and credits:consume. Sandbox data also belongs to production.
A metered Feature created under Features in Console; copy its ID.
A configured free default Product that includes the Feature, under Commerce → Catalog → Products in Console. New Customers receive it automatically.
Keep configuration in an ignored backend environment file. Give the free Product enough allowance for at least one check and consumption; never expose the Server Key in browser-public variables.
The command requires Node.js 22.6+. For Python/Go, load the same environment variables using your project's environment loader, then run python quickstart.py / go run . Use authenticated user IDs in the real application.
Success prints recorded: true. Running it again returns the same Customer and records another usage.
Also check the Customer ID, App/Sandbox response scope, check.allowed and usage receipt. The example generates a new usage ID on every run; persist and reuse the original idempotency key when recovering the same business action instead of rerunning it as a new debit.
Troubleshooting
Symptom
Fix
blocked: insufficient_balance
The Customer has no available balance for this Feature. Check the default Product's configuration, that it includes the Feature, and that it was assigned to this Customer. Default Products are not reassigned when an existing Customer signs in again.
401 UNAUTHENTICATED
The Key is incomplete, expired or revoked.
403 FORBIDDEN
The Key lacks a scope listed above.
403 SCOPE_MISMATCH
LONGPLAY_PROJECT_ID or environment does not match the Key's App and environment.
An error before any request is sent
The SDK validates input locally: for example, when LONGPLAY_FEATURE_ID is not a UUID, TypeScript throws a validation error (ZodError) and Python and Go raise a local INVALID_REQUEST with no HTTP status.
Troubleshooting
blocked: insufficient_balance
Fix
The Customer has no available balance for this Feature. Check the default Product's configuration, that it includes the Feature, and that it was assigned to this Customer. Default Products are not reassigned when an existing Customer signs in again.
401 UNAUTHENTICATED
Fix
The Key is incomplete, expired or revoked.
403 FORBIDDEN
Fix
The Key lacks a scope listed above.
403 SCOPE_MISMATCH
Fix
LONGPLAY_PROJECT_ID or environment does not match the Key's App and environment.
An error before any request is sent
Fix
The SDK validates input locally: for example, when LONGPLAY_FEATURE_ID is not a UUID, TypeScript throws a validation error (ZodError) and Python and Go raise a local INVALID_REQUEST with no HTTP status.