@billkit-eu/sdk 0.6.0 → 0.7.1

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/dist/index.d.ts CHANGED
@@ -95,9 +95,15 @@ type QueryValue = string | number | boolean | null | undefined;
95
95
  interface RequestOptions {
96
96
  method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
97
97
  path: string;
98
- query?: {
99
- readonly [key: string]: QueryValue;
100
- };
98
+ /**
99
+ * Query parameters, as a plain object. Typed this way rather than with
100
+ * an index signature because TypeScript only gives an implicit index
101
+ * signature to type aliases, so a closed `*ListParams` interface would
102
+ * need a cast at every call site. {@link buildUrl} does the pruning:
103
+ * `undefined` and `null` are dropped, an array is joined with commas
104
+ * (the API's `expand=a,b` shape), everything else is stringified.
105
+ */
106
+ query?: object;
101
107
  body?: Record<string, unknown> | undefined;
102
108
  idempotencyKey?: string | undefined;
103
109
  extraHeaders?: Record<string, string>;
@@ -217,15 +223,23 @@ declare function paginate<T>(listFn: ListFn<T>, options?: PaginateOptions): Asyn
217
223
  /**
218
224
  * Cursor-pagination knobs shared by every `list()` method.
219
225
  *
220
- * The index signature is what lets a resource-specific extension
221
- * (e.g. `EventsListParams` adds `type?: string`) flow through the
222
- * Transport's `query` shape without a cast. Excess fields are
223
- * tolerated; `undefined` values are pruned before serialisation.
226
+ * Closed on purpose: there is no index signature, so a misspelled filter
227
+ * (`provisonal`) is a compile error instead of a query parameter the
228
+ * server ignores. The Transport takes `query` as a plain `object` and
229
+ * prunes/stringifies it, which is what lets these interfaces through
230
+ * without a cast.
224
231
  */
225
232
  interface BaseListParams {
226
233
  limit?: number;
227
234
  starting_after?: string;
228
- readonly [key: string]: QueryValue;
235
+ }
236
+ /**
237
+ * `?expand=` on a single-object GET. The relations a route accepts differ
238
+ * per resource and are listed on each `retrieve()`; an unknown one is a
239
+ * `400` naming the ones that work.
240
+ */
241
+ interface ExpandOptions {
242
+ expand?: string[];
229
243
  }
230
244
  /**
231
245
  * `prices.list` params. Adds the server-side `product_id` filter on top of
@@ -236,6 +250,40 @@ interface BaseListParams {
236
250
  interface PricesListParams extends BaseListParams {
237
251
  product_id?: string;
238
252
  }
253
+ /**
254
+ * `payments.list` params. `customer_id` narrows to one customer's
255
+ * charges. Mandate verifications are never listed, so every row is a
256
+ * real purchase attempt; check `status` before treating one as revenue.
257
+ */
258
+ interface PaymentsListParams extends BaseListParams {
259
+ customer_id?: string;
260
+ /** Expandable here: `customer`, `subscription`. */
261
+ expand?: string[];
262
+ }
263
+ /**
264
+ * `invoices.list` params. The three id filters each narrow to one row's
265
+ * worth of invoices: `payment_id` answers "which invoice did this charge
266
+ * produce".
267
+ */
268
+ interface InvoicesListParams extends BaseListParams {
269
+ customer_id?: string;
270
+ subscription_id?: string;
271
+ payment_id?: string;
272
+ /** One of `draft`, `open`, `paid`, `void`, `uncollectible`. */
273
+ status?: string;
274
+ /** Expandable here: `customer`. */
275
+ expand?: string[];
276
+ }
277
+ /**
278
+ * `disputes.list` params. `status` takes a comma-separated list of `open`
279
+ * / `won`. There is no `lost`, because the provider gives no signal for
280
+ * one. `payment_id` matches subscription payments only, not one-off
281
+ * charges.
282
+ */
283
+ interface DisputesListParams extends BaseListParams {
284
+ status?: string;
285
+ payment_id?: string;
286
+ }
239
287
  /**
240
288
  * `subscriptions.list` params. Both filters take a comma-separated
241
289
  * list (`"active,past_due"`); an unrecognised value is rejected with
@@ -255,6 +303,8 @@ interface SubscriptionsListParams extends BaseListParams {
255
303
  status?: string;
256
304
  /** `auto_renew` | `paused` | `canceling` | `stopped`, CSV. */
257
305
  renewal_state?: string;
306
+ /** Expandable here: `customer`, `price`, `refund_eligibility`. */
307
+ expand?: string[];
258
308
  }
