@billkit-eu/sdk 0.4.0 → 0.6.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 +64 -1
- package/README.md +10 -6
- package/dist/index.cjs +17 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -7
- package/dist/index.d.ts +39 -7
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/resources.ts +58 -6
- package/src/version.ts +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -420,7 +420,7 @@ interface CreatePriceParams extends IdempotencyOptions {
|
|
|
420
420
|
metadata?: Record<string, string>;
|
|
421
421
|
trial_days?: number;
|
|
422
422
|
trial_verification_cents?: number;
|
|
423
|
-
payment_methods?: Array<"creditcard" | "directdebit" | "ideal" | "applepay" | (string & {})>;
|
|
423
|
+
payment_methods?: Array<"creditcard" | "directdebit" | "ideal" | "eps" | "applepay" | "paypal" | (string & {})>;
|
|
424
424
|
/**
|
|
425
425
|
* What a cancellation refunds without being asked. `"none"` (the default)
|
|
426
426
|
* nothing; `"full"` the whole last charge; `"prorated"` the unused part
|
|
@@ -531,8 +531,14 @@ interface CreateCheckoutSessionParams extends IdempotencyOptions {
|
|
|
531
531
|
* Pin the Mollie payment method. `undefined` lets Mollie pick from
|
|
532
532
|
* the customer's available methods; when set, must be in the price's
|
|
533
533
|
* `payment_methods` allowlist.
|
|
534
|
+
*
|
|
535
|
+
* Subscription-starting only, so this is deliberately NARROWER than the
|
|
536
|
+
* one-shot union: `bancontact` and `banktransfer` are absent because
|
|
537
|
+
* neither can mint the mandate a renewal needs. Mollie refuses the
|
|
538
|
+
* latter outright with "The payment method does not support sequence
|
|
539
|
+
* type".
|
|
534
540
|
*/
|
|
535
|
-
method?: "creditcard" | "directdebit" | "ideal" | "applepay" | (string & {});
|
|
541
|
+
method?: "creditcard" | "directdebit" | "ideal" | "eps" | "applepay" | "paypal" | (string & {});
|
|
536
542
|
/** Optional coupon code applied at checkout; atomically claimed. */
|
|
537
543
|
coupon_code?: string;
|
|
538
544
|
/**
|
|
@@ -588,8 +594,12 @@ interface CreateOneShotPaymentParams extends IdempotencyOptions {
|
|
|
588
594
|
/**
|
|
589
595
|
* Concrete Mollie method to charge with. Required, because a one-shot commits
|
|
590
596
|
* up front). Validated against the tenant's capability allowlist for
|
|
591
|
-
* `currency`; one-off methods like `bancontact
|
|
592
|
-
* even though they can't back a subscription.
|
|
597
|
+
* `currency`; one-off methods like `bancontact` and `banktransfer` are
|
|
598
|
+
* allowed here even though they can't back a subscription.
|
|
599
|
+
*
|
|
600
|
+
* `banktransfer` settles in DAYS, not seconds: the payer is handed bank
|
|
601
|
+
* details and Mollie holds the payment `open` for about a fortnight. Expect
|
|
602
|
+
* `one_shot_payment.paid` long after the call returns.
|
|
593
603
|
*
|
|
594
604
|
* `giropay` was removed: the scheme shut down at the end of 2024 and the
|
|
595
605
|
* server now 422s it. The `(string & {})` tail keeps this open on
|
|
@@ -597,7 +607,7 @@ interface CreateOneShotPaymentParams extends IdempotencyOptions {
|
|
|
597
607
|
* *request* type the server validates, so an SDK that lags a newly-added
|
|
598
608
|
* method should not be the thing that blocks the call.
|
|
599
609
|
*/
|
|
600
|
-
method: "creditcard" | "directdebit" | "ideal" | "bancontact" | "eps" | "applepay" | (string & {});
|
|
610
|
+
method: "creditcard" | "directdebit" | "ideal" | "bancontact" | "eps" | "applepay" | "paypal" | "banktransfer" | (string & {});
|
|
601
611
|
/** Where Mollie returns the payer after the hosted checkout. */
|
|
602
612
|
success_url: string;
|
|
603
613
|
/** Optional page for an abandoned/cancelled payment. */
|
|
@@ -700,9 +710,18 @@ interface UpdateTaxRateParams extends IdempotencyOptions {
|
|
|
700
710
|
inclusive?: boolean;
|
|
701
711
|
active?: boolean;
|
|
702
712
|
}
|
|
713
|
+
/**
|
|
714
|
+
* `auditLogs.list` params. All four filters match exactly and combine.
|
|
715
|
+
*
|
|
716
|
+
* `resource_type` narrows to a kind (`"customer"`, `"price"`);
|
|
717
|
+
* `resource_id` narrows to one row, which is the "everything that ever
|
|
718
|
+
* happened to this customer" question an audit log mostly exists for.
|
|
719
|
+
* Pair them or use `resource_id` alone — ids are already unique.
|
|
720
|
+
*/
|
|
703
721
|
interface AuditLogsListParams extends BaseListParams {
|
|
704
722
|
action?: string;
|
|
705
723
|
resource_type?: string;
|
|
724
|
+
resource_id?: string;
|
|
706
725
|
actor_id?: string;
|
|
707
726
|
}
|
|
708
727
|
/**
|
|
@@ -1025,6 +1044,18 @@ declare class WebhookEndpoints extends BaseResource {
|
|
|
1025
1044
|
pageSize?: number;
|
|
1026
1045
|
}): AsyncIterableIterator<T>;
|
|
1027
1046
|
/** Fetch one delivery row for inspection before deciding to redeliver. */
|
|
1047
|
+
retrieveDelivery<T = unknown>(endpointId: string, deliveryId: string): Promise<T>;
|
|
1048
|
+
/**
|
|
1049
|
+
* @deprecated Renamed to {@link WebhookEndpoints.retrieveDelivery}.
|
|
1050
|
+
*
|
|
1051
|
+
* Every other single-row fetch in every BillKit SDK is `retrieve`; this
|
|
1052
|
+
* one method was `get`, which meant reaching for the obvious name and
|
|
1053
|
+
* getting a type error. The python and php clients already spell it
|
|
1054
|
+
* `retrieve_delivery` / `retrieveDelivery`, so node was the outlier.
|
|
1055
|
+
*
|
|
1056
|
+
* Kept as an alias because removing it would break callers for a naming
|
|
1057
|
+
* preference. It will go in the next major.
|
|
1058
|
+
*/
|
|
1028
1059
|
getDelivery<T = unknown>(endpointId: string, deliveryId: string): Promise<T>;
|
|
1029
1060
|
/**
|
|
1030
1061
|
* Re-enqueue a delivery row for the dispatcher.
|
|
@@ -1202,6 +1233,7 @@ declare class AuditLogs extends BaseResource {
|
|
|
1202
1233
|
pageSize?: number;
|
|
1203
1234
|
action?: string;
|
|
1204
1235
|
resource_type?: string;
|
|
1236
|
+
resource_id?: string;
|
|
1205
1237
|
actor_id?: string;
|
|
1206
1238
|
}): AsyncIterableIterator<T>;
|
|
1207
1239
|
}
|
|
@@ -1318,7 +1350,7 @@ declare class RateLimitError extends BillKitError {
|
|
|
1318
1350
|
});
|
|
1319
1351
|
}
|
|
1320
1352
|
|
|
1321
|
-
declare const VERSION = "0.
|
|
1353
|
+
declare const VERSION = "0.6.0";
|
|
1322
1354
|
|
|
1323
1355
|
/**
|
|
1324
1356
|
* Verify `BillKit-Signature: t=<unix>,v1=<hex>` headers.
|
|
@@ -1350,4 +1382,4 @@ interface VerifyWebhookOptions {
|
|
|
1350
1382
|
}
|
|
1351
1383
|
declare function verifyWebhookSignature<T = unknown>(options: VerifyWebhookOptions): Promise<T>;
|
|
1352
1384
|
|
|
1353
|
-
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, 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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -420,7 +420,7 @@ interface CreatePriceParams extends IdempotencyOptions {
|
|
|
420
420
|
metadata?: Record<string, string>;
|
|
421
421
|
trial_days?: number;
|
|
422
422
|
trial_verification_cents?: number;
|
|
423
|
-
payment_methods?: Array<"creditcard" | "directdebit" | "ideal" | "applepay" | (string & {})>;
|
|
423
|
+
payment_methods?: Array<"creditcard" | "directdebit" | "ideal" | "eps" | "applepay" | "paypal" | (string & {})>;
|
|
424
424
|
/**
|
|
425
425
|
* What a cancellation refunds without being asked. `"none"` (the default)
|
|
426
426
|
* nothing; `"full"` the whole last charge; `"prorated"` the unused part
|
|
@@ -531,8 +531,14 @@ interface CreateCheckoutSessionParams extends IdempotencyOptions {
|
|
|
531
531
|
* Pin the Mollie payment method. `undefined` lets Mollie pick from
|
|
532
532
|
* the customer's available methods; when set, must be in the price's
|
|
533
533
|
* `payment_methods` allowlist.
|
|
534
|
+
*
|
|
535
|
+
* Subscription-starting only, so this is deliberately NARROWER than the
|
|
536
|
+
* one-shot union: `bancontact` and `banktransfer` are absent because
|
|
537
|
+
* neither can mint the mandate a renewal needs. Mollie refuses the
|
|
538
|
+
* latter outright with "The payment method does not support sequence
|
|
539
|
+
* type".
|
|
534
540
|
*/
|
|
535
|
-
method?: "creditcard" | "directdebit" | "ideal" | "applepay" | (string & {});
|
|
541
|
+
method?: "creditcard" | "directdebit" | "ideal" | "eps" | "applepay" | "paypal" | (string & {});
|
|
536
542
|
/** Optional coupon code applied at checkout; atomically claimed. */
|
|
537
543
|
coupon_code?: string;
|
|
538
544
|
/**
|
|
@@ -588,8 +594,12 @@ interface CreateOneShotPaymentParams extends IdempotencyOptions {
|
|
|
588
594
|
/**
|
|
589
595
|
* Concrete Mollie method to charge with. Required, because a one-shot commits
|
|
590
596
|
* up front). Validated against the tenant's capability allowlist for
|
|
591
|
-
* `currency`; one-off methods like `bancontact
|
|
592
|
-
* even though they can't back a subscription.
|
|
597
|
+
* `currency`; one-off methods like `bancontact` and `banktransfer` are
|
|
598
|
+
* allowed here even though they can't back a subscription.
|
|
599
|
+
*
|
|
600
|
+
* `banktransfer` settles in DAYS, not seconds: the payer is handed bank
|
|
601
|
+
* details and Mollie holds the payment `open` for about a fortnight. Expect
|
|
602
|
+
* `one_shot_payment.paid` long after the call returns.
|
|
593
603
|
*
|
|
594
604
|
* `giropay` was removed: the scheme shut down at the end of 2024 and the
|
|
595
605
|
* server now 422s it. The `(string & {})` tail keeps this open on
|
|
@@ -597,7 +607,7 @@ interface CreateOneShotPaymentParams extends IdempotencyOptions {
|
|
|
597
607
|
* *request* type the server validates, so an SDK that lags a newly-added
|
|
598
608
|
* method should not be the thing that blocks the call.
|
|
599
609
|
*/
|
|
600
|
-
method: "creditcard" | "directdebit" | "ideal" | "bancontact" | "eps" | "applepay" | (string & {});
|
|
610
|
+
method: "creditcard" | "directdebit" | "ideal" | "bancontact" | "eps" | "applepay" | "paypal" | "banktransfer" | (string & {});
|
|
601
611
|
/** Where Mollie returns the payer after the hosted checkout. */
|
|
602
612
|
success_url: string;
|
|
603
613
|
/** Optional page for an abandoned/cancelled payment. */
|
|
@@ -700,9 +710,18 @@ interface UpdateTaxRateParams extends IdempotencyOptions {
|
|
|
700
710
|
inclusive?: boolean;
|
|
701
711
|
active?: boolean;
|
|
702
712
|
}
|
|
713
|
+
/**
|
|
714
|
+
* `auditLogs.list` params. All four filters match exactly and combine.
|
|
715
|
+
*
|
|
716
|
+
* `resource_type` narrows to a kind (`"customer"`, `"price"`);
|
|
717
|
+
* `resource_id` narrows to one row, which is the "everything that ever
|
|
718
|
+
* happened to this customer" question an audit log mostly exists for.
|
|
719
|
+
* Pair them or use `resource_id` alone — ids are already unique.
|
|
720
|
+
*/
|
|
703
721
|
interface AuditLogsListParams extends BaseListParams {
|
|
704
722
|
action?: string;
|
|
705
723
|
resource_type?: string;
|
|
724
|
+
resource_id?: string;
|
|
706
725
|
actor_id?: string;
|
|
707
726
|
}
|
|
708
727
|
/**
|
|
@@ -1025,6 +1044,18 @@ declare class WebhookEndpoints extends BaseResource {
|
|
|
1025
1044
|
pageSize?: number;
|
|
1026
1045
|
}): AsyncIterableIterator<T>;
|
|
1027
1046
|
/** Fetch one delivery row for inspection before deciding to redeliver. */
|
|
1047
|
+
retrieveDelivery<T = unknown>(endpointId: string, deliveryId: string): Promise<T>;
|
|
1048
|
+
/**
|
|
1049
|
+
* @deprecated Renamed to {@link WebhookEndpoints.retrieveDelivery}.
|
|
1050
|
+
*
|
|
1051
|
+
* Every other single-row fetch in every BillKit SDK is `retrieve`; this
|
|
1052
|
+
* one method was `get`, which meant reaching for the obvious name and
|
|
1053
|
+
* getting a type error. The python and php clients already spell it
|
|
1054
|
+
* `retrieve_delivery` / `retrieveDelivery`, so node was the outlier.
|
|
1055
|
+
*
|
|
1056
|
+
* Kept as an alias because removing it would break callers for a naming
|
|
1057
|
+
* preference. It will go in the next major.
|
|
1058
|
+
*/
|
|
1028
1059
|
getDelivery<T = unknown>(endpointId: string, deliveryId: string): Promise<T>;
|
|
1029
1060
|
/**
|
|
1030
1061
|
* Re-enqueue a delivery row for the dispatcher.
|
|
@@ -1202,6 +1233,7 @@ declare class AuditLogs extends BaseResource {
|
|
|
1202
1233
|
pageSize?: number;
|
|
1203
1234
|
action?: string;
|
|
1204
1235
|
resource_type?: string;
|
|
1236
|
+
resource_id?: string;
|
|
1205
1237
|
actor_id?: string;
|
|
1206
1238
|
}): AsyncIterableIterator<T>;
|
|
1207
1239
|
}
|
|
@@ -1318,7 +1350,7 @@ declare class RateLimitError extends BillKitError {
|
|
|
1318
1350
|
});
|
|
1319
1351
|
}
|
|
1320
1352
|
|
|
1321
|
-
declare const VERSION = "0.
|
|
1353
|
+
declare const VERSION = "0.6.0";
|
|
1322
1354
|
|
|
1323
1355
|
/**
|
|
1324
1356
|
* Verify `BillKit-Signature: t=<unix>,v1=<hex>` headers.
|
|
@@ -1350,4 +1382,4 @@ interface VerifyWebhookOptions {
|
|
|
1350
1382
|
}
|
|
1351
1383
|
declare function verifyWebhookSignature<T = unknown>(options: VerifyWebhookOptions): Promise<T>;
|
|
1352
1384
|
|
|
1353
|
-
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, 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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -460,9 +460,23 @@ var WebhookEndpoints = class extends BaseResource {
|
|
|
460
460
|
);
|
|
461
461
|
}
|
|
462
462
|
/** Fetch one delivery row for inspection before deciding to redeliver. */
|
|
463
|
-
|
|
463
|
+
retrieveDelivery(endpointId, deliveryId) {
|
|
464
464
|
return this.get(`/v1/webhook_endpoints/${endpointId}/deliveries/${deliveryId}`);
|
|
465
465
|
}
|
|
466
|
+
/**
|
|
467
|
+
* @deprecated Renamed to {@link WebhookEndpoints.retrieveDelivery}.
|
|
468
|
+
*
|
|
469
|
+
* Every other single-row fetch in every BillKit SDK is `retrieve`; this
|
|
470
|
+
* one method was `get`, which meant reaching for the obvious name and
|
|
471
|
+
* getting a type error. The python and php clients already spell it
|
|
472
|
+
* `retrieve_delivery` / `retrieveDelivery`, so node was the outlier.
|
|
473
|
+
*
|
|
474
|
+
* Kept as an alias because removing it would break callers for a naming
|
|
475
|
+
* preference. It will go in the next major.
|
|
476
|
+
*/
|
|
477
|
+
getDelivery(endpointId, deliveryId) {
|
|
478
|
+
return this.retrieveDelivery(endpointId, deliveryId);
|
|
479
|
+
}
|
|
466
480
|
/**
|
|
467
481
|
* Re-enqueue a delivery row for the dispatcher.
|
|
468
482
|
*
|
|
@@ -672,6 +686,7 @@ var AuditLogs = class extends BaseResource {
|
|
|
672
686
|
filters: {
|
|
673
687
|
action: options.action,
|
|
674
688
|
resource_type: options.resource_type,
|
|
689
|
+
resource_id: options.resource_id,
|
|
675
690
|
actor_id: options.actor_id
|
|
676
691
|
}
|
|
677
692
|
});
|
|
@@ -835,7 +850,7 @@ function sleep(ms) {
|
|
|
835
850
|
}
|
|
836
851
|
|
|
837
852
|
// src/version.ts
|
|
838
|
-
var VERSION = "0.
|
|
853
|
+
var VERSION = "0.6.0";
|
|
839
854
|
|
|
840
855
|
// src/transport.ts
|
|
841
856
|
var DEFAULT_BASE_URL = "https://api.billkit.eu";
|