@billkit-eu/sdk 0.7.1 → 0.8.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/dist/index.d.cts CHANGED
@@ -260,6 +260,20 @@ interface PaymentsListParams extends BaseListParams {
260
260
  /** Expandable here: `customer`, `subscription`. */
261
261
  expand?: string[];
262
262
  }
263
+ /**
264
+ * `oneShotPayments.list` params. `payments.list` lists subscription
265
+ * payments only; one-off charges are listed here, newest first.
266
+ * Failed, expired and still-open charges are included, so check `status`
267
+ * before counting a row as revenue.
268
+ */
269
+ interface OneShotPaymentsListParams extends BaseListParams {
270
+ customer_id?: string;
271
+ /**
272
+ * One of `open`, `pending`, `authorized`, `paid`, `failed`, `expired`,
273
+ * `canceled`, `refunded`. Anything else is a `400` on `status`.
274
+ */
275
+ status?: string;
276
+ }
263
277
  /**
264
278
  * `invoices.list` params. The three id filters each narrow to one row's
265
279
  * worth of invoices: `payment_id` answers "which invoice did this charge
@@ -328,7 +342,8 @@ interface CreateCustomerParams extends IdempotencyOptions {
328
342
  }
329
343
  interface UpdateCustomerParams extends IdempotencyOptions {
330
344
  email?: string;
331
- name?: string;
345
+ /** An explicit `null` **clears** it and is sent as a JSON null rather than pruned (only `undefined` is dropped); omit the field to leave it alone. */
346
+ name?: string | null;
332
347
  country_code?: string;
333
348
  metadata?: Record<string, string>;
334
349
  }
@@ -391,7 +406,8 @@ interface CreateProductParams extends IdempotencyOptions {
391
406
  }