259
309
  /** Optional idempotency knob carried by every mutating call. */
260
310
  interface IdempotencyOptions {
@@ -264,9 +314,12 @@ interface IdempotencyOptions {
264
314
  * process to converge on the same server-side result. */
265
315
  idempotencyKey?: string;
266
316
  }
267
- type ListParams = BaseListParams & {
268
- readonly [key: string]: QueryValue;
269
- };
317
+ /**
318
+ * @deprecated Alias of {@link BaseListParams}, kept for callers that
319
+ * imported the older name. Reach for the resource-specific `*ListParams`
320
+ * (e.g. `EventsListParams`) instead.
321
+ */
322
+ type ListParams = BaseListParams;
270
323
  interface CreateCustomerParams extends IdempotencyOptions {
271
324
  email?: string;
272
325
  name?: string;
@@ -286,14 +339,25 @@ interface CustomerListParams extends BaseListParams {
286
339
  * omitted for both.
287
340
  */
288
341
  provisional?: boolean;
342
+ /** Expandable here: `stats`. Sent as `expand=a,b`. */
343
+ expand?: string[];
344
+ }
345
+ /** Query parameters accepted by `GET /v1/products`. */
346
+ interface ProductsListParams extends BaseListParams {
347
+ /** Expandable here: `prices`, `stats`, `default_price`. */
348
+ expand?: string[];
289
349
  }
290
350
  /**
291
351
  * Body for `POST /v1/customers/{id}/vat_number`. The VAT number is
292
352
  * sent through VIES server-side; the response carries
293
353
  * `vat_number_validated` reflecting the outcome.
354
+ *
355
+ * `vat_number: null` **clears** the registration, and is sent as an
356
+ * explicit null rather than pruned: only `undefined` is dropped.
294
357
  */
295
358
  interface SetCustomerVatNumberParams extends IdempotencyOptions {
296
- vat_number: string;
359
+ vat_number: string | null;
360
+ /** VIES needs a country; send it when the customer has none yet. */
297
361
  country_code?: string;
298
362
  }
299
363
  /**
@@ -334,15 +398,44 @@ interface UpdateProductParams extends IdempotencyOptions {
334
398
  active?: boolean;
335
399
  /** See {@link CreateProductParams.allow_promotion_codes}. */
336
400
  allow_promotion_codes?: boolean;
401
+ /**
402
+ * The price the billing portal offers on that price's interval. Must be
403
+ * an active price of this product; anything else is a 400 on
404
+ * `default_price_id`. An explicit `null` **clears** the default and is
405
+ * sent as a JSON null rather than pruned (only `undefined` is dropped);
406
+ * omit the field to leave the default alone.
407
+ */
408
+ default_price_id?: string | null;
337
409
  }
338
410
  /**
339
- * Body for `POST /v1/prices/{id}`. `active` is the only field a price
340
- * accepts, and it moves both ways: `false` withdraws the price from sale,
341
- * `true` puts it back. The amount, currency and interval are fixed at
342
- * creation, so neither direction changes what anyone was charged.
411
+ * Body for `POST /v1/prices/{id}`. Every field is optional; omitted ones
412
+ * are left alone.
413
+ *
414
+ * The dividing line is what a field decides. `amount_cents`, `currency`,
415
+ * `interval` and `usage_type` decide **what a past charge was**, so they
416
+ * are fixed at creation and absent here, because subscriptions renew
417
+ * against a price by id and editing one would re-price live customers.
418
+ * Everything
419
+ * below decides **what happens next**, which is why it is editable:
420
+ * setting `refund_on_cancel` covers the customers already on the price.
421
+ *
422
+ * `tax_behavior` is the exception and moves one way. It can be set while
423
+ * the price is still `"unspecified"` and never changed again, because
424
+ * flipping it would restate whether tax was inside or on top of an amount
425
+ * somebody has already paid.
343
426
  */
344
427
  interface UpdatePriceParams extends IdempotencyOptions {
345
- active: boolean;
428
+ /** `false` withdraws the price from sale, `true` puts it back. */
429
+ active?: boolean;
430
+ metadata?: Record<string, string>;
431
+ /** Settable once, while the price is still `"unspecified"`. */
432
+ tax_behavior?: "inclusive" | "exclusive";
433
+ /** Read when a checkout opens. At least one entry. */
434
+ payment_methods?: Array<"creditcard" | "directdebit" | "ideal" | "eps" | "applepay" | "paypal" | (string & {})>;
435
+ refund_on_cancel?: "none" | "full" | "prorated";
436
+ /** `0` disables refunds for that charge type; `N > 0` is an N-day window. */
437
+ refund_window_initial_days?: number;
438
+ refund_window_renewal_days?: number;
346
439
  }
347
440
  /**
348
441
  * One band of a tiered price.
@@ -527,6 +620,14 @@ interface CreateCheckoutSessionParams extends IdempotencyOptions {
527
620
  price_id: string;
528
621
  success_url: string;
529
622
  cancel_url: string;
623
+ /**
624
+ * The buyer's ISO-3166-1 alpha-2 country, when you already know it.
625
+ * Stored on the customer if they do not have one yet, which is what
626
+ * lets VAT apply to the very first charge. On the hosted flow the buyer
627
+ * only reaches a country-collecting page after the charge exists.
628
+ * Never overwrites a country the customer already has.
629
+ */
630
+ country?: string;
530
631
  /**
531
632
  * Pin the Mollie payment method. `undefined` lets Mollie pick from
532
633
  * the customer's available methods; when set, must be in the price's
@@ -649,6 +750,8 @@ interface UpdateWebhookEndpointParams extends IdempotencyOptions {
649
750
  interface EventsListParams extends BaseListParams {
650
751
  /** Server-side filter, e.g. `customer.created`. */
651
752
  type?: string;
753
+ /** Expandable here: `customer`. `events.retrieve` accepts none. */
754
+ expand?: string[];
652
755
  }
