@apollo-deploy/billing-sdk
v2.2.0
Published
Central billing API for Apollo Deploy internal applications. Provides checkout, entitlement resolution, billing enforcement, usage ingestion, customer billing management, and Polar webhook handling.
Downloads
677
Readme
Apollo Billing API SDK
Central billing API for Apollo Deploy internal applications. Provides checkout, entitlement resolution, billing enforcement, usage ingestion, customer billing management, and Polar webhook handling.
Generated by Tesseract. Generated source files should not be edited manually.
Installation
npm install @apollo-deploy/billing-sdkQuick start
import { createApolloBillingClient } from '@apollo-deploy/billing-sdk';
const client = createApolloBillingClient({
baseUrl: 'https://billing.apollodeploy.com',
timeoutMs: 15_000,
});
// Domain clients are available directly on the client.
const api = client.health;Configuration and reliability
The generated transport supports:
- Bounded request timeouts and
AbortSignalcancellation - Exponential-backoff retries for transient failures
Retry-Afterhandling for rate limits- Per-request headers, timeout, and retry overrides
- Structured
SDKErrorvalues with HTTP status, error code, and request ID - Request/response hooks and transport plugins for logging or telemetry
const client = createApolloBillingClient({
timeoutMs: 30_000,
defaultHeaders: { 'X-Application': 'my-service' },
retries: {
attempts: 3,
backoffMs: 400,
jitter: true,
},
});Mutating requests are retried only when the request is considered idempotent, carries an idempotency key, or the retry policy explicitly allows it.
Documentation
| Domain | Description | |---|---| | HealthAPI | health operations | | CatalogAPI | catalog operations | | EnforcementAPI | enforcement operations | | EntitlementsAPI | entitlements operations | | CheckoutAPI | checkout operations | | CustomerBillingAPI | customerBilling operations | | UsageAPI | usage operations | | SubscriptionsAPI | subscriptions operations | | InvoicesAPI | invoices operations |
Error handling
import { SDKError } from '@apollo-deploy/billing-sdk';
try {
// await client.someDomain.someOperation();
} catch (error) {
if (error instanceof SDKError) {
console.error(error.status, error.code, error.requestId);
}
throw error;
}License
MIT
