@usebillow/sdk 0.9.0 → 0.11.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 +17 -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-XUFQG6EA.js} +74 -22
- package/dist/chunk-XUFQG6EA.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-DSTQ1GZz.d.ts → hosted-domains-BrnwkHqq.d.ts} +40 -2
- package/dist/{hosted-domains-DwakPG4J.d.cts → hosted-domains-zWm2srOk.d.cts} +40 -2
- package/dist/index.cjs +72 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +70 -48
- package/dist/index.d.ts +70 -48
- 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
|
|
10
|
-
export {
|
|
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 CreditAccount, k as CreditPacks, l as CreateCreditPackInput, m as CreditPack, U as UpdateCreditPackInput, n as CreateCreditIncludedRuleInput, o as CreditIncludedRule, p as UpdateCreditIncludedRuleInput, q as CreditIncludedWindowListParams, r as CreateCreditTopUpInput, s as CreditTopUpRequestResult, t as CreditTopUpListParams, u as CreditBalance, v as CreditLedgerEntry, w as CreditUsageParams, x as CreditUsage } from './hosted-domains-zWm2srOk.cjs';
|
|
10
|
+
export { y as CreditAccountStatus, z as CreditAllocationInterval, C as CreditGrantKind, A as CreditMoney, B as CreditPackBreakdown, D as CreditPackListItem, E as CreditTopUpStatus, F as CreditTransactionType, G as CreditUsageGroupBy, I as CreditWindowState, H as HostedDomainActivatedData, d as HostedDomainDisabledData, b as HostedDomainDnsFailingData, J as HostedDomainEventBase, c as HostedDomainReassignmentPendingData, K as HostedDomainStatus, L as HostedDomainStatusReason, M as IncludedCredits, N as IncludedPeriod } from './hosted-domains-zWm2srOk.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;
|
|
@@ -1461,6 +1466,23 @@ declare function createCreditsResource(ctx: RequestContext): {
|
|
|
1461
1466
|
*/
|
|
1462
1467
|
create: (input: CreateCreditGrantInput, options: IdempotentRequestOptions) => Promise<CreditGrantRequestResult>;
|
|
1463
1468
|
};
|
|
1469
|
+
accounts: {
|
|
1470
|
+
/**
|
|
1471
|
+
* Freeze a customer's Credit Account (by external id): it takes no new reservations - a
|
|
1472
|
+
* reserve throws `account_frozen` (423) - until unfrozen, while holds already made still
|
|
1473
|
+
* commit and release, and grants, top-ups, reversals and included credits still fund it.
|
|
1474
|
+
* Safe to retry: freezing a frozen account changes nothing and answers `changed: false`. A
|
|
1475
|
+
* customer with no account yet gets one, frozen. Throws `account_closed` (409) for an erased
|
|
1476
|
+
* customer.
|
|
1477
|
+
*/
|
|
1478
|
+
freeze: (customer: string, options?: CallOptions) => Promise<CreditAccount>;
|
|
1479
|
+
/**
|
|
1480
|
+
* Unfreeze a customer's Credit Account (by external id): it takes reservations again. Safe to
|
|
1481
|
+
* retry: unfreezing an account that is not frozen changes nothing and answers
|
|
1482
|
+
* `changed: false`.
|
|
1483
|
+
*/
|
|
1484
|
+
unfreeze: (customer: string, options?: CallOptions) => Promise<CreditAccount>;
|
|
1485
|
+
};
|
|
1464
1486
|
packs: {
|
|
1465
1487
|
/**
|
|
1466
1488
|
* The Credit Packs a customer can buy in `currency` (ISO 4217), cheapest first: credits and
|
|
@@ -2005,7 +2027,7 @@ declare function createInvoicesResource(ctx: RequestContext): {
|
|
|
2005
2027
|
receipt: (id: string, options?: CallOptions) => Promise<ArrayBuffer>;
|
|
2006
2028
|
};
|
|
2007
2029
|
|
|
2008
|
-
/** The marketplace Integration catalog
|
|
2030
|
+
/** The marketplace Integration catalog - install / configure / toggle / uninstall (ADR-0008). */
|
|
2009
2031
|
declare function createMarketplaceResource(ctx: RequestContext): {
|
|
2010
2032
|
/** Every available Integration with this tenant's install state (no secret values). */
|
|
2011
2033
|
catalog: (options?: CallOptions) => Promise<CatalogItem[]>;
|
|
@@ -2210,7 +2232,7 @@ declare function createProductsResource(ctx: RequestContext): {
|
|
|
2210
2232
|
};
|
|
2211
2233
|
|
|
2212
2234
|
/**
|
|
2213
|
-
* Organization settings (Phase D3, F)
|
|
2235
|
+
* Organization settings (Phase D3, F) - the configurable dunning schedule, usage settlement grace,
|
|
2214
2236
|
* the cross-currency reporting currency + FX-rate registry (ADR-0013), and transactional email
|
|
2215
2237
|
* template overrides (PRD-10). All secret-key/server-side surface.
|
|
2216
2238
|
*/
|
|
@@ -2229,7 +2251,7 @@ declare function createSettingsResource(ctx: RequestContext): {
|
|
|
2229
2251
|
};
|
|
2230
2252
|
/**
|
|
2231
2253
|
* Usage settlement grace (hours): defers *collection* of a boundary-adjacent priced
|
|
2232
|
-
* calendar-meter renewal past the tz month boundary until late usage settles
|
|
2254
|
+
* calendar-meter renewal past the tz month boundary until late usage settles - the billed
|
|
2233
2255
|
* windows/amount are unchanged, only the invoice timing shifts. `0` disables it (the default);
|
|
2234
2256
|
* a no-op for any subscription without a priced calendar meter. Cap 72h.
|
|
2235
2257
|
*/
|
|
@@ -2421,7 +2443,7 @@ declare function createSubscriptionsResource(ctx: RequestContext): {
|
|
|
2421
2443
|
productSlug: string;
|
|
2422
2444
|
productMetadata: Record<string, string>;
|
|
2423
2445
|
} | null>;
|
|
2424
|
-
/** Cancel
|
|
2446
|
+
/** Cancel - immediately, or at period end with `{ atPeriodEnd: true }`. */
|
|
2425
2447
|
cancel: (id: string, opts?: {
|
|
2426
2448
|
atPeriodEnd?: boolean;
|
|
2427
2449
|
}) => Promise<{
|
|
@@ -2530,7 +2552,7 @@ declare function createSubscriptionsResource(ctx: RequestContext): {
|
|
|
2530
2552
|
couponId: string;
|
|
2531
2553
|
cyclesRemaining: number | null;
|
|
2532
2554
|
}>;
|
|
2533
|
-
/** Change plan
|
|
2555
|
+
/** Change plan - immediate prorated upgrade, or downgrade scheduled for period end. `productId` accepts the product's id or slug. */
|
|
2534
2556
|
changePlan: (id: string, productId: string) => Promise<{
|
|
2535
2557
|
id: string;
|
|
2536
2558
|
status: "active" | "incomplete" | "incomplete_expired" | "trialing" | "past_due" | "paused" | "canceled" | "unpaid";
|
|
@@ -2638,14 +2660,14 @@ declare function createWebhookEndpointsResource(ctx: RequestContext): {
|
|
|
2638
2660
|
update: (id: string, input: UpdateWebhookEndpointInput) => Promise<WebhookEndpoint>;
|
|
2639
2661
|
/** Delete an endpoint and its delivery history. */
|
|
2640
2662
|
delete: (id: string) => Promise<void>;
|
|
2641
|
-
/** Rotate the signing secret
|
|
2663
|
+
/** Rotate the signing secret - the new plaintext is returned once. */
|
|
2642
2664
|
rotateSecret: (id: string) => Promise<WebhookEndpointWithSecret>;
|
|
2643
2665
|
/** List delivery attempts for an endpoint (newest first). Auto-paginating. */
|
|
2644
2666
|
deliveries: (id: string, params?: ListParams, options?: CallOptions) => ListPromise<WebhookDelivery>;
|
|
2645
2667
|
};
|
|
2646
2668
|
|
|
2647
2669
|
/**
|
|
2648
|
-
* billow client SDK
|
|
2670
|
+
* billow client SDK - the "two lines of code" surface, mirroring Autumn's shape
|
|
2649
2671
|
* (CONTEXT/ARCHITECTURE §10). A thin typed wrapper over the billow REST API.
|
|
2650
2672
|
*
|
|
2651
2673
|
* const billow = new Billow(process.env.BILLOW_SECRET_KEY!);
|
|
@@ -2684,7 +2706,7 @@ declare class Billow {
|
|
|
2684
2706
|
/** Custom domains for the hosted customer portal (live keys, behind a rollout flag). */
|
|
2685
2707
|
hostedDomains: ReturnType<typeof createHostedDomainsResource>;
|
|
2686
2708
|
/**
|
|
2687
|
-
* Organization settings (Phase D3, F)
|
|
2709
|
+
* Organization settings (Phase D3, F) - the configurable dunning schedule, usage settlement grace,
|
|
2688
2710
|
* and the cross-currency reporting currency + FX-rate registry (ADR-0013).
|
|
2689
2711
|
*/
|
|
2690
2712
|
settings: ReturnType<typeof createSettingsResource>;
|
|
@@ -2692,12 +2714,12 @@ declare class Billow {
|
|
|
2692
2714
|
coupons: {
|
|
2693
2715
|
/** Define a coupon (a reusable discount template). */
|
|
2694
2716
|
create: (input: CreateCouponInput) => Promise<Coupon>;
|
|
2695
|
-
/** List coupons (secret key only
|
|
2717
|
+
/** List coupons (secret key only - enumerates live promo codes). Auto-paginating. */
|
|
2696
2718
|
list: (params?: ListParams, options?: CallOptions) => ListPromise<Coupon>;
|
|
2697
2719
|
/** Deactivate a coupon (existing discounts keep running). */
|
|
2698
2720
|
deactivate: (id: string) => Promise<Coupon>;
|
|
2699
2721
|
};
|
|
2700
|
-
/** Manage developer webhook endpoints
|
|
2722
|
+
/** Manage developer webhook endpoints - register, rotate secrets, inspect deliveries.
|
|
2701
2723
|
* (To VERIFY incoming deliveries, import `constructEvent` from `@usebillow/sdk/webhooks`.) */
|
|
2702
2724
|
features: {
|
|
2703
2725
|
/** Define a feature (a boolean access gate, or a metered feature with a meter). */
|
|
@@ -2708,7 +2730,7 @@ declare class Billow {
|
|
|
2708
2730
|
meter?: MeterConfig;
|
|
2709
2731
|
}) => Promise<Feature>;
|
|
2710
2732
|
/**
|
|
2711
|
-
* Edit a feature in place: its `name`, and
|
|
2733
|
+
* Edit a feature in place: its `name`, and - for a metered feature - its `meter`
|
|
2712
2734
|
* aggregation. The server refuses a meter change once usage has been recorded (it
|
|
2713
2735
|
* would rewrite billed history), so set the meter right at create time or before you
|
|
2714
2736
|
* start tracking. Returns the updated feature.
|
|
@@ -2742,7 +2764,7 @@ declare class Billow {
|
|
|
2742
2764
|
* choose a credential set and `target` to probe one verify target (Paymob: a
|
|
2743
2765
|
* method); pass `sampleToken` (SANDBOX ONLY) to run a functional sub-test.
|
|
2744
2766
|
* This probe hits the provider's live API (mutates nothing here), so it takes a
|
|
2745
|
-
* per-call {@link CallOptions} for a timeout / cancellation
|
|
2767
|
+
* per-call {@link CallOptions} for a timeout / cancellation - `opts` is spread into
|
|
2746
2768
|
* the body, so `options` stays a separate trailing arg (never merged in).
|
|
2747
2769
|
*/
|
|
2748
2770
|
verify: (provider: string, opts?: {
|
|
@@ -2762,7 +2784,7 @@ declare class Billow {
|
|
|
2762
2784
|
}>;
|
|
2763
2785
|
};
|
|
2764
2786
|
};
|
|
2765
|
-
/** The merchant's business identity
|
|
2787
|
+
/** The merchant's business identity - the seller block on documents and email from-name. */
|
|
2766
2788
|
businessProfile: {
|
|
2767
2789
|
/** The stored profile, or null if one was never saved. */
|
|
2768
2790
|
get: (options?: CallOptions) => Promise<BusinessProfile | null>;
|
|
@@ -2771,11 +2793,11 @@ declare class Billow {
|
|
|
2771
2793
|
};
|
|
2772
2794
|
/**
|
|
2773
2795
|
* 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`
|
|
2796
|
+
* your signed-in users and redirect them to the returned `url` - the self-serve
|
|
2775
2797
|
* portal, or a `checkout` hand-off for `productId`. The Customer's own calls go
|
|
2776
2798
|
* through {@link BillowPortal}, constructed with the session token.
|
|
2777
2799
|
*/
|
|
2778
|
-
/** Identity of this key's tenant
|
|
2800
|
+
/** Identity of this key's tenant - org, environment, configured currencies. */
|
|
2779
2801
|
me(options?: CallOptions): Promise<Whoami>;
|
|
2780
2802
|
/**
|
|
2781
2803
|
* Global search (PRD-12) across customers, invoices, subscriptions, and charges
|
|
@@ -2785,7 +2807,7 @@ declare class Billow {
|
|
|
2785
2807
|
search(q: string, limit?: number, options?: CallOptions): Promise<SearchResults>;
|
|
2786
2808
|
/**
|
|
2787
2809
|
* Gate access to a feature. `featureId` is the feature slug. Returns
|
|
2788
|
-
* `{ allowed, balance }`
|
|
2810
|
+
* `{ allowed, balance }` - `balance` is `null` for unlimited/boolean features.
|
|
2789
2811
|
*/
|
|
2790
2812
|
check(input: {
|
|
2791
2813
|
customerId: string;
|
|
@@ -2793,14 +2815,14 @@ declare class Billow {
|
|
|
2793
2815
|
}, options?: CallOptions): Promise<CheckResult>;
|
|
2794
2816
|
/**
|
|
2795
2817
|
* Record usage of a metered feature (`value` defaults to 1; negative credits
|
|
2796
|
-
* back). Pass `idempotencyKey` to make a retried call a no-op
|
|
2818
|
+
* back). Pass `idempotencyKey` to make a retried call a no-op - which also makes the call
|
|
2797
2819
|
* safe to retry automatically when `maxRetries` is set.
|
|
2798
2820
|
*/
|
|
2799
2821
|
track(input: {
|
|
2800
2822
|
customerId: string;
|
|
2801
2823
|
featureId: string;
|
|
2802
2824
|
value?: number;
|
|
2803
|
-
/** Arbitrary event properties
|
|
2825
|
+
/** Arbitrary event properties - used by meter filters and property-based aggregations. */
|
|
2804
2826
|
properties?: Record<string, string | number>;
|
|
2805
2827
|
idempotencyKey?: string;
|
|
2806
2828
|
/**
|
|
@@ -2820,7 +2842,7 @@ declare class Billow {
|
|
|
2820
2842
|
/**
|
|
2821
2843
|
* The browser-safe client: construct it with a **publishable** key (`bl_<env>_pk_…`)
|
|
2822
2844
|
* to read the public catalog from any origin (CORS-enabled). It exposes ONLY public,
|
|
2823
|
-
* project-scoped reads
|
|
2845
|
+
* project-scoped reads - products and their prices - so it is safe to ship in a
|
|
2824
2846
|
* frontend bundle. Customer-scoped data (entitlements, checkout) is never reachable
|
|
2825
2847
|
* with a publishable key; use the server handler or a portal session for that.
|
|
2826
2848
|
*/
|
|
@@ -2828,7 +2850,7 @@ declare class BillowPublishable {
|
|
|
2828
2850
|
#private;
|
|
2829
2851
|
constructor(publishableKey: string, opts?: BillowOptions);
|
|
2830
2852
|
products: {
|
|
2831
|
-
/** The active catalog
|
|
2853
|
+
/** The active catalog - products and their prices, for a pricing table. */
|
|
2832
2854
|
list: (options?: CallOptions) => Promise<{
|
|
2833
2855
|
id: string;
|
|
2834
2856
|
slug: string;
|
|
@@ -2905,13 +2927,13 @@ declare class BillowPublishable {
|
|
|
2905
2927
|
/**
|
|
2906
2928
|
* The customer-surface client (Phase G, ADR-0014): construct it with a portal
|
|
2907
2929
|
* 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
|
|
2930
|
+
* as that one Customer. It exposes only their own data - no operator/secret-key
|
|
2931
|
+
* surface - so the token can be held by a hosted portal app safely.
|
|
2910
2932
|
*/
|
|
2911
2933
|
declare class BillowPortal {
|
|
2912
2934
|
#private;
|
|
2913
2935
|
constructor(sessionToken: string, opts?: BillowOptions);
|
|
2914
|
-
/** The portal shell: flow, return URL, merchant brand, and customer identity
|
|
2936
|
+
/** The portal shell: flow, return URL, merchant brand, and customer identity -
|
|
2915
2937
|
* the lightweight payload the hosting app frames every page with, and the
|
|
2916
2938
|
* validate-and-route check at login. */
|
|
2917
2939
|
session(options?: CallOptions): Promise<PortalSessionInfo>;
|
|
@@ -3002,4 +3024,4 @@ declare class BillowPortal {
|
|
|
3002
3024
|
};
|
|
3003
3025
|
}
|
|
3004
3026
|
|
|
3005
|
-
export { AttachResult, BILLOW_ERROR_CODES, Billow, BillowApiError, type BillowErrorCode, BillowOptions, BillowPortal, BillowPublishable, type BusinessProfile, CallOptions, type CatalogItem, Charge, type ChargeListItem, type ChargeListParams, type ChargeSearchHit, ChargeStatus, CheckResult, type CheckoutMethodInfo, type ConfigField, type ConfigFieldOption, type ConfigFieldType, Coupon, CreateChargeInput, CreateCouponInput, CreateCreditGrantInput, CreateCreditIncludedRuleInput, CreateCreditPackInput, type CreateCreditQuoteInput, type CreateCreditReservationInput, CreateCreditTopUpInput, CreateHostedDomainInput, CreateMerchantInitiatedChargeInput, type CreatePortalSessionInput, CreateProductInput, CreateSubscriptionInput, CreateUsageAlertInput, type CreateWebhookEndpointInput, type CredentialSet, CreditBalance, type CreditDimensions, CreditGrant, CreditGrantRequestResult, CreditIncludedRule, CreditIncludedWindow, CreditIncludedWindowListParams, CreditLedgerEntry, type CreditLineItem, CreditPack, CreditPacks, type CreditPricedLine, type CreditQuote, type CreditRateCard, type CreditRateCardItem, type CreditReservation, type CreditReservationListParams, type CreditReservationPage, type CreditReservationRequestResult, type CreditReservationStatus, type CreditReversal, type CreditReversalRequestResult, CreditThresholdLevel, CreditTopUp, CreditTopUpListParams, CreditTopUpRequestResult, CreditUsage, CreditUsageParams, type CursorListParams, type CursorListPromise, type CursorPaginated, Customer, type CustomerAnonymizationResult, type CustomerCreditsExport, type CustomerDataExport, type CustomerListItem, type CustomerListParams, type CustomerOverview, type CustomerSearchHit, type CustomerUsage, type CustomerUsageDetail, type EmailDeliveryListItem, type EmailDeliveryListParams, type EmailDeliveryStatus, type EmailTemplateSetting, EntitlementView, type ExchangeRate, type ExportJsonValue, type ExternalPaymentMethod, type ExternalPaymentResult, Feature, FeatureKind, IdempotentRequestOptions, type InboundWebhookListItem, type InboundWebhookListParams, type InboundWebhookOutcome, type IntegrationDefinition, type IntegrationKind, type IntegrationTier, type Invoice, type InvoiceDetail, type InvoiceLineItem, type InvoiceListItem, type InvoiceListParams, type InvoiceSearchHit, InvoiceStatus, type ListParams, type ListPromise, MeterConfig, type MetricsOverview, type MetricsParams, type MetricsRollup, MigrationResult, type OutboxEventListItem, type OutboxEventListParams, type OutboxEventStatus, type Paginated, PayInvoiceInput, type PaymentMethod, PaymentMethodStatus, type PaymentProviderDefinition, type PortalCardSetupResult, type PortalCheckout, type PortalPlanChange, type PortalSession, type PortalSessionExchange, type PortalSessionExchangeInput, type PortalSessionFlow, type PortalSessionInfo, type PortalSubscriptionStatus, type PortalView, type ProviderCredentialSummary, type ProviderVerifyResult, type ProviderVerifyTarget, type ProviderVerifyTargetResult, type PublishCreditRateCardInput, type RecordExternalPaymentInput, type Refund, type RefundChargeInput, type RefundRequestResult, type RefundReviewReason, RefundStatus, RequestOptions, type ResolveRefundInput, type ReverseCreditConsumptionInput, SavedPaymentMethod, type ScheduledSubscriptionChange, type SearchResults, type SubscriptionListItem, type SubscriptionListParams, type SubscriptionSearchHit, SubscriptionStatus, TaxBehavior, type TimeseriesInterval, type TimeseriesMetric, type TimeseriesParams, type TimeseriesPoint, type TimeseriesResult, TrackResult, UnappliedPaymentReason, type UpdateBusinessProfileInput, UpdateCreditIncludedRuleInput, UpdateCreditPackInput, type UpdateEmailTemplateInput, UpdateFeatureInput, UpdateProductInput, type UpdateWebhookEndpointInput, type UpsertCredentialsInput, UsageAlert, type WebhookDelivery, WebhookDeliveryStatus, type WebhookEndpoint, type WebhookEndpointWithSecret, type Whoami, currencyExponent, formatMoney, isSecretField, toMajorUnits, toMinorUnits };
|
|
3027
|
+
export { AttachResult, BILLOW_ERROR_CODES, Billow, BillowApiError, type BillowErrorCode, BillowOptions, BillowPortal, BillowPublishable, type BusinessProfile, CallOptions, type CatalogItem, Charge, type ChargeListItem, type ChargeListParams, type ChargeSearchHit, ChargeStatus, CheckResult, type CheckoutMethodInfo, type ConfigField, type ConfigFieldOption, type ConfigFieldType, Coupon, CreateChargeInput, CreateCouponInput, CreateCreditGrantInput, CreateCreditIncludedRuleInput, CreateCreditPackInput, type CreateCreditQuoteInput, type CreateCreditReservationInput, CreateCreditTopUpInput, CreateHostedDomainInput, CreateMerchantInitiatedChargeInput, type CreatePortalSessionInput, CreateProductInput, CreateSubscriptionInput, CreateUsageAlertInput, type CreateWebhookEndpointInput, type CredentialSet, CreditAccount, CreditBalance, type CreditDimensions, CreditGrant, CreditGrantRequestResult, CreditIncludedRule, CreditIncludedWindow, CreditIncludedWindowListParams, CreditLedgerEntry, type CreditLineItem, CreditPack, CreditPacks, type CreditPricedLine, type CreditQuote, type CreditRateCard, type CreditRateCardItem, type CreditReservation, type CreditReservationListParams, type CreditReservationPage, type CreditReservationRequestResult, type CreditReservationStatus, type CreditReversal, type CreditReversalRequestResult, CreditThresholdLevel, CreditTopUp, CreditTopUpListParams, CreditTopUpRequestResult, CreditUsage, CreditUsageParams, type CursorListParams, type CursorListPromise, type CursorPaginated, Customer, type CustomerAnonymizationResult, type CustomerCreditsExport, type CustomerDataExport, type CustomerListItem, type CustomerListParams, type CustomerOverview, type CustomerSearchHit, type CustomerUsage, type CustomerUsageDetail, type EmailDeliveryListItem, type EmailDeliveryListParams, type EmailDeliveryStatus, type EmailTemplateSetting, EntitlementView, type ExchangeRate, type ExportJsonValue, type ExternalPaymentMethod, type ExternalPaymentResult, Feature, FeatureKind, IdempotentRequestOptions, type InboundWebhookListItem, type InboundWebhookListParams, type InboundWebhookOutcome, type IntegrationDefinition, type IntegrationKind, type IntegrationTier, type Invoice, type InvoiceDetail, type InvoiceLineItem, type InvoiceListItem, type InvoiceListParams, type InvoiceSearchHit, InvoiceStatus, type ListParams, type ListPromise, MeterConfig, type MetricsOverview, type MetricsParams, type MetricsRollup, MigrationResult, type OutboxEventListItem, type OutboxEventListParams, type OutboxEventStatus, type Paginated, PayInvoiceInput, type PaymentMethod, PaymentMethodStatus, type PaymentProviderDefinition, type PortalCardSetupResult, type PortalCheckout, type PortalPlanChange, type PortalSession, type PortalSessionExchange, type PortalSessionExchangeInput, type PortalSessionFlow, type PortalSessionInfo, type PortalSubscriptionStatus, type PortalView, type ProviderCredentialSummary, type ProviderVerifyResult, type ProviderVerifyTarget, type ProviderVerifyTargetResult, type PublishCreditRateCardInput, type RecordExternalPaymentInput, type Refund, type RefundChargeInput, type RefundRequestResult, type RefundReviewReason, RefundStatus, RequestOptions, type ResolveRefundInput, type ReverseCreditConsumptionInput, SavedPaymentMethod, type ScheduledSubscriptionChange, type SearchResults, type SubscriptionListItem, type SubscriptionListParams, type SubscriptionSearchHit, SubscriptionStatus, TaxBehavior, type TimeseriesInterval, type TimeseriesMetric, type TimeseriesParams, type TimeseriesPoint, type TimeseriesResult, TrackResult, UnappliedPaymentReason, type UpdateBusinessProfileInput, UpdateCreditIncludedRuleInput, UpdateCreditPackInput, type UpdateEmailTemplateInput, UpdateFeatureInput, UpdateProductInput, type UpdateWebhookEndpointInput, type UpsertCredentialsInput, UsageAlert, type WebhookDelivery, WebhookDeliveryStatus, type WebhookEndpoint, type WebhookEndpointWithSecret, type Whoami, currencyExponent, formatMoney, isSecretField, toMajorUnits, toMinorUnits };
|