@billkit-eu/sdk 0.7.0 → 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/CHANGELOG.md +25 -1
- package/README.md +6 -2
- package/dist/index.cjs +29 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -16
- package/dist/index.d.ts +72 -16
- package/dist/index.js +29 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/resources.ts +78 -14
- package/src/version.ts +1 -1
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
|
-
|
|
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
|
}
|
|
@@ -344,7 +359,7 @@ interface CustomerListParams extends BaseListParams {
|
|
|
344
359
|
}
|
|
345
360
|
/** Query parameters accepted by `GET /v1/products`. */
|
|
346
361
|
interface ProductsListParams extends BaseListParams {
|
|
347
|
-
/** Expandable here: `prices`, `stats`. */
|
|
362
|
+
/** Expandable here: `prices`, `stats`, `default_price`. */
|
|
348
363
|
expand?: string[];
|
|
349
364
|
}
|
|
350
365
|
/**
|
|
@@ -391,13 +406,22 @@ interface CreateProductParams extends IdempotencyOptions {
|
|
|
391
406
|
}
|
|
392
407
|
interface UpdateProductParams extends IdempotencyOptions {
|
|
393
408
|
name?: string;
|
|
394
|
-
|
|
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. */
|
|
398
414
|
active?: boolean;
|
|
399
415
|
/** See {@link CreateProductParams.allow_promotion_codes}. */
|
|
400
416
|
allow_promotion_codes?: boolean;
|
|
417
|
+
/**
|
|
418
|
+
* The price the billing portal offers on that price's interval. Must be
|
|
419
|
+
* an active price of this product; anything else is a 400 on
|
|
420
|
+
* `default_price_id`. An explicit `null` **clears** the default and is
|
|
421
|
+
* sent as a JSON null rather than pruned (only `undefined` is dropped);
|
|
422
|
+
* omit the field to leave the default alone.
|
|
423
|
+
*/
|
|
424
|
+
default_price_id?: string | null;
|
|
401
425
|
}
|
|
402
426
|
/**
|
|
403
427
|
* Body for `POST /v1/prices/{id}`. Every field is optional; omitted ones
|
|
@@ -736,7 +760,8 @@ interface CreateWebhookEndpointParams extends IdempotencyOptions {
|
|
|
736
760
|
interface UpdateWebhookEndpointParams extends IdempotencyOptions {
|
|
737
761
|
url?: string;
|
|
738
762
|
enabled_events?: string[];
|
|
739
|
-
|
|
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;
|
|
740
765
|
status?: string;
|
|
741
766
|
}
|
|
742
767
|
interface EventsListParams extends BaseListParams {
|
|
@@ -778,8 +803,10 @@ interface CreateCouponParams extends IdempotencyOptions {
|
|
|
778
803
|
}
|
|
779
804
|
interface UpdateCouponParams extends IdempotencyOptions {
|
|
780
805
|
active?: boolean;
|
|
781
|
-
|
|
782
|
-
|
|
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;
|
|
783
810
|
applies_to_price_ids?: string[];
|
|
784
811
|
min_amount_cents?: number;
|
|
785
812
|
}
|
|
@@ -806,7 +833,8 @@ interface CreateTaxRateParams extends IdempotencyOptions {
|
|
|
806
833
|
}
|
|
807
834
|
interface UpdateTaxRateParams extends IdempotencyOptions {
|
|
808
835
|
rate_basis_points?: number;
|
|
809
|
-
|
|
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;
|
|
810
838
|
inclusive?: boolean;
|
|
811
839
|
active?: boolean;
|
|
812
840
|
}
|
|
@@ -840,15 +868,20 @@ interface CreditNotesListParams extends BaseListParams {
|
|
|
840
868
|
* VAT is decided against and that an invoice prints.
|
|
841
869
|
*
|
|
842
870
|
* `country_code` is required on every call: there is nothing to leave
|
|
843
|
-
* alone about a jurisdiction.
|
|
844
|
-
*
|
|
845
|
-
*
|
|
846
|
-
* real event.
|
|
871
|
+
* alone about a jurisdiction. The address fields and
|
|
872
|
+
* `registration_number` are partial-update: omit one to leave the stored
|
|
873
|
+
* value alone, or pass an explicit `null` to clear it, because moving
|
|
874
|
+
* office is a real event.
|
|
875
|
+
*
|
|
876
|
+
* `vat_id` can be set once. After that, a different value or `null` is
|
|
877
|
+
* refused with a 400 (`param: "vat_id"`, reason `vat_id_locked`) and the
|
|
878
|
+
* call writes nothing; re-sending the stored number is accepted. BillKit
|
|
879
|
+
* invoices you reverse-charged against it, so support changes it.
|
|
847
880
|
*/
|
|
848
881
|
interface SetTenantBillingProfileParams extends IdempotencyOptions {
|
|
849
882
|
/** ISO-3166-1 alpha-2, e.g. `"NL"`. */
|
|
850
883
|
country_code: string;
|
|
851
|
-
/** Your own EU VAT registration
|
|
884
|
+
/** Your own EU VAT registration. Set once; support changes or clears it. */
|
|
852
885
|
vat_id?: string | null;
|
|
853
886
|
address_line1?: string | null;
|
|
854
887
|
address_line2?: string | null;
|
|
@@ -958,7 +991,10 @@ declare class Customers extends BaseResource {
|
|
|
958
991
|
declare class Products extends BaseResource {
|
|
959
992
|
/** Create a catalog Product, then attach one or more Prices to it. */
|
|
960
993
|
create<T = unknown>(params: CreateProductParams): Promise<T>;
|
|
961
|
-
/**
|
|
994
|
+
/**
|
|
995
|
+
* Expandable: `prices` (every price on the product), `stats`, and
|
|
996
|
+
* `default_price` (the price `default_price_id` names).
|
|
997
|
+
*/
|
|
962
998
|
retrieve<T = unknown>(id: string, options?: ExpandOptions): Promise<T>;
|
|
963
999
|
/**
|
|
964
1000
|
* Patch mutable Product fields, or archive it with `active: false`.
|
|
@@ -1032,6 +1068,13 @@ declare class OneShotPayments extends BaseResource {
|
|
|
1032
1068
|
/** Create a one-off charge; returns the object with a `redirect_url`. */
|
|
1033
1069
|
create<T = unknown>(params: CreateOneShotPaymentParams): Promise<T>;
|
|
1034
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>;
|
|
1035
1078
|
}
|
|
1036
1079
|
declare class Subscriptions extends BaseResource {
|
|
1037
1080
|
/** Expandable: `customer`, `price`, `refund_eligibility`. */
|
|
@@ -1453,7 +1496,20 @@ declare class AuditLogs extends BaseResource {
|
|
|
1453
1496
|
* refunds and disputes are separate flows.
|
|
1454
1497
|
*/
|
|
1455
1498
|
declare class Payments extends BaseResource {
|
|
1456
|
-
/**
|
|
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
|
+
*/
|
|
1457
1513
|
retrieve<T = unknown>(id: string, options?: ExpandOptions): Promise<T>;
|
|
1458
1514
|
/**
|
|
1459
1515
|
* Fetch the provider's own record of this charge, live.
|
|
@@ -1610,7 +1666,7 @@ declare class RateLimitError extends BillKitError {
|
|
|
1610
1666
|
});
|
|
1611
1667
|
}
|
|
1612
1668
|
|
|
1613
|
-
declare const VERSION = "0.
|
|
1669
|
+
declare const VERSION = "0.8.0";
|
|
1614
1670
|
|
|
1615
1671
|
/**
|
|
1616
1672
|
* Verify `BillKit-Signature: t=<unix>,v1=<hex>` headers.
|
|
@@ -1642,4 +1698,4 @@ interface VerifyWebhookOptions {
|
|
|
1642
1698
|
}
|
|
1643
1699
|
declare function verifyWebhookSignature<T = unknown>(options: VerifyWebhookOptions): Promise<T>;
|
|
1644
1700
|
|
|
1645
|
-
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
|
-
|
|
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
|
}
|
|
@@ -344,7 +359,7 @@ interface CustomerListParams extends BaseListParams {
|
|
|
344
359
|
}
|
|
345
360
|
/** Query parameters accepted by `GET /v1/products`. */
|
|
346
361
|
interface ProductsListParams extends BaseListParams {
|
|
347
|
-
/** Expandable here: `prices`, `stats`. */
|
|
362
|
+
/** Expandable here: `prices`, `stats`, `default_price`. */
|
|
348
363
|
expand?: string[];
|
|
349
364
|
}
|
|
350
365
|
/**
|
|
@@ -391,13 +406,22 @@ interface CreateProductParams extends IdempotencyOptions {
|
|
|
391
406
|
}
|
|
392
407
|
interface UpdateProductParams extends IdempotencyOptions {
|
|
393
408
|
name?: string;
|
|
394
|
-
|
|
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. */
|
|
398
414
|
active?: boolean;
|
|
399
415
|
/** See {@link CreateProductParams.allow_promotion_codes}. */
|
|
400
416
|
allow_promotion_codes?: boolean;
|
|
417
|
+
/**
|
|
418
|
+
* The price the billing portal offers on that price's interval. Must be
|
|
419
|
+
* an active price of this product; anything else is a 400 on
|
|
420
|
+
* `default_price_id`. An explicit `null` **clears** the default and is
|
|
421
|
+
* sent as a JSON null rather than pruned (only `undefined` is dropped);
|
|
422
|
+
* omit the field to leave the default alone.
|
|
423
|
+
*/
|
|
424
|
+
default_price_id?: string | null;
|
|
401
425
|
}
|
|
402
426
|
/**
|
|
403
427
|
* Body for `POST /v1/prices/{id}`. Every field is optional; omitted ones
|
|
@@ -736,7 +760,8 @@ interface CreateWebhookEndpointParams extends IdempotencyOptions {
|
|
|
736
760
|
interface UpdateWebhookEndpointParams extends IdempotencyOptions {
|
|
737
761
|
url?: string;
|
|
738
762
|
enabled_events?: string[];
|
|
739
|
-
|
|
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;
|
|
740
765
|
status?: string;
|
|
741
766
|
}
|
|
742
767
|
interface EventsListParams extends BaseListParams {
|
|
@@ -778,8 +803,10 @@ interface CreateCouponParams extends IdempotencyOptions {
|
|
|
778
803
|
}
|
|
779
804
|
interface UpdateCouponParams extends IdempotencyOptions {
|
|
780
805
|
active?: boolean;
|
|
781
|
-
|
|
782
|
-
|
|
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;
|
|
783
810
|
applies_to_price_ids?: string[];
|
|
784
811
|
min_amount_cents?: number;
|
|
785
812
|
}
|
|
@@ -806,7 +833,8 @@ interface CreateTaxRateParams extends IdempotencyOptions {
|
|
|
806
833
|
}
|
|
807
834
|
interface UpdateTaxRateParams extends IdempotencyOptions {
|
|
808
835
|
rate_basis_points?: number;
|
|
809
|
-
|
|
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;
|
|
810
838
|
inclusive?: boolean;
|
|
811
839
|
active?: boolean;
|
|
812
840
|
}
|
|
@@ -840,15 +868,20 @@ interface CreditNotesListParams extends BaseListParams {
|
|
|
840
868
|
* VAT is decided against and that an invoice prints.
|
|
841
869
|
*
|
|
842
870
|
* `country_code` is required on every call: there is nothing to leave
|
|
843
|
-
* alone about a jurisdiction.
|
|
844
|
-
*
|
|
845
|
-
*
|
|
846
|
-
* real event.
|
|
871
|
+
* alone about a jurisdiction. The address fields and
|
|
872
|
+
* `registration_number` are partial-update: omit one to leave the stored
|
|
873
|
+
* value alone, or pass an explicit `null` to clear it, because moving
|
|
874
|
+
* office is a real event.
|
|
875
|
+
*
|
|
876
|
+
* `vat_id` can be set once. After that, a different value or `null` is
|
|
877
|
+
* refused with a 400 (`param: "vat_id"`, reason `vat_id_locked`) and the
|
|
878
|
+
* call writes nothing; re-sending the stored number is accepted. BillKit
|
|
879
|
+
* invoices you reverse-charged against it, so support changes it.
|
|
847
880
|
*/
|
|
848
881
|
interface SetTenantBillingProfileParams extends IdempotencyOptions {
|
|
849
882
|
/** ISO-3166-1 alpha-2, e.g. `"NL"`. */
|
|
850
883
|
country_code: string;
|
|
851
|
-
/** Your own EU VAT registration
|
|
884
|
+
/** Your own EU VAT registration. Set once; support changes or clears it. */
|
|
852
885
|
vat_id?: string | null;
|
|
853
886
|
address_line1?: string | null;
|
|
854
887
|
address_line2?: string | null;
|
|
@@ -958,7 +991,10 @@ declare class Customers extends BaseResource {
|
|
|
958
991
|
declare class Products extends BaseResource {
|
|
959
992
|
/** Create a catalog Product, then attach one or more Prices to it. */
|
|
960
993
|
create<T = unknown>(params: CreateProductParams): Promise<T>;
|
|
961
|
-
/**
|
|
994
|
+
/**
|
|
995
|
+
* Expandable: `prices` (every price on the product), `stats`, and
|
|
996
|
+
* `default_price` (the price `default_price_id` names).
|
|
997
|
+
*/
|
|
962
998
|
retrieve<T = unknown>(id: string, options?: ExpandOptions): Promise<T>;
|
|
963
999
|
/**
|
|
964
1000
|
* Patch mutable Product fields, or archive it with `active: false`.
|
|
@@ -1032,6 +1068,13 @@ declare class OneShotPayments extends BaseResource {
|
|
|
1032
1068
|
/** Create a one-off charge; returns the object with a `redirect_url`. */
|
|
1033
1069
|
create<T = unknown>(params: CreateOneShotPaymentParams): Promise<T>;
|
|
1034
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>;
|
|
1035
1078
|
}
|
|
1036
1079
|
declare class Subscriptions extends BaseResource {
|
|
1037
1080
|
/** Expandable: `customer`, `price`, `refund_eligibility`. */
|
|
@@ -1453,7 +1496,20 @@ declare class AuditLogs extends BaseResource {
|
|
|
1453
1496
|
* refunds and disputes are separate flows.
|
|
1454
1497
|
*/
|
|
1455
1498
|
declare class Payments extends BaseResource {
|
|
1456
|
-
/**
|
|
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
|
+
*/
|
|
1457
1513
|
retrieve<T = unknown>(id: string, options?: ExpandOptions): Promise<T>;
|
|
1458
1514
|
/**
|
|
1459
1515
|
* Fetch the provider's own record of this charge, live.
|
|
@@ -1610,7 +1666,7 @@ declare class RateLimitError extends BillKitError {
|
|
|
1610
1666
|
});
|
|
1611
1667
|
}
|
|
1612
1668
|
|
|
1613
|
-
declare const VERSION = "0.
|
|
1669
|
+
declare const VERSION = "0.8.0";
|
|
1614
1670
|
|
|
1615
1671
|
/**
|
|
1616
1672
|
* Verify `BillKit-Signature: t=<unix>,v1=<hex>` headers.
|
|
@@ -1642,4 +1698,4 @@ interface VerifyWebhookOptions {
|
|
|
1642
1698
|
}
|
|
1643
1699
|
declare function verifyWebhookSignature<T = unknown>(options: VerifyWebhookOptions): Promise<T>;
|
|
1644
1700
|
|
|
1645
|
-
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
|
@@ -166,7 +166,10 @@ var Products = class extends BaseResource {
|
|
|
166
166
|
create(params) {
|
|
167
167
|
return this.post("/v1/products", params);
|
|
168
168
|
}
|
|
169
|
-
/**
|
|
169
|
+
/**
|
|
170
|
+
* Expandable: `prices` (every price on the product), `stats`, and
|
|
171
|
+
* `default_price` (the price `default_price_id` names).
|
|
172
|
+
*/
|
|
170
173
|
retrieve(id, options = {}) {
|
|
171
174
|
return this.get(`/v1/products/${p(id)}`, options);
|
|
172
175
|
}
|
|
@@ -260,6 +263,16 @@ var OneShotPayments = class extends BaseResource {
|
|
|
260
263
|
retrieve(id) {
|
|
261
264
|
return this.get(`/v1/checkout/one_shot/${p(id)}`);
|
|
262
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
|
+
}
|
|
263
276
|
};
|
|
264
277
|
var Subscriptions = class extends BaseResource {
|
|
265
278
|
/** Expandable: `customer`, `price`, `refund_eligibility`. */
|
|
@@ -772,7 +785,20 @@ var AuditLogs = class extends BaseResource {
|
|
|
772
785
|
}
|
|
773
786
|
};
|
|
774
787
|
var Payments = class extends BaseResource {
|
|
775
|
-
/**
|
|
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
|
+
*/
|
|
776
802
|
retrieve(id, options = {}) {
|
|
777
803
|
return this.get(`/v1/payments/${p(id)}`, options);
|
|
778
804
|
}
|
|
@@ -971,7 +997,7 @@ function sleep(ms) {
|
|
|
971
997
|
}
|
|
972
998
|
|
|
973
999
|
// src/version.ts
|
|
974
|
-
var VERSION = "0.
|
|
1000
|
+
var VERSION = "0.8.0";
|
|
975
1001
|
|
|
976
1002
|
// src/transport.ts
|
|
977
1003
|
var DEFAULT_BASE_URL = "https://api.billkit.eu";
|