653
756
  interface SetPortalBrandingParams extends IdempotencyOptions {
654
757
  business_name?: string;
@@ -667,7 +770,12 @@ interface RotateProviderCredentialParams extends IdempotencyOptions {
667
770
  }
668
771
  interface CreateCouponParams extends IdempotencyOptions {
669
772
  code: string;
670
- discount_type: "percentage" | "amount" | (string & {});
773
+ /**
774
+ * `"percent"` reads `discount_value` as whole percent; `"fixed_cents"`
775
+ * reads it as minor units off the charge. Those are the only two the
776
+ * API accepts (`schemas/coupon.py`); anything else is a `422`.
777
+ */
778
+ discount_type: "percent" | "fixed_cents" | (string & {});
671
779
  discount_value: number;
672
780
  duration: "once" | "repeating" | "forever" | (string & {});
673
781
  duration_in_months?: number;
@@ -735,6 +843,45 @@ interface CreditNotesListParams extends BaseListParams {
735
843
  invoice_id?: string;
736
844
  customer_id?: string;
737
845
  }
846
+ /**
847
+ * Body for `POST /v1/tenant/billing_profile`: the seller identity that
848
+ * VAT is decided against and that an invoice prints.
849
+ *
850
+ * `country_code` is required on every call: there is nothing to leave
851
+ * alone about a jurisdiction. The address fields and
852
+ * `registration_number` are partial-update: omit one to leave the stored
853
+ * value alone, or pass an explicit `null` to clear it, because moving
854
+ * office is a real event.
855
+ *
856
+ * `vat_id` can be set once. After that, a different value or `null` is
857
+ * refused with a 400 (`param: "vat_id"`, reason `vat_id_locked`) and the
858
+ * call writes nothing; re-sending the stored number is accepted. BillKit
859
+ * invoices you reverse-charged against it, so support changes it.
860
+ */
861
+ interface SetTenantBillingProfileParams extends IdempotencyOptions {
862
+ /** ISO-3166-1 alpha-2, e.g. `"NL"`. */
863
+ country_code: string;
864
+ /** Your own EU VAT registration. Set once; support changes or clears it. */
865
+ vat_id?: string | null;
866
+ address_line1?: string | null;
867
+ address_line2?: string | null;
868
+ postal_code?: string | null;
869
+ city?: string | null;
870
+ registration_number?: string | null;
871
+ }
872
+ /**
873
+ * Body for `POST /v1/api_keys`. The full key is returned **once**, on the
874
+ * create response, and is never retrievable again.
875
+ */
876
+ interface CreateApiKeyParams extends IdempotencyOptions {
877
+ /** Human label, so a key can be identified before it is revoked. */
878
+ label?: string;
879
+ /**
880
+ * Narrow what the key may do. Omit to inherit the calling key's own
881
+ * scopes; a key can never grant more than it holds.
882
+ */
883
+ scopes?: string[];
884
+ }
738
885
  /** `invoices.void` params. `reason` is recorded on the audit row only. */
739
886
  interface VoidInvoiceParams extends IdempotencyOptions {
740
887
  reason?: string;
@@ -742,6 +889,12 @@ interface VoidInvoiceParams extends IdempotencyOptions {
742
889
  interface CreateBillingPortalSessionParams extends IdempotencyOptions {
743
890
  subscription_id: string;
744
891
  return_url: string;
892
+ /**
893
+ * Also email the portal link to the subscription's customer, at the
894
+ * address on their record, as a tenant-branded message. Defaults to
895
+ * `false`: without it you distribute the returned `url` yourself.
896
+ */
897
+ deliver_email?: boolean;
745
898
  }
746
899
  /**
747
900
  * Shared transport wrapper. Resources subclass this so each method
@@ -752,7 +905,13 @@ interface CreateBillingPortalSessionParams extends IdempotencyOptions {
752
905
  declare abstract class BaseResource {
753
906
  protected readonly t: Transport;
754
907
  constructor(t: Transport);
755
- protected get<T>(path: string, query?: BaseListParams & Record<string, QueryValue>): Promise<T>;
908
+ /**
909
+ * `query` is a plain object rather than an index-signature type: TypeScript
910
+ * only gives an implicit index signature to type *aliases*, so a closed
911
+ * `*ListParams` interface would otherwise need a cast at every call site.
912
+ * The transport prunes `undefined`/`null` and joins arrays with commas.
913
+ */
914
+ protected get<T>(path: string, query?: object): Promise<T>;
756
915
  protected post<T, P extends IdempotencyOptions>(path: string, params: P): Promise<T>;
757
916
  /** POST with no body, used by lifecycle verbs (cancel, resume, revoke ...). */
758
917
  protected postEmpty<T>(path: string, params?: IdempotencyOptions): Promise<T>;
@@ -812,7 +971,11 @@ declare class Customers extends BaseResource {
812
971
  declare class Products extends BaseResource {
813
972
  /** Create a catalog Product, then attach one or more Prices to it. */
814
973
  create<T = unknown>(params: CreateProductParams): Promise<T>;
815
- retrieve<T = unknown>(id: string): Promise<T>;
974
+ /**
975
+ * Expandable: `prices` (every price on the product), `stats`, and
976
+ * `default_price` (the price `default_price_id` names).
977
+ */
978
+ retrieve<T = unknown>(id: string, options?: ExpandOptions): Promise<T>;
816
979
  /**
817
980
  * Patch mutable Product fields, or archive it with `active: false`.
818
981
  *
@@ -823,7 +986,7 @@ declare class Products extends BaseResource {
823
986
  * `active: true` un-archives.
824
987
  */
825
988
  update<T = unknown>(id: string, params: UpdateProductParams): Promise<T>;
826
- list<T = unknown>(params?: BaseListParams): Promise<ListResponseEnvelope<T>>;
989
+ list<T = unknown>(params?: ProductsListParams): Promise<ListResponseEnvelope<T>>;
827
990
  iter<T = unknown>(options?: {
828
991
  pageSize?: number;
829
992
  }): AsyncIterableIterator<T>;
@@ -887,7 +1050,8 @@ declare class OneShotPayments extends BaseResource {
887
1050
  retrieve<T = unknown>(id: string): Promise<T>;
888
1051
  }
889
1052
  declare class Subscriptions extends BaseResource {
890
- retrieve<T = unknown>(id: string): Promise<T>;
1053
+ /** Expandable: `customer`, `price`, `refund_eligibility`. */
1054
+ retrieve<T = unknown>(id: string, options?: ExpandOptions): Promise<T>;
891
1055
  /**
892
1056
  * List subscriptions, newest first, optionally filtered.
893
1057
  *
@@ -996,12 +1160,22 @@ declare class Refunds extends BaseResource {
996
1160
  */
997
1161
  declare class Disputes extends BaseResource {
998
1162
  retrieve<T = unknown>(id: string): Promise<T>;
999
- list<T = unknown>(params?: BaseListParams): Promise<ListResponseEnvelope<T>>;
1163
+ list<T = unknown>(params?: DisputesListParams): Promise<ListResponseEnvelope<T>>;
1000
1164
  iter<T = unknown>(options?: {
1001
1165
  pageSize?: number;
1166
+ status?: string;
1167
+ payment_id?: string;
1002
1168
  }): AsyncIterableIterator<T>;
1003
1169
  }
1004
1170
  declare class WebhookEndpoints extends BaseResource {
1171
+ /**
1172
+ * Every event type this deployment can deliver, plus the wildcard.
1173
+ *
1174
+ * `enabled_events` rejects anything not on this list, so read it rather
1175
+ * than hard-coding a set: a name that is not on it fails at
1176
+ * registration and leaves you with an endpoint that never fires.
1177
+ */
1178
+ listEventTypes<T = unknown>(): Promise<T>;
1005
1179
  create<T = unknown>(params: CreateWebhookEndpointParams): Promise<T>;
1006
1180
  retrieve<T = unknown>(id: string): Promise<T>;
1007
1181
  /**
@@ -1085,6 +1259,40 @@ declare class Events extends BaseResource {
1085
1259
  declare class Tenant extends BaseResource {
1086
1260
  /** Cached Mollie profile shape (enabled methods, country, currency). */
1087
1261
  capabilities<T = unknown>(): Promise<T>;
1262
+ /**
1263
+ * Your registered country and VAT number: what your customers' VAT is
1264
+ * decided against.
1265
+ *
1266
+ * `country_code` is what you have stored and can be `null`;
1267
+ * `effective_country_code` is what the next charge will really use.
1268
+ * The two differ only when you have stored nothing, which is exactly
1269
+ * the case worth spotting before a first live payment.
1270
+ */
1271
+ billingProfile<T = unknown>(): Promise<T>;
1272
+ /**
1273
+ * Set the seller identity. `country_code` is required on every call;
1274
+ * every other field is partial-update, with an explicit `null` to
1275
+ * clear. Changes take effect on the next charge only. Tax is written
1276
+ * onto a payment and its invoice before money moves, and nothing goes
1277
+ * back and recalculates it.
1278
+ */
1279
+ setBillingProfile<T = unknown>(params: SetTenantBillingProfileParams): Promise<T>;
1280
+ /**
1281
+ * Download everything in the account as one JSON document, as raw bytes.
1282
+ *
1283
+ * ```ts
1284
+ * await writeFile("export.json", Buffer.from(await client.tenant.export()));
1285
+ * ```
1286
+ *
1287
+ * The GDPR Article 20 portability route, and the way to take a backup.
1288
+ * It is `application/json` streamed inline, with no redirect, and each
1289
+ * record has the same shape its `GET` route returns, with
1290
+ * `billkit_export_version` naming the shape. It can be large, so write
1291
+ * it to a file rather than holding it in memory. Test and live data
1292
+ * export separately: you get whichever mode the key belongs to. The
1293
+ * access is recorded in your audit log.
1294
+ */
1295
+ export(): Promise<ArrayBuffer>;
1088
1296
  /** Current portal branding row (business name, theme, capability flags). */
1089
1297
  portalBranding<T = unknown>(): Promise<T>;
1090
1298
  /**
@@ -1153,7 +1361,8 @@ declare class TaxRates extends BaseResource {
1153
1361
  * {@link Invoices.retrievePdf}.
1154
1362
  */
1155
1363
  declare class Invoices extends BaseResource {
1156
- retrieve<T = unknown>(id: string): Promise<T>;
1364
+ /** Expandable: `customer`. */
1365
+ retrieve<T = unknown>(id: string, options?: ExpandOptions): Promise<T>;
1157
1366
  /**
1158
1367
  * Download the rendered invoice PDF as raw bytes.
1159
1368
  *
@@ -1173,9 +1382,24 @@ declare class Invoices extends BaseResource {
1173
1382
  * structured invoice for tenants who render their own.
1174
1383
  */
1175
1384
  retrievePdf(id: string): Promise<ArrayBuffer>;
1176
- list<T = unknown>(params?: BaseListParams): Promise<ListResponseEnvelope<T>>;
1385
+ /**
1386
+ * Send the customer their invoice again.
1387
+ *
1388
+ * The same tenant-branded "your invoice is ready" email, with a fresh
1389
+ * portal link, because the one in the original may have expired. It
1390
+ * goes to the address captured **on the invoice**, not the customer's
1391
+ * current one: this is a copy of a document that was issued to
1392
+ * somebody. An invoice with no address on file is a
1393
+ * `InvalidRequestError` rather than a send that did not happen.
1394
+ */
1395
+ sendEmail<T = unknown>(id: string, params?: IdempotencyOptions): Promise<T>;
1396
+ list<T = unknown>(params?: InvoicesListParams): Promise<ListResponseEnvelope<T>>;
1177
1397
  iter<T = unknown>(options?: {
1178
1398
  pageSize?: number;
1399
+ customer_id?: string;
1400
+ subscription_id?: string;
1401
+ payment_id?: string;
1402
+ status?: string;
1179
1403
  }): AsyncIterableIterator<T>;
1180
1404
  /**
1181
1405
  * Void an invoice: state that the sale was never owed.
@@ -1245,10 +1469,23 @@ declare class AuditLogs extends BaseResource {
1245
1469
  * refunds and disputes are separate flows.
1246
1470
  */
1247
1471
  declare class Payments extends BaseResource {
1248
- retrieve<T = unknown>(id: string): Promise<T>;
1249
- list<T = unknown>(params?: BaseListParams): Promise<ListResponseEnvelope<T>>;
1472
+ /** Expandable: `customer`, `subscription`. */
1473
+ retrieve<T = unknown>(id: string, options?: ExpandOptions): Promise<T>;
1474
+ /**
1475
+ * Fetch the provider's own record of this charge, live.
1476
+ *
1477
+ * Reads Mollie at request time rather than a stored copy, so it carries
1478
+ * what BillKit deliberately does not keep: the card BIN, the iDEAL
1479
+ * bank, the provider's own status string. Reading live means it can
1480
+ * fail: a provider outage or a charge old enough to have aged out
1481
+ * answers `200` with `available: false` and a short reason, so render
1482
+ * the rest of the page regardless.
1483
+ */
1484
+ retrieveProvider<T = unknown>(id: string): Promise<T>;
1485
+ list<T = unknown>(params?: PaymentsListParams): Promise<ListResponseEnvelope<T>>;
1250
1486
  iter<T = unknown>(options?: {
1251
1487
  pageSize?: number;
1488
+ customer_id?: string;
1252
1489
  }): AsyncIterableIterator<T>;
1253
1490
  }
1254
1491
  /**
@@ -1264,6 +1501,38 @@ declare class BillingPortalSessions extends BaseResource {
1264
1501
  /** Kill an in-the-wild portal session. Idempotent. */
1265
1502
  revoke<T = unknown>(id: string, params?: IdempotencyOptions): Promise<T>;
1266
1503
  }
1504
+ /**
1505
+ * Issue, inspect and revoke API keys.
1506
+ *
1507
+ * A key is issued in the same mode as the key that created it, so a test
1508
+ * key can only mint test keys, and it can never grant scopes it does not
1509
+ * hold itself. The secret is returned **once**, on
1510
+ * {@link ApiKeys.create}; every later read carries only the prefix.
1511
+ */
1512
+ declare class ApiKeys extends BaseResource {
1513
+ /**
1514
+ * Issue a new key. The response's `secret` is the only time the full
1515
+ * key exists outside the caller's own storage, so record it now.
1516
+ */
1517
+ create<T = unknown>(params?: CreateApiKeyParams): Promise<T>;
1518
+ /**
1519
+ * One key's metadata: prefix, label, scopes, `revoked_at`, and
1520
+ * `last_used_at`, which is the field to read before revoking one.
1521
+ */
1522
+ retrieve<T = unknown>(id: string): Promise<T>;
1523
+ /**
1524
+ * Revoke a key so it stops working. Immediate and irreversible; issue a
1525
+ * new key instead. Revoking an already-revoked key returns it
1526
+ * unchanged, so a retry is safe, and a key may revoke itself, which is
1527
+ * what you want when the leaked key is the one you are calling with.
1528
+ */
1529
+ revoke<T = unknown>(id: string, params?: IdempotencyOptions): Promise<T>;
1530
+ /** List keys, newest first. Revoked ones are included; check `revoked_at`. */
1531
+ list<T = unknown>(params?: BaseListParams): Promise<ListResponseEnvelope<T>>;
1532
+ iter<T = unknown>(options?: {
1533
+ pageSize?: number;
1534
+ }): AsyncIterableIterator<T>;
1535
+ }
1267
1536
 
1268
1537
  /**
1269
1538
  * Top-level BillKit client.
@@ -1279,6 +1548,7 @@ interface BillKitOptions extends Omit<TransportConfig, "apiKey"> {
1279
1548
  apiKey?: string;
1280
1549
  }
1281
1550
  declare class BillKit {
1551
+ readonly apiKeys: ApiKeys;
1282
1552
  readonly customers: Customers;
1283
1553
  readonly products: Products;
1284
1554
  readonly prices: Prices;
@@ -1307,6 +1577,12 @@ interface BillKitErrorOptions {
1307
1577
  statusCode?: number | undefined;
1308
1578
  requestId?: string | undefined;
1309
1579
  rawBody?: unknown;
1580
+ /**
1581
+ * The underlying error, forwarded to `Error`'s own `cause`. Set on
1582
+ * `APIConnectionError` so the runtime's reason for a failed fetch
1583
+ * (`ECONNREFUSED`, a TLS failure, an abort) survives the mapping.
1584
+ */
1585
+ cause?: unknown;
1310
1586
  }
1311
1587
  declare class BillKitError extends Error {
1312
1588
  name: string;
@@ -1350,7 +1626,7 @@ declare class RateLimitError extends BillKitError {
1350
1626
  });
1351
1627
  }
1352
1628
 
1353
- declare const VERSION = "0.6.0";
1629
+ declare const VERSION = "0.7.1";
1354
1630
 
1355
1631
  /**
1356
1632
  * Verify `BillKit-Signature: t=<unix>,v1=<hex>` headers.
@@ -1382,4 +1658,4 @@ interface VerifyWebhookOptions {
1382
1658
  }
1383
1659
  declare function verifyWebhookSignature<T = unknown>(options: VerifyWebhookOptions): Promise<T>;
1384
1660
 
1385
- export { APIConnectionError, APIError, type AuditLogsListParams, AuthenticationError, type BaseListParams, BillKit, BillKitError, type BillKitLogger, type BillKitOptions, ConflictError, type CreateBillingPortalSessionParams, type CreateCheckoutSessionParams, type CreateCouponParams, type CreateCustomerParams, type CreateOneShotPaymentParams, type CreatePriceParams, type CreateProductParams, type CreateRefundParams, type CreateTaxRateParams, type CreateUsageRecordParams, type CreateWebhookEndpointParams, type CreditNotesListParams, type CustomerListParams, DEFAULT_RETRY_POLICY, DEFAULT_WEBHOOK_TOLERANCE_SECONDS, type EventsListParams, type IdempotencyOptions, InvalidRequestError, type ListParams, type ListResponseEnvelope, type LogContext, NOOP_LOGGER, type PaginateOptions, PermissionError, type PriceTier, type PricesListParams, RateLimitError, ResourceMissingError, type RetryPolicy, type RotateProviderCredentialParams, ServerError, type SetPortalBrandingParams, type SubscriptionsListParams, type UpdateCouponParams, type UpdateCustomerParams, type UpdateProductParams, type UpdateTaxRateParams, type UpdateWebhookEndpointParams, type UsageRecordsListParams, VERSION, type ValidateCouponParams, type VerifyWebhookOptions, type VoidInvoiceParams, WebhookVerificationError, paginate, verifyWebhookSignature };
1661
+ export { APIConnectionError, APIError, type AuditLogsListParams, AuthenticationError, type BaseListParams, BillKit, BillKitError, type BillKitLogger, type BillKitOptions, ConflictError, type CreateApiKeyParams, type CreateBillingPortalSessionParams, type CreateCheckoutSessionParams, type CreateCouponParams, type CreateCustomerParams, type CreateOneShotPaymentParams, type CreatePriceParams, type CreateProductParams, type CreateRefundParams, type CreateTaxRateParams, type CreateUsageRecordParams, type CreateWebhookEndpointParams, type CreditNotesListParams, type CustomerListParams, DEFAULT_RETRY_POLICY, DEFAULT_WEBHOOK_TOLERANCE_SECONDS, type DisputesListParams, type EventsListParams, type ExpandOptions, type IdempotencyOptions, InvalidRequestError, type InvoicesListParams, type ListParams, type ListResponseEnvelope, type LogContext, NOOP_LOGGER, type PaginateOptions, type PaymentsListParams, PermissionError, type PriceTier, type PricesListParams, type ProductsListParams, RateLimitError, ResourceMissingError, type RetryPolicy, type RotateProviderCredentialParams, ServerError, type SetCustomerVatNumberParams, type SetPortalBrandingParams, type SetTenantBillingProfileParams, type SubscriptionsListParams, type UpdateCouponParams, type UpdateCustomerParams, type UpdatePriceParams, type UpdateProductParams, type UpdateTaxRateParams, type UpdateWebhookEndpointParams, type UsageRecordsListParams, VERSION, type ValidateCouponParams, type VerifyWebhookOptions, type VoidInvoiceParams, WebhookVerificationError, paginate, verifyWebhookSignature };