@usebillow/sdk 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/{billing-B16zL5xU.d.cts → billing-8ug1Gw05.d.cts} +9 -9
- package/dist/{billing-BF4OGaLI.d.ts → billing-Bs10EcjR.d.ts} +9 -9
- package/dist/{billing-status-BZQN_gm7.d.cts → billing-status-DZkB0VPK.d.cts} +5 -5
- package/dist/{billing-status-BZQN_gm7.d.ts → billing-status-DZkB0VPK.d.ts} +5 -5
- package/dist/{chunk-CCG4F5FK.js → chunk-47J7FYM5.js} +2 -2
- package/dist/chunk-47J7FYM5.js.map +1 -0
- package/dist/{chunk-GT5VBLN5.js → chunk-XKN7ZRAR.js} +45 -22
- package/dist/chunk-XKN7ZRAR.js.map +1 -0
- package/dist/config.cjs +3 -3
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +9 -9
- package/dist/config.d.ts +9 -9
- package/dist/config.js +3 -3
- package/dist/config.js.map +1 -1
- package/dist/{hosted-domains-DwakPG4J.d.cts → hosted-domains-Ci6jeNAe.d.cts} +15 -1
- package/dist/{hosted-domains-DSTQ1GZz.d.ts → hosted-domains-DSs5Iw9U.d.ts} +15 -1
- package/dist/index.cjs +43 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +52 -47
- package/dist/index.d.ts +52 -47
- package/dist/index.js +2 -2
- package/dist/ingestion.cjs.map +1 -1
- package/dist/ingestion.d.cts +18 -18
- package/dist/ingestion.d.ts +18 -18
- package/dist/ingestion.js.map +1 -1
- package/dist/react.cjs +28 -5
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +6 -6
- package/dist/react.d.ts +6 -6
- package/dist/react.js +2 -2
- package/dist/react.js.map +1 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +11 -11
- package/dist/server.d.ts +11 -11
- package/dist/server.js.map +1 -1
- package/dist/status.cjs.map +1 -1
- package/dist/status.d.cts +1 -1
- package/dist/status.d.ts +1 -1
- package/dist/status.js +1 -1
- package/dist/webhooks.cjs.map +1 -1
- package/dist/webhooks.d.cts +20 -15
- package/dist/webhooks.d.ts +20 -15
- package/dist/webhooks.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-CCG4F5FK.js.map +0 -1
- package/dist/chunk-GT5VBLN5.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { f as SavedPaymentMethod, g as CreateHostedDomainInput, h as PayInvoiceInput } from './index.d-DSEYhV2c.cjs';
|
|
2
2
|
export { i as ContractAddSubscriptionItemInput, j as ContractApplySubscriptionCouponInput, k as ContractCancelSubscriptionInput, l as ContractChangeSubscriptionPlanInput, m as ContractCreateChargeInput, n as ContractCreateCustomerInput, o as ContractCreateMerchantInitiatedChargeInput, p as ContractCreatePortalSessionInput, q as ContractCreateProductInput, r as ContractCreateSubscriptionInput, s as ContractCreateWebhookEndpointInput, M as ContractMigrateSubscribersInput, R as ContractRefundChargeInput, t as ContractResolveRefundInput, U as ContractUpdateProductInput, u as ContractUpdateSubscriptionItemInput, v as ContractUpdateWebhookEndpointInput, H as HostedDomain, w as HostedDomainList, I as InvoicePaymentResult } from './index.d-DSEYhV2c.cjs';
|
|
3
|
-
import { C as ChargeStatus, P as PaymentMethodStatus, I as InvoiceStatus, R as RefundStatus, W as WebhookDeliveryStatus } from './billing-status-
|
|
4
|
-
export { a as CHARGE_STATUSES, b as INVOICE_STATUSES, c as PAYMENT_METHOD_STATUSES, d as REFUND_STATUSES, e as WEBHOOK_DELIVERY_STATUSES } from './billing-status-
|
|
3
|
+
import { C as ChargeStatus, P as PaymentMethodStatus, I as InvoiceStatus, R as RefundStatus, W as WebhookDeliveryStatus } from './billing-status-DZkB0VPK.cjs';
|
|
4
|
+
export { a as CHARGE_STATUSES, b as INVOICE_STATUSES, c as PAYMENT_METHOD_STATUSES, d as REFUND_STATUSES, e as WEBHOOK_DELIVERY_STATUSES } from './billing-status-DZkB0VPK.cjs';
|
|
5
5
|
import { SubscriptionStatus } from './status.cjs';
|
|
6
6
|
export { ACTIVE_SUBSCRIPTION_STATUSES, NEVER_ACTIVATED_SUBSCRIPTION_STATUSES, SUBSCRIPTION_STATUSES, TERMINAL_SUBSCRIPTION_STATUSES, grantsAccess, isTerminal } from './status.cjs';
|
|
7
|
-
import { c as TaxBehavior, d as Customer, U as UnappliedPaymentReason, e as CreateChargeInput, R as RequestOptions, f as Charge, g as CreateMerchantInitiatedChargeInput, I as IdempotentRequestOptions, h as CallOptions, C as CreateProductInput, i as UpdateProductInput, j as MigrationResult, k as CreateSubscriptionInput, B as BillowOptions, a as CreateCouponInput, l as Coupon, F as FeatureKind, M as MeterConfig, m as Feature, n as UpdateFeatureInput, o as UsageAlert, p as CreateUsageAlertInput, b as CheckResult, T as TrackResult, E as EntitlementView, A as AttachResult } from './billing-
|
|
8
|
-
export { q as ActivatedSubscriptionResult, r as BillingInterval, s as CouponDuration, t as CouponKind, u as CreateSubscriptionResult, v as EntitlementInput, w as MeterAggregation, x as MeterFilter, y as MeterRoundingMode, z as PendingSubscriptionCheckoutResult, D as PriceInput, P as Product, G as ProductEntitlement, H as ProductPrice, S as Subscription, J as SubscriptionDetail, K as SubscriptionItem, L as UpdatePriceInput, N as UsageAlertKind, O as UsageAlertMetric, Q as UsageModel, V as UsageTier } from './billing-
|
|
9
|
-
import { a as CreditThresholdLevel, e as CreditGrant, f as CreditTopUp, g as CreditIncludedWindow, h as CreateCreditGrantInput, i as CreditGrantRequestResult, j as CreditPacks, k as CreateCreditPackInput, l as CreditPack, U as UpdateCreditPackInput, m as CreateCreditIncludedRuleInput, n as CreditIncludedRule, o as UpdateCreditIncludedRuleInput, p as CreditIncludedWindowListParams, q as CreateCreditTopUpInput, r as CreditTopUpRequestResult, s as CreditTopUpListParams, t as CreditBalance, u as CreditLedgerEntry, v as CreditUsageParams, w as CreditUsage } from './hosted-domains-
|
|
10
|
-
export { x as CreditAccountStatus, y as CreditAllocationInterval, C as CreditGrantKind, z as CreditMoney, A as CreditPackBreakdown, B as CreditPackListItem, D as CreditTopUpStatus, E as CreditTransactionType, F as CreditUsageGroupBy, G as CreditWindowState, H as HostedDomainActivatedData, d as HostedDomainDisabledData, b as HostedDomainDnsFailingData, I as HostedDomainEventBase, c as HostedDomainReassignmentPendingData, J as HostedDomainStatus, K as HostedDomainStatusReason, L as IncludedCredits, M as IncludedPeriod } from './hosted-domains-
|
|
7
|
+
import { c as TaxBehavior, d as Customer, U as UnappliedPaymentReason, e as CreateChargeInput, R as RequestOptions, f as Charge, g as CreateMerchantInitiatedChargeInput, I as IdempotentRequestOptions, h as CallOptions, C as CreateProductInput, i as UpdateProductInput, j as MigrationResult, k as CreateSubscriptionInput, B as BillowOptions, a as CreateCouponInput, l as Coupon, F as FeatureKind, M as MeterConfig, m as Feature, n as UpdateFeatureInput, o as UsageAlert, p as CreateUsageAlertInput, b as CheckResult, T as TrackResult, E as EntitlementView, A as AttachResult } from './billing-8ug1Gw05.cjs';
|
|
8
|
+
export { q as ActivatedSubscriptionResult, r as BillingInterval, s as CouponDuration, t as CouponKind, u as CreateSubscriptionResult, v as EntitlementInput, w as MeterAggregation, x as MeterFilter, y as MeterRoundingMode, z as PendingSubscriptionCheckoutResult, D as PriceInput, P as Product, G as ProductEntitlement, H as ProductPrice, S as Subscription, J as SubscriptionDetail, K as SubscriptionItem, L as UpdatePriceInput, N as UsageAlertKind, O as UsageAlertMetric, Q as UsageModel, V as UsageTier } from './billing-8ug1Gw05.cjs';
|
|
9
|
+
import { a as CreditThresholdLevel, e as CreditGrant, f as CreditTopUp, g as CreditIncludedWindow, h as CreateCreditGrantInput, i as CreditGrantRequestResult, j as CreditPacks, k as CreateCreditPackInput, l as CreditPack, U as UpdateCreditPackInput, m as CreateCreditIncludedRuleInput, n as CreditIncludedRule, o as UpdateCreditIncludedRuleInput, p as CreditIncludedWindowListParams, q as CreateCreditTopUpInput, r as CreditTopUpRequestResult, s as CreditTopUpListParams, t as CreditBalance, u as CreditLedgerEntry, v as CreditUsageParams, w as CreditUsage } from './hosted-domains-Ci6jeNAe.cjs';
|
|
10
|
+
export { x as CreditAccountStatus, y as CreditAllocationInterval, C as CreditGrantKind, z as CreditMoney, A as CreditPackBreakdown, B as CreditPackListItem, D as CreditTopUpStatus, E as CreditTransactionType, F as CreditUsageGroupBy, G as CreditWindowState, H as HostedDomainActivatedData, d as HostedDomainDisabledData, b as HostedDomainDnsFailingData, I as HostedDomainEventBase, c as HostedDomainReassignmentPendingData, J as HostedDomainStatus, K as HostedDomainStatusReason, L as IncludedCredits, M as IncludedPeriod } from './hosted-domains-Ci6jeNAe.cjs';
|
|
11
11
|
import 'zod';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* The machine-readable error codes billow returns on `BillowApiError.code`. Mirrored from
|
|
15
|
-
* `@billow/core`'s `BILLOW_ERROR_CODES` (the server's source of truth)
|
|
15
|
+
* `@billow/core`'s `BILLOW_ERROR_CODES` (the server's source of truth) - the SDK carries no
|
|
16
16
|
* runtime dependency on core, so `error-codes.test.ts` asserts this list stays in lockstep.
|
|
17
17
|
*
|
|
18
18
|
* `switch` on these for programmatic handling (e.g. surface `rate_limited` vs `validation_error`
|
|
@@ -98,7 +98,7 @@ interface ProviderCredentialSummary {
|
|
|
98
98
|
currency: string;
|
|
99
99
|
config: Record<string, unknown>;
|
|
100
100
|
}
|
|
101
|
-
/** The editable view of one credential set
|
|
101
|
+
/** The editable view of one credential set - secret values are never returned. */
|
|
102
102
|
interface CredentialSet {
|
|
103
103
|
provider: string;
|
|
104
104
|
currency: string;
|
|
@@ -134,7 +134,7 @@ interface BusinessProfile {
|
|
|
134
134
|
logoUrl: string | null;
|
|
135
135
|
/** Brand/accent color as `#RRGGBB` (PRD-11); null = billow's default accent. */
|
|
136
136
|
brandColor: string | null;
|
|
137
|
-
/** Org-default tax treatment (Phase E)
|
|
137
|
+
/** Org-default tax treatment (Phase E) - every taxable price inherits this. */
|
|
138
138
|
taxEnabled: boolean;
|
|
139
139
|
/** Default rate in basis points (1% = 100 bps), e.g. 1400 for Egypt's 14% VAT. */
|
|
140
140
|
taxRateBps: number;
|
|
@@ -234,7 +234,7 @@ interface Paginated<T> {
|
|
|
234
234
|
* size), so it is correct under concurrent inserts/deletes; a list that grows at its head pages
|
|
235
235
|
* by cursor instead ({@link CursorListPromise}). The caller's {@link CallOptions} (`signal` /
|
|
236
236
|
* `timeoutMs`) apply to EVERY page
|
|
237
|
-
* fetch
|
|
237
|
+
* fetch - an abort stops the walk mid-stream; `timeoutMs` is per page.
|
|
238
238
|
*
|
|
239
239
|
* A returned value is ONE walk: page 1 is cached on it (so `await` then `for await` on the same
|
|
240
240
|
* value fetch page 1 once), which means iterating the same value again later reuses that first
|
|
@@ -353,7 +353,7 @@ interface CustomerUsage {
|
|
|
353
353
|
allowance: number | null;
|
|
354
354
|
/** Gross units used this period (sum of positive events in the period). */
|
|
355
355
|
used: number;
|
|
356
|
-
/** Units topped up this period
|
|
356
|
+
/** Units topped up this period - gross credit-backs (negative events). */
|
|
357
357
|
added: number;
|
|
358
358
|
/** Remaining = allowance + added − used; null = unlimited. May be negative (overage). */
|
|
359
359
|
remaining: number | null;
|
|
@@ -431,7 +431,7 @@ interface SubscriptionListItem {
|
|
|
431
431
|
scheduledChange: ScheduledSubscriptionChange | null;
|
|
432
432
|
/** Renewals left before a limited-term subscription ends; null = open-ended. */
|
|
433
433
|
remainingCycles: number | null;
|
|
434
|
-
/** Failed-renewal retries run so far (PRD-06 dunning)
|
|
434
|
+
/** Failed-renewal retries run so far (PRD-06 dunning) - 0 until a renewal fails. */
|
|
435
435
|
dunningAttempts: number;
|
|
436
436
|
/** ISO-8601 time the next dunning retry is due; null when not in dunning (PRD-09). */
|
|
437
437
|
nextDunningAt: string | null;
|
|
@@ -471,7 +471,7 @@ interface EmailTemplateSetting {
|
|
|
471
471
|
defaultSubject: string;
|
|
472
472
|
/** The variables the subject/message may reference (without braces). */
|
|
473
473
|
variables: string[];
|
|
474
|
-
/** False for compliance-required templates (the receipt)
|
|
474
|
+
/** False for compliance-required templates (the receipt) - can't be disabled. */
|
|
475
475
|
canDisable: boolean;
|
|
476
476
|
/** Subject override, or null when the default is in effect. */
|
|
477
477
|
subject: string | null;
|
|
@@ -580,7 +580,7 @@ interface InvoiceListItem {
|
|
|
580
580
|
currency: string;
|
|
581
581
|
customerExternalId: string;
|
|
582
582
|
subscriptionId: string | null;
|
|
583
|
-
/** What the invoice is for
|
|
583
|
+
/** What the invoice is for - the plan name (subscriptions) or first line item. */
|
|
584
584
|
reason: string | null;
|
|
585
585
|
periodStart: string | null;
|
|
586
586
|
periodEnd: string | null;
|
|
@@ -633,7 +633,7 @@ interface MetricsOverview {
|
|
|
633
633
|
to: string;
|
|
634
634
|
/** Monthly recurring revenue (minor units). */
|
|
635
635
|
mrr: number;
|
|
636
|
-
/** Annual recurring revenue (minor units)
|
|
636
|
+
/** Annual recurring revenue (minor units) - `mrr × 12`. */
|
|
637
637
|
arr: number;
|
|
638
638
|
/** Cohort subscription churn over the window (0..1); null if none were active at its start. */
|
|
639
639
|
churnRate: number | null;
|
|
@@ -697,7 +697,7 @@ interface Whoami {
|
|
|
697
697
|
organizationId: string;
|
|
698
698
|
organizationName: string | null;
|
|
699
699
|
organizationSlug: string | null;
|
|
700
|
-
/** The billing workspace the API key scopes to
|
|
700
|
+
/** The billing workspace the API key scopes to - what every resource belongs to. */
|
|
701
701
|
projectId: string;
|
|
702
702
|
projectName: string | null;
|
|
703
703
|
projectSlug: string | null;
|
|
@@ -925,7 +925,7 @@ interface CreatePortalSessionInput {
|
|
|
925
925
|
customerId: string;
|
|
926
926
|
/** Which surface to land on; defaults to the self-serve portal. */
|
|
927
927
|
flow?: PortalSessionFlow;
|
|
928
|
-
/** Product slug to subscribe to
|
|
928
|
+
/** Product slug to subscribe to - required when `flow` is `checkout`. */
|
|
929
929
|
productId?: string;
|
|
930
930
|
/**
|
|
931
931
|
* Where the surface returns the Customer when they finish or exit: an absolute `https` URL
|
|
@@ -943,7 +943,7 @@ interface PortalSession {
|
|
|
943
943
|
id: string;
|
|
944
944
|
url: string;
|
|
945
945
|
flow: PortalSessionFlow;
|
|
946
|
-
/** ISO-8601 expiry
|
|
946
|
+
/** ISO-8601 expiry - the session (and its URL) stop working after this. */
|
|
947
947
|
expiresAt: string;
|
|
948
948
|
}
|
|
949
949
|
/** The single-use entry exchange's input (`BillowPortal.exchange`). */
|
|
@@ -1015,7 +1015,7 @@ interface PortalPlanChange {
|
|
|
1015
1015
|
subscription: PortalSubscriptionStatus;
|
|
1016
1016
|
/** Upgrade only: the proration invoice raised for the prorated delta, when non-zero. */
|
|
1017
1017
|
prorationInvoiceId?: string;
|
|
1018
|
-
/** Upgrade only: the proration charge's status (`succeeded`/`failed`/`processing`/`pending`)
|
|
1018
|
+
/** Upgrade only: the proration charge's status (`succeeded`/`failed`/`processing`/`pending`) -
|
|
1019
1019
|
* present when an immediate charge was raised, so a client can surface an unresolved payment. */
|
|
1020
1020
|
chargeStatus?: string;
|
|
1021
1021
|
}
|
|
@@ -1314,9 +1314,9 @@ interface WebhookEndpoint {
|
|
|
1314
1314
|
createdAt: string;
|
|
1315
1315
|
updatedAt: string;
|
|
1316
1316
|
}
|
|
1317
|
-
/** Returned once at create/rotate
|
|
1317
|
+
/** Returned once at create/rotate - carries the plaintext signing secret. */
|
|
1318
1318
|
interface WebhookEndpointWithSecret extends WebhookEndpoint {
|
|
1319
|
-
/** The HMAC signing secret
|
|
1319
|
+
/** The HMAC signing secret - shown exactly once. Store it now; it is never listed again. */
|
|
1320
1320
|
secret: string;
|
|
1321
1321
|
}
|
|
1322
1322
|
interface CreateWebhookEndpointInput {
|
|
@@ -1357,15 +1357,20 @@ declare class BillowApiError extends Error {
|
|
|
1357
1357
|
readonly code: BillowErrorCode | (string & {});
|
|
1358
1358
|
/** Structured error context from the server (e.g. per-field validation issues), when present. */
|
|
1359
1359
|
readonly details?: unknown;
|
|
1360
|
-
/** billow's per-request id (`x-request-id`)
|
|
1360
|
+
/** billow's per-request id (`x-request-id`) - quote it in a bug report to trace the server log. */
|
|
1361
1361
|
readonly requestId?: string | undefined;
|
|
1362
|
-
|
|
1362
|
+
/**
|
|
1363
|
+
* How many seconds to wait before trying again, from the response's `Retry-After` header (sent
|
|
1364
|
+
* with a `429 rate_limited`); undefined when the response did not say.
|
|
1365
|
+
*/
|
|
1366
|
+
readonly retryAfterSeconds?: number | undefined;
|
|
1367
|
+
constructor(status: number, code: BillowErrorCode | (string & {}), message: string, details?: unknown, requestId?: string, retryAfterSeconds?: number);
|
|
1363
1368
|
}
|
|
1364
1369
|
/** Everything a request needs: the transport, the base URL, the bearer, and resilience knobs. */
|
|
1365
1370
|
interface RequestContext {
|
|
1366
1371
|
fetch: typeof fetch;
|
|
1367
1372
|
baseUrl: string;
|
|
1368
|
-
/** The bearer
|
|
1373
|
+
/** The bearer - a secret/publishable API key, or a portal-session token. */
|
|
1369
1374
|
bearer: string;
|
|
1370
1375
|
timeoutMs: number;
|
|
1371
1376
|
maxRetries: number;
|
|
@@ -2005,7 +2010,7 @@ declare function createInvoicesResource(ctx: RequestContext): {
|
|
|
2005
2010
|
receipt: (id: string, options?: CallOptions) => Promise<ArrayBuffer>;
|
|
2006
2011
|
};
|
|
2007
2012
|
|
|
2008
|
-
/** The marketplace Integration catalog
|
|
2013
|
+
/** The marketplace Integration catalog - install / configure / toggle / uninstall (ADR-0008). */
|
|
2009
2014
|
declare function createMarketplaceResource(ctx: RequestContext): {
|
|
2010
2015
|
/** Every available Integration with this tenant's install state (no secret values). */
|
|
2011
2016
|
catalog: (options?: CallOptions) => Promise<CatalogItem[]>;
|
|
@@ -2210,7 +2215,7 @@ declare function createProductsResource(ctx: RequestContext): {
|
|
|
2210
2215
|
};
|
|
2211
2216
|
|
|
2212
2217
|
/**
|
|
2213
|
-
* Organization settings (Phase D3, F)
|
|
2218
|
+
* Organization settings (Phase D3, F) - the configurable dunning schedule, usage settlement grace,
|
|
2214
2219
|
* the cross-currency reporting currency + FX-rate registry (ADR-0013), and transactional email
|
|
2215
2220
|
* template overrides (PRD-10). All secret-key/server-side surface.
|
|
2216
2221
|
*/
|
|
@@ -2229,7 +2234,7 @@ declare function createSettingsResource(ctx: RequestContext): {
|
|
|
2229
2234
|
};
|
|
2230
2235
|
/**
|
|
2231
2236
|
* Usage settlement grace (hours): defers *collection* of a boundary-adjacent priced
|
|
2232
|
-
* calendar-meter renewal past the tz month boundary until late usage settles
|
|
2237
|
+
* calendar-meter renewal past the tz month boundary until late usage settles - the billed
|
|
2233
2238
|
* windows/amount are unchanged, only the invoice timing shifts. `0` disables it (the default);
|
|
2234
2239
|
* a no-op for any subscription without a priced calendar meter. Cap 72h.
|
|
2235
2240
|
*/
|
|
@@ -2421,7 +2426,7 @@ declare function createSubscriptionsResource(ctx: RequestContext): {
|
|
|
2421
2426
|
productSlug: string;
|
|
2422
2427
|
productMetadata: Record<string, string>;
|
|
2423
2428
|
} | null>;
|
|
2424
|
-
/** Cancel
|
|
2429
|
+
/** Cancel - immediately, or at period end with `{ atPeriodEnd: true }`. */
|
|
2425
2430
|
cancel: (id: string, opts?: {
|
|
2426
2431
|
atPeriodEnd?: boolean;
|
|
2427
2432
|
}) => Promise<{
|
|
@@ -2530,7 +2535,7 @@ declare function createSubscriptionsResource(ctx: RequestContext): {
|
|
|
2530
2535
|
couponId: string;
|
|
2531
2536
|
cyclesRemaining: number | null;
|
|
2532
2537
|
}>;
|
|
2533
|
-
/** Change plan
|
|
2538
|
+
/** Change plan - immediate prorated upgrade, or downgrade scheduled for period end. `productId` accepts the product's id or slug. */
|
|
2534
2539
|
changePlan: (id: string, productId: string) => Promise<{
|
|
2535
2540
|
id: string;
|
|
2536
2541
|
status: "active" | "incomplete" | "incomplete_expired" | "trialing" | "past_due" | "paused" | "canceled" | "unpaid";
|
|
@@ -2638,14 +2643,14 @@ declare function createWebhookEndpointsResource(ctx: RequestContext): {
|
|
|
2638
2643
|
update: (id: string, input: UpdateWebhookEndpointInput) => Promise<WebhookEndpoint>;
|
|
2639
2644
|
/** Delete an endpoint and its delivery history. */
|
|
2640
2645
|
delete: (id: string) => Promise<void>;
|
|
2641
|
-
/** Rotate the signing secret
|
|
2646
|
+
/** Rotate the signing secret - the new plaintext is returned once. */
|
|
2642
2647
|
rotateSecret: (id: string) => Promise<WebhookEndpointWithSecret>;
|
|
2643
2648
|
/** List delivery attempts for an endpoint (newest first). Auto-paginating. */
|
|
2644
2649
|
deliveries: (id: string, params?: ListParams, options?: CallOptions) => ListPromise<WebhookDelivery>;
|
|
2645
2650
|
};
|
|
2646
2651
|
|
|
2647
2652
|
/**
|
|
2648
|
-
* billow client SDK
|
|
2653
|
+
* billow client SDK - the "two lines of code" surface, mirroring Autumn's shape
|
|
2649
2654
|
* (CONTEXT/ARCHITECTURE §10). A thin typed wrapper over the billow REST API.
|
|
2650
2655
|
*
|
|
2651
2656
|
* const billow = new Billow(process.env.BILLOW_SECRET_KEY!);
|
|
@@ -2684,7 +2689,7 @@ declare class Billow {
|
|
|
2684
2689
|
/** Custom domains for the hosted customer portal (live keys, behind a rollout flag). */
|
|
2685
2690
|
hostedDomains: ReturnType<typeof createHostedDomainsResource>;
|
|
2686
2691
|
/**
|
|
2687
|
-
* Organization settings (Phase D3, F)
|
|
2692
|
+
* Organization settings (Phase D3, F) - the configurable dunning schedule, usage settlement grace,
|
|
2688
2693
|
* and the cross-currency reporting currency + FX-rate registry (ADR-0013).
|
|
2689
2694
|
*/
|
|
2690
2695
|
settings: ReturnType<typeof createSettingsResource>;
|
|
@@ -2692,12 +2697,12 @@ declare class Billow {
|
|
|
2692
2697
|
coupons: {
|
|
2693
2698
|
/** Define a coupon (a reusable discount template). */
|
|
2694
2699
|
create: (input: CreateCouponInput) => Promise<Coupon>;
|
|
2695
|
-
/** List coupons (secret key only
|
|
2700
|
+
/** List coupons (secret key only - enumerates live promo codes). Auto-paginating. */
|
|
2696
2701
|
list: (params?: ListParams, options?: CallOptions) => ListPromise<Coupon>;
|
|
2697
2702
|
/** Deactivate a coupon (existing discounts keep running). */
|
|
2698
2703
|
deactivate: (id: string) => Promise<Coupon>;
|
|
2699
2704
|
};
|
|
2700
|
-
/** Manage developer webhook endpoints
|
|
2705
|
+
/** Manage developer webhook endpoints - register, rotate secrets, inspect deliveries.
|
|
2701
2706
|
* (To VERIFY incoming deliveries, import `constructEvent` from `@usebillow/sdk/webhooks`.) */
|
|
2702
2707
|
features: {
|
|
2703
2708
|
/** Define a feature (a boolean access gate, or a metered feature with a meter). */
|
|
@@ -2708,7 +2713,7 @@ declare class Billow {
|
|
|
2708
2713
|
meter?: MeterConfig;
|
|
2709
2714
|
}) => Promise<Feature>;
|
|
2710
2715
|
/**
|
|
2711
|
-
* Edit a feature in place: its `name`, and
|
|
2716
|
+
* Edit a feature in place: its `name`, and - for a metered feature - its `meter`
|
|
2712
2717
|
* aggregation. The server refuses a meter change once usage has been recorded (it
|
|
2713
2718
|
* would rewrite billed history), so set the meter right at create time or before you
|
|
2714
2719
|
* start tracking. Returns the updated feature.
|
|
@@ -2742,7 +2747,7 @@ declare class Billow {
|
|
|
2742
2747
|
* choose a credential set and `target` to probe one verify target (Paymob: a
|
|
2743
2748
|
* method); pass `sampleToken` (SANDBOX ONLY) to run a functional sub-test.
|
|
2744
2749
|
* This probe hits the provider's live API (mutates nothing here), so it takes a
|
|
2745
|
-
* per-call {@link CallOptions} for a timeout / cancellation
|
|
2750
|
+
* per-call {@link CallOptions} for a timeout / cancellation - `opts` is spread into
|
|
2746
2751
|
* the body, so `options` stays a separate trailing arg (never merged in).
|
|
2747
2752
|
*/
|
|
2748
2753
|
verify: (provider: string, opts?: {
|
|
@@ -2762,7 +2767,7 @@ declare class Billow {
|
|
|
2762
2767
|
}>;
|
|
2763
2768
|
};
|
|
2764
2769
|
};
|
|
2765
|
-
/** The merchant's business identity
|
|
2770
|
+
/** The merchant's business identity - the seller block on documents and email from-name. */
|
|
2766
2771
|
businessProfile: {
|
|
2767
2772
|
/** The stored profile, or null if one was never saved. */
|
|
2768
2773
|
get: (options?: CallOptions) => Promise<BusinessProfile | null>;
|
|
@@ -2771,11 +2776,11 @@ declare class Billow {
|
|
|
2771
2776
|
};
|
|
2772
2777
|
/**
|
|
2773
2778
|
* Hosted customer surfaces (Phase G, ADR-0014). Mint a portal session for one of
|
|
2774
|
-
* your signed-in users and redirect them to the returned `url`
|
|
2779
|
+
* your signed-in users and redirect them to the returned `url` - the self-serve
|
|
2775
2780
|
* portal, or a `checkout` hand-off for `productId`. The Customer's own calls go
|
|
2776
2781
|
* through {@link BillowPortal}, constructed with the session token.
|
|
2777
2782
|
*/
|
|
2778
|
-
/** Identity of this key's tenant
|
|
2783
|
+
/** Identity of this key's tenant - org, environment, configured currencies. */
|
|
2779
2784
|
me(options?: CallOptions): Promise<Whoami>;
|
|
2780
2785
|
/**
|
|
2781
2786
|
* Global search (PRD-12) across customers, invoices, subscriptions, and charges
|
|
@@ -2785,7 +2790,7 @@ declare class Billow {
|
|
|
2785
2790
|
search(q: string, limit?: number, options?: CallOptions): Promise<SearchResults>;
|
|
2786
2791
|
/**
|
|
2787
2792
|
* Gate access to a feature. `featureId` is the feature slug. Returns
|
|
2788
|
-
* `{ allowed, balance }`
|
|
2793
|
+
* `{ allowed, balance }` - `balance` is `null` for unlimited/boolean features.
|
|
2789
2794
|
*/
|
|
2790
2795
|
check(input: {
|
|
2791
2796
|
customerId: string;
|
|
@@ -2793,14 +2798,14 @@ declare class Billow {
|
|
|
2793
2798
|
}, options?: CallOptions): Promise<CheckResult>;
|
|
2794
2799
|
/**
|
|
2795
2800
|
* Record usage of a metered feature (`value` defaults to 1; negative credits
|
|
2796
|
-
* back). Pass `idempotencyKey` to make a retried call a no-op
|
|
2801
|
+
* back). Pass `idempotencyKey` to make a retried call a no-op - which also makes the call
|
|
2797
2802
|
* safe to retry automatically when `maxRetries` is set.
|
|
2798
2803
|
*/
|
|
2799
2804
|
track(input: {
|
|
2800
2805
|
customerId: string;
|
|
2801
2806
|
featureId: string;
|
|
2802
2807
|
value?: number;
|
|
2803
|
-
/** Arbitrary event properties
|
|
2808
|
+
/** Arbitrary event properties - used by meter filters and property-based aggregations. */
|
|
2804
2809
|
properties?: Record<string, string | number>;
|
|
2805
2810
|
idempotencyKey?: string;
|
|
2806
2811
|
/**
|
|
@@ -2820,7 +2825,7 @@ declare class Billow {
|
|
|
2820
2825
|
/**
|
|
2821
2826
|
* The browser-safe client: construct it with a **publishable** key (`bl_<env>_pk_…`)
|
|
2822
2827
|
* to read the public catalog from any origin (CORS-enabled). It exposes ONLY public,
|
|
2823
|
-
* project-scoped reads
|
|
2828
|
+
* project-scoped reads - products and their prices - so it is safe to ship in a
|
|
2824
2829
|
* frontend bundle. Customer-scoped data (entitlements, checkout) is never reachable
|
|
2825
2830
|
* with a publishable key; use the server handler or a portal session for that.
|
|
2826
2831
|
*/
|
|
@@ -2828,7 +2833,7 @@ declare class BillowPublishable {
|
|
|
2828
2833
|
#private;
|
|
2829
2834
|
constructor(publishableKey: string, opts?: BillowOptions);
|
|
2830
2835
|
products: {
|
|
2831
|
-
/** The active catalog
|
|
2836
|
+
/** The active catalog - products and their prices, for a pricing table. */
|
|
2832
2837
|
list: (options?: CallOptions) => Promise<{
|
|
2833
2838
|
id: string;
|
|
2834
2839
|
slug: string;
|
|
@@ -2905,13 +2910,13 @@ declare class BillowPublishable {
|
|
|
2905
2910
|
/**
|
|
2906
2911
|
* The customer-surface client (Phase G, ADR-0014): construct it with a portal
|
|
2907
2912
|
* session token (minted by your backend via `billow.portalSessions.create`) to act
|
|
2908
|
-
* as that one Customer. It exposes only their own data
|
|
2909
|
-
* surface
|
|
2913
|
+
* as that one Customer. It exposes only their own data - no operator/secret-key
|
|
2914
|
+
* surface - so the token can be held by a hosted portal app safely.
|
|
2910
2915
|
*/
|
|
2911
2916
|
declare class BillowPortal {
|
|
2912
2917
|
#private;
|
|
2913
2918
|
constructor(sessionToken: string, opts?: BillowOptions);
|
|
2914
|
-
/** The portal shell: flow, return URL, merchant brand, and customer identity
|
|
2919
|
+
/** The portal shell: flow, return URL, merchant brand, and customer identity -
|
|
2915
2920
|
* the lightweight payload the hosting app frames every page with, and the
|
|
2916
2921
|
* validate-and-route check at login. */
|
|
2917
2922
|
session(options?: CallOptions): Promise<PortalSessionInfo>;
|