392
407
  interface UpdateProductParams extends IdempotencyOptions {
393
408
  name?: string;
394
- description?: string;
409
+ /** An explicit `null` **clears** it and is sent as a JSON null rather than pruned (only `undefined` is dropped); omit the field to leave it alone. */
410
+ description?: string | null;
395
411
  marketing_features?: string[];
396
412
  metadata?: Record<string, string>;
397
413
  /** Set false to stop selling a product without deleting history. */
@@ -744,7 +760,8 @@ interface CreateWebhookEndpointParams extends IdempotencyOptions {
744
760
  interface UpdateWebhookEndpointParams extends IdempotencyOptions {
745
761
  url?: string;
746
762
  enabled_events?: string[];
747
- description?: string;
763
+ /** An explicit `null` **clears** it and is sent as a JSON null rather than pruned (only `undefined` is dropped); omit the field to leave it alone. */
764
+ description?: string | null;
748
765
  status?: string;
749
766
  }
750
767
  interface EventsListParams extends BaseListParams {
@@ -786,8 +803,10 @@ interface CreateCouponParams extends IdempotencyOptions {
786
803
  }
787
804
  interface UpdateCouponParams extends IdempotencyOptions {
788
805
  active?: boolean;
789
- max_redemptions?: number;
790
- redeem_by?: number;
806
+ /** `null` removes the redemption cap. An explicit `null` **clears** it and is sent as a JSON null rather than pruned (only `undefined` is dropped); omit the field to leave it alone. */
807
+ max_redemptions?: number | null;
808
+ /** Epoch seconds. `null` removes the expiry. An explicit `null` **clears** it and is sent as a JSON null rather than pruned (only `undefined` is dropped); omit the field to leave it alone. */
809
+ redeem_by?: number | null;
791
810
  applies_to_price_ids?: string[];
792
811
  min_amount_cents?: number;
793
812
  }
@@ -814,7 +833,8 @@ interface CreateTaxRateParams extends IdempotencyOptions {
814
833
  }
815
834
  interface UpdateTaxRateParams extends IdempotencyOptions {
816
835
  rate_basis_points?: number;
817
- display_name?: string;
836
+ /** An explicit `null` **clears** it and is sent as a JSON null rather than pruned (only `undefined` is dropped); omit the field to leave it alone. */
837
+ display_name?: string | null;
818
838
  inclusive?: boolean;
819
839
  active?: boolean;
820
840
  }
@@ -1048,6 +1068,13 @@ declare class OneShotPayments extends BaseResource {
1048
1068
  /** Create a one-off charge; returns the object with a `redirect_url`. */
1049
1069
  create<T = unknown>(params: CreateOneShotPaymentParams): Promise<T>;
1050
1070
  retrieve<T = unknown>(id: string): Promise<T>;
1071
+ /** List one-off charges, newest first. Filter by `customer_id` and `status`. */
1072
+ list<T = unknown>(params?: OneShotPaymentsListParams): Promise<ListResponseEnvelope<T>>;
1073
+ iter<T = unknown>(options?: {
1074
+ pageSize?: number;
1075
+ customer_id?: string;
1076
+ status?: string;
1077
+ }): AsyncIterableIterator<T>;
1051
1078
  }
1052
1079
  declare class Subscriptions extends BaseResource {
1053
1080
  /** Expandable: `customer`, `price`, `refund_eligibility`. */
@@ -1469,7 +1496,20 @@ declare class AuditLogs extends BaseResource {
1469
1496
  * refunds and disputes are separate flows.
1470
1497
  */
1471
1498
  declare class Payments extends BaseResource {
1472
- /** Expandable: `customer`, `subscription`. */
1499
+ /**
1500
+ * Expandable: `customer`, `subscription`, `refund_eligibility`. The last
1501
+ * is retrieve-only (`list` refuses it with a `400`) and attaches
1502
+ * `refund_eligibility: { object: "refund_eligibility", eligible,
1503
+ * amount_cents, currency, days_remaining, window_ends_at, reason }`:
1504
+ * whether `refunds.create` for the remaining balance would succeed now,
1505
+ * applying the refund window and the price's refund policy, which
1506
+ * `amount_refundable_cents` does not. When `eligible` is false, `reason`
1507
+ * is one of `not_paid`, `unrefundable_type`, `window_expired`,
1508
+ * `fully_refunded`, `disputed`, `operation_pending` or
1509
+ * `plan_change_pending` (a plan change is settling: the full balance
1510
+ * cannot be refunded yet, a partial refund still can); treat any other
1511
+ * value as "not refundable".
1512
+ */
1473
1513
  retrieve<T = unknown>(id: string, options?: ExpandOptions): Promise<T>;
1474
1514
  /**
1475
1515
  * Fetch the provider's own record of this charge, live.
@@ -1626,7 +1666,7 @@ declare class RateLimitError extends BillKitError {
1626
1666
  });
1627
1667
  }
1628
1668
 
1629
- declare const VERSION = "0.7.1";
1669
+ declare const VERSION = "0.8.0";
1630
1670
 
1631
1671
  /**
1632
1672
  * Verify `BillKit-Signature: t=<unix>,v1=<hex>` headers.
@@ -1658,4 +1698,4 @@ interface VerifyWebhookOptions {
1658
1698
  }
1659
1699
  declare function verifyWebhookSignature<T = unknown>(options: VerifyWebhookOptions): Promise<T>;
1660
1700
 
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 };
1701
+ 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 OneShotPaymentsListParams, 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 };
package/dist/index.d.ts CHANGED
@@ -260,6 +260,20 @@ interface PaymentsListParams extends BaseListParams {
260
260
  /** Expandable here: `customer`, `subscription`. */
261
261
  expand?: string[];
262
262
  }
263
+ /**
264
+ * `oneShotPayments.list` params. `payments.list` lists subscription
265
+ * payments only; one-off charges are listed here, newest first.
266
+ * Failed, expired and still-open charges are included, so check `status`
267
+ * before counting a row as revenue.
268
+ */
269
+ interface OneShotPaymentsListParams extends BaseListParams {
270
+ customer_id?: string;
271
+ /**
272
+ * One of `open`, `pending`, `authorized`, `paid`, `failed`, `expired`,
273
+ * `canceled`, `refunded`. Anything else is a `400` on `status`.
274
+ */
275
+ status?: string;
276
+ }
263
277
  /**
264
278
  * `invoices.list` params. The three id filters each narrow to one row's
265
279
  * worth of invoices: `payment_id` answers "which invoice did this charge
@@ -328,7 +342,8 @@ interface CreateCustomerParams extends IdempotencyOptions {
328
342
  }
329
343
  interface UpdateCustomerParams extends IdempotencyOptions {
330
344
  email?: string;
331
- name?: string;
345
+ /** An explicit `null` **clears** it and is sent as a JSON null rather than pruned (only `undefined` is dropped); omit the field to leave it alone. */
346
+ name?: string | null;
332
347
  country_code?: string;
333
348
  metadata?: Record<string, string>;
334
349
  }
@@ -391,7 +406,8 @@ interface CreateProductParams extends IdempotencyOptions {
391
406
  }
392
407
  interface UpdateProductParams extends IdempotencyOptions {
393
408
  name?: string;
394
- description?: string;
409
+ /** An explicit `null` **clears** it and is sent as a JSON null rather than pruned (only `undefined` is dropped); omit the field to leave it alone. */
410
+ description?: string | null;
395
411
  marketing_features?: string[];
396
412
  metadata?: Record<string, string>;
397
413
  /** Set false to stop selling a product without deleting history. */
@@ -744,7 +760,8 @@ interface CreateWebhookEndpointParams extends IdempotencyOptions {
744
760
  interface UpdateWebhookEndpointParams extends IdempotencyOptions {
745
761
  url?: string;
746
762
  enabled_events?: string[];
747
- description?: string;
763
+ /** An explicit `null` **clears** it and is sent as a JSON null rather than pruned (only `undefined` is dropped); omit the field to leave it alone. */
764
+ description?: string | null;
748
765
  status?: string;
749
766
  }
750
767
  interface EventsListParams extends BaseListParams {
@@ -786,8 +803,10 @@ interface CreateCouponParams extends IdempotencyOptions {
786
803
  }
787
804
  interface UpdateCouponParams extends IdempotencyOptions {
788
805
  active?: boolean;
789
- max_redemptions?: number;
790
- redeem_by?: number;
806
+ /** `null` removes the redemption cap. An explicit `null` **clears** it and is sent as a JSON null rather than pruned (only `undefined` is dropped); omit the field to leave it alone. */
807
+ max_redemptions?: number | null;
808
+ /** Epoch seconds. `null` removes the expiry. An explicit `null` **clears** it and is sent as a JSON null rather than pruned (only `undefined` is dropped); omit the field to leave it alone. */
809
+ redeem_by?: number | null;
791
810
  applies_to_price_ids?: string[];
792
811
  min_amount_cents?: number;
793
812
  }
@@ -814,7 +833,8 @@ interface CreateTaxRateParams extends IdempotencyOptions {
814
833
  }
815
834
  interface UpdateTaxRateParams extends IdempotencyOptions {
816
835
  rate_basis_points?: number;
817
- display_name?: string;
836
+ /** An explicit `null` **clears** it and is sent as a JSON null rather than pruned (only `undefined` is dropped); omit the field to leave it alone. */
837
+ display_name?: string | null;
818
838
  inclusive?: boolean;
819
839
  active?: boolean;
820
840
  }
@@ -1048,6 +1068,13 @@ declare class OneShotPayments extends BaseResource {
1048
1068
  /** Create a one-off charge; returns the object with a `redirect_url`. */
1049
1069
  create<T = unknown>(params: CreateOneShotPaymentParams): Promise<T>;
1050
1070
  retrieve<T = unknown>(id: string): Promise<T>;
1071
+ /** List one-off charges, newest first. Filter by `customer_id` and `status`. */
1072
+ list<T = unknown>(params?: OneShotPaymentsListParams): Promise<ListResponseEnvelope<T>>;
1073
+ iter<T = unknown>(options?: {
1074
+ pageSize?: number;
1075
+ customer_id?: string;
1076
+ status?: string;
1077
+ }): AsyncIterableIterator<T>;
1051
1078
  }
1052
1079
  declare class Subscriptions extends BaseResource {
1053
1080
  /** Expandable: `customer`, `price`, `refund_eligibility`. */
@@ -1469,7 +1496,20 @@ declare class AuditLogs extends BaseResource {
1469
1496
  * refunds and disputes are separate flows.
1470
1497
  */
1471
1498
  declare class Payments extends BaseResource {
1472
- /** Expandable: `customer`, `subscription`. */
1499
+ /**
1500
+ * Expandable: `customer`, `subscription`, `refund_eligibility`. The last
1501
+ * is retrieve-only (`list` refuses it with a `400`) and attaches
1502
+ * `refund_eligibility: { object: "refund_eligibility", eligible,
1503
+ * amount_cents, currency, days_remaining, window_ends_at, reason }`:
1504
+ * whether `refunds.create` for the remaining balance would succeed now,
1505
+ * applying the refund window and the price's refund policy, which
1506
+ * `amount_refundable_cents` does not. When `eligible` is false, `reason`
1507
+ * is one of `not_paid`, `unrefundable_type`, `window_expired`,
1508
+ * `fully_refunded`, `disputed`, `operation_pending` or
1509
+ * `plan_change_pending` (a plan change is settling: the full balance
1510
+ * cannot be refunded yet, a partial refund still can); treat any other
1511
+ * value as "not refundable".
1512
+ */
1473
1513
  retrieve<T = unknown>(id: string, options?: ExpandOptions): Promise<T>;
1474
1514
  /**
1475
1515
  * Fetch the provider's own record of this charge, live.
@@ -1626,7 +1666,7 @@ declare class RateLimitError extends BillKitError {
1626
1666
  });
1627
1667
  }
1628
1668
 
1629
- declare const VERSION = "0.7.1";
1669
+ declare const VERSION = "0.8.0";
1630
1670
 
1631
1671
  /**
1632
1672
  * Verify `BillKit-Signature: t=<unix>,v1=<hex>` headers.
@@ -1658,4 +1698,4 @@ interface VerifyWebhookOptions {
1658
1698
  }
1659
1699
  declare function verifyWebhookSignature<T = unknown>(options: VerifyWebhookOptions): Promise<T>;
1660
1700
 
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 };
1701
+ 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 OneShotPaymentsListParams, 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 };
package/dist/index.js CHANGED
@@ -263,6 +263,16 @@ var OneShotPayments = class extends BaseResource {
263
263
  retrieve(id) {
264
264
  return this.get(`/v1/checkout/one_shot/${p(id)}`);
265
265
  }
266
+ /** List one-off charges, newest first. Filter by `customer_id` and `status`. */
267
+ list(params = {}) {
268
+ return this.get("/v1/checkout/one_shot", params);
269
+ }
270
+ iter(options = {}) {
271
+ return paginate((page) => this.get("/v1/checkout/one_shot", page), {
272
+ pageSize: options.pageSize,
273
+ filters: { customer_id: options.customer_id, status: options.status }
274
+ });
275
+ }
266
276
  };
267
277
  var Subscriptions = class extends BaseResource {
268
278
  /** Expandable: `customer`, `price`, `refund_eligibility`. */
@@ -775,7 +785,20 @@ var AuditLogs = class extends BaseResource {
775
785
  }
776
786
  };
777
787
  var Payments = class extends BaseResource {
778
- /** Expandable: `customer`, `subscription`. */
788
+ /**
789
+ * Expandable: `customer`, `subscription`, `refund_eligibility`. The last
790
+ * is retrieve-only (`list` refuses it with a `400`) and attaches
791
+ * `refund_eligibility: { object: "refund_eligibility", eligible,
792
+ * amount_cents, currency, days_remaining, window_ends_at, reason }`:
793
+ * whether `refunds.create` for the remaining balance would succeed now,
794
+ * applying the refund window and the price's refund policy, which
795
+ * `amount_refundable_cents` does not. When `eligible` is false, `reason`
796
+ * is one of `not_paid`, `unrefundable_type`, `window_expired`,
797
+ * `fully_refunded`, `disputed`, `operation_pending` or
798
+ * `plan_change_pending` (a plan change is settling: the full balance
799
+ * cannot be refunded yet, a partial refund still can); treat any other
800
+ * value as "not refundable".
801
+ */
779
802
  retrieve(id, options = {}) {
780
803
  return this.get(`/v1/payments/${p(id)}`, options);
781
804
  }
@@ -974,7 +997,7 @@ function sleep(ms) {
974
997
  }
975
998
 
976
999
  // src/version.ts
977
- var VERSION = "0.7.1";
1000
+ var VERSION = "0.8.0";
978
1001
 
979
1002
  // src/transport.ts
980
1003
  var DEFAULT_BASE_URL = "https://api.billkit.eu";