@billkit-eu/sdk 0.7.1 → 0.8.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/CHANGELOG.md +23 -1
- package/README.md +6 -2
- package/dist/index.cjs +25 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +66 -15
- package/dist/index.d.ts +66 -15
- package/dist/index.js +25 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/resources.ts +72 -13
- 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
|
}
|
|
@@ -391,8 +406,11 @@ interface CreateProductParams extends IdempotencyOptions {
|
|
|
391
406
|
}
|
|
392
407
|
interface UpdateProductParams extends IdempotencyOptions {
|
|
393
408
|
name?: string;
|
|
394
|
-
|
|
395
|
-
|
|
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;
|
|
411
|
+
/** `null` empties the list. 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. */
|
|
412
|
+
marketing_features?: string[] | null;
|
|
413
|
+
/** Replaces the stored object whole; send `{}` to empty it. */
|
|
396
414
|
metadata?: Record<string, string>;
|
|
397
415
|
/** Set false to stop selling a product without deleting history. */
|
|
398
416
|
active?: boolean;
|
|
@@ -423,6 +441,9 @@ interface UpdateProductParams extends IdempotencyOptions {
|
|
|
423
441
|
* the price is still `"unspecified"` and never changed again, because
|
|
424
442
|
* flipping it would restate whether tax was inside or on top of an amount
|
|
425
443
|
* somebody has already paid.
|
|
444
|
+
*
|
|
445
|
+
* Only the two refund windows accept `null`, which clears the price's
|
|
446
|
+
* override. The API refuses a `null` on any other field here with a 400.
|
|
426
447
|
*/
|
|
427
448
|
interface UpdatePriceParams extends IdempotencyOptions {
|
|
428
449
|
/** `false` withdraws the price from sale, `true` puts it back. */
|
|
@@ -433,9 +454,13 @@ interface UpdatePriceParams extends IdempotencyOptions {
|
|
|
433
454
|
/** Read when a checkout opens. At least one entry. */
|
|
434
455
|
payment_methods?: Array<"creditcard" | "directdebit" | "ideal" | "eps" | "applepay" | "paypal" | (string & {})>;
|
|
435
456
|
refund_on_cancel?: "none" | "full" | "prorated";
|
|
436
|
-
/**
|
|
437
|
-
|
|
438
|
-
|
|
457
|
+
/**
|
|
458
|
+
* `0` disables refunds for that charge type; `N > 0` is an N-day window.
|
|
459
|
+
* `null` drops the price's override. 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.
|
|
460
|
+
*/
|
|
461
|
+
refund_window_initial_days?: number | null;
|
|
462
|
+
/** As {@link UpdatePriceParams.refund_window_initial_days}, for renewals. */
|
|
463
|
+
refund_window_renewal_days?: number | null;
|
|
439
464
|
}
|
|
440
465
|
/**
|
|
441
466
|
* One band of a tiered price.
|
|
@@ -744,7 +769,8 @@ interface CreateWebhookEndpointParams extends IdempotencyOptions {
|
|
|
744
769
|
interface UpdateWebhookEndpointParams extends IdempotencyOptions {
|
|
745
770
|
url?: string;
|
|
746
771
|
enabled_events?: string[];
|
|
747
|
-
|
|
772
|
+
/** 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. */
|
|
773
|
+
description?: string | null;
|
|
748
774
|
status?: string;
|
|
749
775
|
}
|
|
750
776
|
interface EventsListParams extends BaseListParams {
|
|
@@ -786,10 +812,14 @@ interface CreateCouponParams extends IdempotencyOptions {
|
|
|
786
812
|
}
|
|
787
813
|
interface UpdateCouponParams extends IdempotencyOptions {
|
|
788
814
|
active?: boolean;
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
815
|
+
/** `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. */
|
|
816
|
+
max_redemptions?: number | null;
|
|
817
|
+
/** 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. */
|
|
818
|
+
redeem_by?: number | null;
|
|
819
|
+
/** `null` lifts the price restriction. 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. */
|
|
820
|
+
applies_to_price_ids?: string[] | null;
|
|
821
|
+
/** `null` lifts the minimum. 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. */
|
|
822
|
+
min_amount_cents?: number | null;
|
|
793
823
|
}
|
|
794
824
|
interface ValidateCouponParams {
|
|
795
825
|
code: string;
|
|
@@ -814,7 +844,8 @@ interface CreateTaxRateParams extends IdempotencyOptions {
|
|
|
814
844
|
}
|
|
815
845
|
interface UpdateTaxRateParams extends IdempotencyOptions {
|
|
816
846
|
rate_basis_points?: number;
|
|
817
|
-
|
|
847
|
+
/** 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. */
|
|
848
|
+
display_name?: string | null;
|
|
818
849
|
inclusive?: boolean;
|
|
819
850
|
active?: boolean;
|
|
820
851
|
}
|
|
@@ -1048,6 +1079,13 @@ declare class OneShotPayments extends BaseResource {
|
|
|
1048
1079
|
/** Create a one-off charge; returns the object with a `redirect_url`. */
|
|
1049
1080
|
create<T = unknown>(params: CreateOneShotPaymentParams): Promise<T>;
|
|
1050
1081
|
retrieve<T = unknown>(id: string): Promise<T>;
|
|
1082
|
+
/** List one-off charges, newest first. Filter by `customer_id` and `status`. */
|
|
1083
|
+
list<T = unknown>(params?: OneShotPaymentsListParams): Promise<ListResponseEnvelope<T>>;
|
|
1084
|
+
iter<T = unknown>(options?: {
|
|
1085
|
+
pageSize?: number;
|
|
1086
|
+
customer_id?: string;
|
|
1087
|
+
status?: string;
|
|
1088
|
+
}): AsyncIterableIterator<T>;
|
|
1051
1089
|
}
|
|
1052
1090
|
declare class Subscriptions extends BaseResource {
|
|
1053
1091
|
/** Expandable: `customer`, `price`, `refund_eligibility`. */
|
|
@@ -1469,7 +1507,20 @@ declare class AuditLogs extends BaseResource {
|
|
|
1469
1507
|
* refunds and disputes are separate flows.
|
|
1470
1508
|
*/
|
|
1471
1509
|
declare class Payments extends BaseResource {
|
|
1472
|
-
/**
|
|
1510
|
+
/**
|
|
1511
|
+
* Expandable: `customer`, `subscription`, `refund_eligibility`. The last
|
|
1512
|
+
* is retrieve-only (`list` refuses it with a `400`) and attaches
|
|
1513
|
+
* `refund_eligibility: { object: "refund_eligibility", eligible,
|
|
1514
|
+
* amount_cents, currency, days_remaining, window_ends_at, reason }`:
|
|
1515
|
+
* whether `refunds.create` for the remaining balance would succeed now,
|
|
1516
|
+
* applying the refund window and the price's refund policy, which
|
|
1517
|
+
* `amount_refundable_cents` does not. When `eligible` is false, `reason`
|
|
1518
|
+
* is one of `not_paid`, `unrefundable_type`, `window_expired`,
|
|
1519
|
+
* `fully_refunded`, `disputed`, `operation_pending` or
|
|
1520
|
+
* `plan_change_pending` (a plan change is settling: the full balance
|
|
1521
|
+
* cannot be refunded yet, a partial refund still can); treat any other
|
|
1522
|
+
* value as "not refundable".
|
|
1523
|
+
*/
|
|
1473
1524
|
retrieve<T = unknown>(id: string, options?: ExpandOptions): Promise<T>;
|
|
1474
1525
|
/**
|
|
1475
1526
|
* Fetch the provider's own record of this charge, live.
|
|
@@ -1626,7 +1677,7 @@ declare class RateLimitError extends BillKitError {
|
|
|
1626
1677
|
});
|
|
1627
1678
|
}
|
|
1628
1679
|
|
|
1629
|
-
declare const VERSION = "0.
|
|
1680
|
+
declare const VERSION = "0.8.1";
|
|
1630
1681
|
|
|
1631
1682
|
/**
|
|
1632
1683
|
* Verify `BillKit-Signature: t=<unix>,v1=<hex>` headers.
|
|
@@ -1658,4 +1709,4 @@ interface VerifyWebhookOptions {
|
|
|
1658
1709
|
}
|
|
1659
1710
|
declare function verifyWebhookSignature<T = unknown>(options: VerifyWebhookOptions): Promise<T>;
|
|
1660
1711
|
|
|
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 };
|
|
1712
|
+
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
|
}
|
|
@@ -391,8 +406,11 @@ interface CreateProductParams extends IdempotencyOptions {
|
|
|
391
406
|
}
|
|
392
407
|
interface UpdateProductParams extends IdempotencyOptions {
|
|
393
408
|
name?: string;
|
|
394
|
-
|
|
395
|
-
|
|
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;
|
|
411
|
+
/** `null` empties the list. 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. */
|
|
412
|
+
marketing_features?: string[] | null;
|
|
413
|
+
/** Replaces the stored object whole; send `{}` to empty it. */
|
|
396
414
|
metadata?: Record<string, string>;
|
|
397
415
|
/** Set false to stop selling a product without deleting history. */
|
|
398
416
|
active?: boolean;
|
|
@@ -423,6 +441,9 @@ interface UpdateProductParams extends IdempotencyOptions {
|
|
|
423
441
|
* the price is still `"unspecified"` and never changed again, because
|
|
424
442
|
* flipping it would restate whether tax was inside or on top of an amount
|
|
425
443
|
* somebody has already paid.
|
|
444
|
+
*
|
|
445
|
+
* Only the two refund windows accept `null`, which clears the price's
|
|
446
|
+
* override. The API refuses a `null` on any other field here with a 400.
|
|
426
447
|
*/
|
|
427
448
|
interface UpdatePriceParams extends IdempotencyOptions {
|
|
428
449
|
/** `false` withdraws the price from sale, `true` puts it back. */
|
|
@@ -433,9 +454,13 @@ interface UpdatePriceParams extends IdempotencyOptions {
|
|
|
433
454
|
/** Read when a checkout opens. At least one entry. */
|
|
434
455
|
payment_methods?: Array<"creditcard" | "directdebit" | "ideal" | "eps" | "applepay" | "paypal" | (string & {})>;
|
|
435
456
|
refund_on_cancel?: "none" | "full" | "prorated";
|
|
436
|
-
/**
|
|
437
|
-
|
|
438
|
-
|
|
457
|
+
/**
|
|
458
|
+
* `0` disables refunds for that charge type; `N > 0` is an N-day window.
|
|
459
|
+
* `null` drops the price's override. 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.
|
|
460
|
+
*/
|
|
461
|
+
refund_window_initial_days?: number | null;
|
|
462
|
+
/** As {@link UpdatePriceParams.refund_window_initial_days}, for renewals. */
|
|
463
|
+
refund_window_renewal_days?: number | null;
|
|
439
464
|
}
|
|
440
465
|
/**
|
|
441
466
|
* One band of a tiered price.
|
|
@@ -744,7 +769,8 @@ interface CreateWebhookEndpointParams extends IdempotencyOptions {
|
|
|
744
769
|
interface UpdateWebhookEndpointParams extends IdempotencyOptions {
|
|
745
770
|
url?: string;
|
|
746
771
|
enabled_events?: string[];
|
|
747
|
-
|
|
772
|
+
/** 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. */
|
|
773
|
+
description?: string | null;
|
|
748
774
|
status?: string;
|
|
749
775
|
}
|
|
750
776
|
interface EventsListParams extends BaseListParams {
|
|
@@ -786,10 +812,14 @@ interface CreateCouponParams extends IdempotencyOptions {
|
|
|
786
812
|
}
|
|
787
813
|
interface UpdateCouponParams extends IdempotencyOptions {
|
|
788
814
|
active?: boolean;
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
815
|
+
/** `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. */
|
|
816
|
+
max_redemptions?: number | null;
|
|
817
|
+
/** 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. */
|
|
818
|
+
redeem_by?: number | null;
|
|
819
|
+
/** `null` lifts the price restriction. 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. */
|
|
820
|
+
applies_to_price_ids?: string[] | null;
|
|
821
|
+
/** `null` lifts the minimum. 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. */
|
|
822
|
+
min_amount_cents?: number | null;
|
|
793
823
|
}
|
|
794
824
|
interface ValidateCouponParams {
|
|
795
825
|
code: string;
|
|
@@ -814,7 +844,8 @@ interface CreateTaxRateParams extends IdempotencyOptions {
|
|
|
814
844
|
}
|
|
815
845
|
interface UpdateTaxRateParams extends IdempotencyOptions {
|
|
816
846
|
rate_basis_points?: number;
|
|
817
|
-
|
|
847
|
+
/** 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. */
|
|
848
|
+
display_name?: string | null;
|
|
818
849
|
inclusive?: boolean;
|
|
819
850
|
active?: boolean;
|
|
820
851
|
}
|
|
@@ -1048,6 +1079,13 @@ declare class OneShotPayments extends BaseResource {
|
|
|
1048
1079
|
/** Create a one-off charge; returns the object with a `redirect_url`. */
|
|
1049
1080
|
create<T = unknown>(params: CreateOneShotPaymentParams): Promise<T>;
|
|
1050
1081
|
retrieve<T = unknown>(id: string): Promise<T>;
|
|
1082
|
+
/** List one-off charges, newest first. Filter by `customer_id` and `status`. */
|
|
1083
|
+
list<T = unknown>(params?: OneShotPaymentsListParams): Promise<ListResponseEnvelope<T>>;
|
|
1084
|
+
iter<T = unknown>(options?: {
|
|
1085
|
+
pageSize?: number;
|
|
1086
|
+
customer_id?: string;
|
|
1087
|
+
status?: string;
|
|
1088
|
+
}): AsyncIterableIterator<T>;
|
|
1051
1089
|
}
|
|
1052
1090
|
declare class Subscriptions extends BaseResource {
|
|
1053
1091
|
/** Expandable: `customer`, `price`, `refund_eligibility`. */
|
|
@@ -1469,7 +1507,20 @@ declare class AuditLogs extends BaseResource {
|
|
|
1469
1507
|
* refunds and disputes are separate flows.
|
|
1470
1508
|
*/
|
|
1471
1509
|
declare class Payments extends BaseResource {
|
|
1472
|
-
/**
|
|
1510
|
+
/**
|
|
1511
|
+
* Expandable: `customer`, `subscription`, `refund_eligibility`. The last
|
|
1512
|
+
* is retrieve-only (`list` refuses it with a `400`) and attaches
|
|
1513
|
+
* `refund_eligibility: { object: "refund_eligibility", eligible,
|
|
1514
|
+
* amount_cents, currency, days_remaining, window_ends_at, reason }`:
|
|
1515
|
+
* whether `refunds.create` for the remaining balance would succeed now,
|
|
1516
|
+
* applying the refund window and the price's refund policy, which
|
|
1517
|
+
* `amount_refundable_cents` does not. When `eligible` is false, `reason`
|
|
1518
|
+
* is one of `not_paid`, `unrefundable_type`, `window_expired`,
|
|
1519
|
+
* `fully_refunded`, `disputed`, `operation_pending` or
|
|
1520
|
+
* `plan_change_pending` (a plan change is settling: the full balance
|
|
1521
|
+
* cannot be refunded yet, a partial refund still can); treat any other
|
|
1522
|
+
* value as "not refundable".
|
|
1523
|
+
*/
|
|
1473
1524
|
retrieve<T = unknown>(id: string, options?: ExpandOptions): Promise<T>;
|
|
1474
1525
|
/**
|
|
1475
1526
|
* Fetch the provider's own record of this charge, live.
|
|
@@ -1626,7 +1677,7 @@ declare class RateLimitError extends BillKitError {
|
|
|
1626
1677
|
});
|
|
1627
1678
|
}
|
|
1628
1679
|
|
|
1629
|
-
declare const VERSION = "0.
|
|
1680
|
+
declare const VERSION = "0.8.1";
|
|
1630
1681
|
|
|
1631
1682
|
/**
|
|
1632
1683
|
* Verify `BillKit-Signature: t=<unix>,v1=<hex>` headers.
|
|
@@ -1658,4 +1709,4 @@ interface VerifyWebhookOptions {
|
|
|
1658
1709
|
}
|
|
1659
1710
|
declare function verifyWebhookSignature<T = unknown>(options: VerifyWebhookOptions): Promise<T>;
|
|
1660
1711
|
|
|
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 };
|
|
1712
|
+
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
|
-
/**
|
|
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.
|
|
1000
|
+
var VERSION = "0.8.1";
|
|
978
1001
|
|
|
979
1002
|
// src/transport.ts
|
|
980
1003
|
var DEFAULT_BASE_URL = "https://api.billkit.eu";
|