@orvlin/node package is the server-side SDK for Node.js. Use it in the request path of your API to check entitlements and report usage.
Install
Create a client
viewer key can check entitlements. Reporting usage needs a developer key.
Options
Check an entitlement
check returns:
To read all of a customer’s entitlements:
checkCached. It returns null when there is no cached answer yet.
Cache management
Track usage
track returns the number accepted and the rejected events, with their index and the reason. Using the same idempotencyKey for retries counts the event once.
Credits
Errors
Failed calls throwOrvlinError, which has a status property for the HTTP status code when there is one.
Next steps
Usage metering
Design events so the numbers are right.
Errors
What each status code means.