Installation
Quick Start
The Metrifox SDK supports a modern client-based architecture for better organization and type safety.Configuration
Node.js:Get your API key from Settings → API Keys in your Metrifox dashboard.
Customer Management
Create a Customer
Update a Customer
The
customer_key cannot be changed after creation.Get Customer Data
Delete a Customer
Archive / Unarchive a Customer
Bulk CSV Upload
Usage Tracking & Access Control
Check Feature Access
Record Usage Events
List Usage Events
Retrieve usage events with optional filters and pagination:Compute Quantity Price
Compute the price for a given quantity of a feature for a customer, based on their plan. Useful for previewing upgrade costs or showing customers the cost of additional usage before they commit.Only available to tenants whose plan includes the finance API feature.
Complete Usage Example
Checkout & Billing
Embed Checkout Pages
Generate Checkout URL
Card Collection URL
Generate a hosted URL for collecting a payment method against an existing subscription or order. Useful for trial-to-paid conversions and re-collecting card details after expiry.Wallets & Credit Allocations
Framework Integration
React/Vite
Setup in main.jsx:Next.js
Setup in _app.js:Express
API Reference
Client Architecture
Functions
Initialization:init(config?)- Initialize and return the SDK client.configacceptsapiKey,baseUrl,webAppBaseUrl, andmeterServiceBaseUrl.
client.usages):
checkAccess(request)- Check feature access for a customerrecordUsage(request)- Record a usage eventlistEvents(params?)- List recorded usage events with optional filters and paginationquantityPrice(request)- Compute the price of a usage quantity (requires finance API feature)
client.customers):
create(request)- Add a customerupdate(customerKey, request)- Update a customerlist(params?)- Get a paginated list of customersget(customerKey)- Get a customerdelete(customerKey)- Delete a customerarchive(customerKey)- Archive a customerunarchive(customerKey)- Restore an archived customergetDetails(customerKey)- Get detailed customer informationuploadCsv(file)- Upload a CSV list of customersbulkCreate(request)- Create multiple customers in one callcheckActiveSubscription(customerKey)- Check for active subscription
client.checkout):
embed(config)- Embed checkout pages in your applicationurl(config)- Generate a checkout URLcardCollectionUrl(config)- Generate a hosted card-collection URL
client.wallets):
list(customerKey)- List a customer’s credit walletslistCreditAllocations(walletId, options?)- List credit allocations for a wallet (optionally filtered by status)getCreditAllocation(allocationId)- Get a single allocation with transaction history
TypeScript Support
All TypeScript types are available for import:Error Handling
Configuration
Environment Variables
Node.js:Custom URLs
METRIFOX_METER_SERVICE_BASE_URL environment variable.
Default URLs
- Production API:
https://api.metrifox.com/api/v1/ - Meter Service:
https://api-meter.metrifox.com/ - Web App:
https://app.metrifox.com
Support
- Email: support@metrifox.com
- Documentation: https://docs.metrifox.com
- GitHub: https://github.com/metrifox/metrifox-js
- Discord https://discord.gg/GGMHDDBdw
The JavaScript SDK works seamlessly across all modern JavaScript environments including Node.js, React, Next.js, Vue, and more.

