@boelabs/billete-sdk 5.0.0 → 6.0.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/README.md +3 -3
- package/dist/client.d.ts +3 -3
- package/dist/client.js +2 -2
- package/dist/{errors-CGHiFrlh.d.ts → errors-DuKEl7b6.d.ts} +2 -2
- package/dist/{events-D09DIgn-.d.ts → events-DCYMRhVr.d.ts} +2 -1
- package/dist/{http-D5FMIjK4.js → http-CjvNSEg5.js} +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +11 -3
- package/dist/webhooks.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ Crea una clave secreta en el dashboard (**Desarrolladores → Claves API**) y gu
|
|
|
63
63
|
```ts
|
|
64
64
|
import { createBillete } from "@boelabs/billete-sdk";
|
|
65
65
|
|
|
66
|
-
const billete = createBillete({ apiVersion: "2026-10-
|
|
66
|
+
const billete = createBillete({ apiVersion: "2026-10-19", environment: "test" });
|
|
67
67
|
|
|
68
68
|
const checkout = await billete.checkouts.create({
|
|
69
69
|
plan: "plan_…",
|
|
@@ -91,7 +91,7 @@ solicite expresamente. En carritos, solo ofrece los demás métodos que todos lo
|
|
|
91
91
|
|
|
92
92
|
```ts
|
|
93
93
|
const billete = createBillete({
|
|
94
|
-
apiVersion: "2026-10-
|
|
94
|
+
apiVersion: "2026-10-19",
|
|
95
95
|
environment: "production",
|
|
96
96
|
apiKey: process.env.BILLETE_API_KEY,
|
|
97
97
|
timeoutMs: 30_000,
|
|
@@ -257,7 +257,7 @@ return { token: session.token };
|
|
|
257
257
|
// Navegador
|
|
258
258
|
import { createClient } from "@boelabs/billete-sdk/client";
|
|
259
259
|
|
|
260
|
-
const billete = createClient({ apiVersion: "2026-10-
|
|
260
|
+
const billete = createClient({ apiVersion: "2026-10-19", customerSession: token });
|
|
261
261
|
|
|
262
262
|
const { data: subscriptions } = await billete.customer.subscriptions();
|
|
263
263
|
const tokens = await billete.customer.feature("tokens");
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as ProductCheckoutCreate, A as CustomerUpdate, At as PublicPaymentState, B as InvoiceCreate, Bt as apiVersionLifecycle, C as CouponUpdate, Ct as PublicCheckout, D as CustomerMemberCreate, Dt as PublicFulfillment, E as CustomerInput, Et as PublicClaimSummary, F as FeatureUpdate, Ft as ApiVersion, G as PlanCheckoutCreate, Gt as supportedApiVersions, H as KEY_PATTERN, Ht as currentApiVersion, I as FulfillmentDeliverInput, It as ApiVersionLifecycle, J as PlanFeaturesInput, K as PlanCouponCreate, L as FulfillmentHandoverInput, Lt as ApiVersionStage, M as FeatureCreate, Mt as API_VERSIONS, N as FeatureOperationCommit, Nt as API_VERSION_HEADER, O as CustomerMemberUpdate, Ot as PublicInvoice, P as FeatureOperationCreate, Pt as API_VERSION_PATTERN, Q as PortalSessionCreate, R as FulfillmentInput, Rt as LATEST_API_VERSION, S as CouponCreate, St as PortalFeatures, T as CustomerCreate, Tt as PublicClaim, U as PaymentLinkCreate, Ut as isApiVersion, V as InvoiceLineInput, Vt as apiVersionStage, W as PaymentLinkUpdate, Wt as isApiVersionRetired, X as PlanPriceInput, Y as PlanLinkCreate, Z as PlanUpdate, _ as ClientPaymentCode, _t as PaymentInstructions, a as AfterCompletionInput, at as RetireInput, b as ClientSubscriptionUpdate, bt as PaymentNextAction, c as ClaimResolve, ct as SubscriptionChangePreviewInput, d as ClientCheckoutUpdate, dt as VariantInput, et as ProductCouponCreate, f as ClientClaimCreate, ft as WebhookEndpointCreate, g as ClientLinkCheckout, gt as FulfillmentOption, h as ClientInvoicePay, ht as CustomerSubscriptionChangeResult, i as TransportOptions, it as RefundCreate, j as EventSelector, jt as PublicPortal, k as CustomerSessionCreate, kt as PublicPaymentLink, l as ClaimRespond, lt as SubscriptionCreate, m as ClientFulfillmentProblem, mt as CustomerSubscription, n as BilleteErrorCode, nt as ProductLinkCreate, o as CheckoutCreate, ot as SubscriptionCancel, p as ClientCustomerClaimCreate, pt as WebhookEndpointUpdate, q as PlanCreate, r as RequestOptions, rt as ProductUpdate, s as CheckoutItemInput, st as SubscriptionChangeCreate, t as BilleteError, tt as ProductCreate, u as ClientCheckoutPay, ut as SubscriptionUpdate, v as ClientSubscriptionCancel, vt as PaymentMethodField, w as CustomFieldInput, wt as PublicCheckoutItem, x as CollectInput, xt as PaymentTestScenario, y as ClientSubscriptionSeats, yt as PaymentMethodOption, z as FulfillmentTrackingInput, zt as LatestApiVersion } from "./errors-
|
|
2
|
-
import { $ as FulfillmentMethod, $t as PaymentFailureCode, A as Coupon, An as tokenEnvironment, At as ResetFrequency, B as ExchangeRate, Bt as SubscriptionRenewal, C as CheckoutPurpose, Cn as findBank, Ct as PortalSession, D as ClaimReason, Dn as ENVIRONMENTS, Dt as RESET_FREQUENCIES, E as ClaimOutcome, En as nationalPhone, Et as ProductVariant, F as CustomerFeature, Ft as SubmitLabel, G as FeatureOperation, Gt as Weekday, H as FULFILLMENT_METHODS, Ht as SubscriptionTerms, I as CustomerMember, It as Subscription, J as FeatureType, Jt as API_ERROR_TYPES, K as FeatureOperationResult, Kt as ReceiptReference, L as CustomerMemberList, Lt as SubscriptionChange, M as CustomField, Mt as RiskLevel, N as Customer, Nt as SUBMIT_LABELS, O as ClaimStatus, On as Environment, Ot as RISK_LEVELS, P as CustomerDetails, Pt as SUBSCRIPTION_STATUSES, Q as FulfillmentHandover, Qt as PAYMENT_FAILURE_CODES, R as CustomerSession, Rt as SubscriptionChangePreview, S as CheckoutItem, Sn as VENEZUELAN_BANKS, St as PlanSeats, T as ClaimMessage, Tn as isMobilePhone, Tt as ProductCategory, U as FULFILLMENT_STATUSES, Ut as USAGE_FEATURE_TYPES, V as FEATURE_TYPES, Vt as SubscriptionStatus, W as Feature, Wt as WebhookEndpoint, X as Fulfillment, Xt as ApiErrorEnvelope, Y as FeatureUsageResult, Yt as ApiErrorBody, Z as FulfillmentChoice, Zt as ApiErrorType, _ as CLAIM_STATUSES, _n as Metadata, _t as PaymentStatus, a as WEBHOOK_TEST_EVENT, an as BILLING_MONTHS, at as InvoiceReason, b as CarrierOffice, bn as TaxBehavior, bt as PlanFeatureValues, c as AfterCompletion, cn as CURRENCIES, ct as MAX_SEATS, d as CANCELLATION_FEEDBACK, dn as GracePeriodDays, dt as Payment, en as API_ERROR_CODES, et as FulfillmentStatus, f as CARRIERS, fn as List, ft as PaymentAttempt, g as CLAIM_REASONS, gn as MOBILE_PREFIXES, gt as PaymentSettlement, h as CLAIM_OUTCOMES, hn as MAX_QUANTITY, ht as PaymentLink, i as SubscribableEventType, in as AddressInput, it as Invoice, j as CurrencyAvailability, jn as tokenPrefix, jt as Retirement, k as CollectSettings, kn as TokenKind, kt as Refund, l as Balance, ln as Currency, lt as PAYMENT_STATUSES, m as CHECKOUT_PURPOSES, mn as ListSort, mt as PaymentFeeDetails, n as EventDataMap, nn as ACCOUNT_NUMBER_LENGTH, nt as INVOICE_REASONS, o as WebhookEvent, on as BankCode, ot as InvoiceStatus, p as CARRIER_TEST_SCENARIOS, pn as ListQuery, pt as PaymentFailure, q as FeatureReset, qt as ReceiptSend, r as EventType, rn as Address, rt as INVOICE_STATUSES, s as Actor, sn as BillingMonths, st as LineItem, t as EVENT_TYPES, tn as ApiErrorCode, tt as FulfillmentTracking, u as BalanceAmount, un as GRACE_PERIOD_DAYS, ut as PRODUCT_CATEGORIES, v as CancellationFeedback, vn as MobilePrefix, vt as Payout, w as Claim, wn as isLandlinePhone, wt as Product, x as Checkout, xn as Timestamp, xt as PlanPrice, y as Carrier, yn as TAX_BEHAVIORS, yt as Plan, z as Event, zt as SubscriptionChangeResult } from "./events-
|
|
1
|
+
import { $ as ProductCheckoutCreate, A as CustomerUpdate, At as PublicPaymentState, B as InvoiceCreate, Bt as apiVersionLifecycle, C as CouponUpdate, Ct as PublicCheckout, D as CustomerMemberCreate, Dt as PublicFulfillment, E as CustomerInput, Et as PublicClaimSummary, F as FeatureUpdate, Ft as ApiVersion, G as PlanCheckoutCreate, Gt as supportedApiVersions, H as KEY_PATTERN, Ht as currentApiVersion, I as FulfillmentDeliverInput, It as ApiVersionLifecycle, J as PlanFeaturesInput, K as PlanCouponCreate, L as FulfillmentHandoverInput, Lt as ApiVersionStage, M as FeatureCreate, Mt as API_VERSIONS, N as FeatureOperationCommit, Nt as API_VERSION_HEADER, O as CustomerMemberUpdate, Ot as PublicInvoice, P as FeatureOperationCreate, Pt as API_VERSION_PATTERN, Q as PortalSessionCreate, R as FulfillmentInput, Rt as LATEST_API_VERSION, S as CouponCreate, St as PortalFeatures, T as CustomerCreate, Tt as PublicClaim, U as PaymentLinkCreate, Ut as isApiVersion, V as InvoiceLineInput, Vt as apiVersionStage, W as PaymentLinkUpdate, Wt as isApiVersionRetired, X as PlanPriceInput, Y as PlanLinkCreate, Z as PlanUpdate, _ as ClientPaymentCode, _t as PaymentInstructions, a as AfterCompletionInput, at as RetireInput, b as ClientSubscriptionUpdate, bt as PaymentNextAction, c as ClaimResolve, ct as SubscriptionChangePreviewInput, d as ClientCheckoutUpdate, dt as VariantInput, et as ProductCouponCreate, f as ClientClaimCreate, ft as WebhookEndpointCreate, g as ClientLinkCheckout, gt as FulfillmentOption, h as ClientInvoicePay, ht as CustomerSubscriptionChangeResult, i as TransportOptions, it as RefundCreate, j as EventSelector, jt as PublicPortal, k as CustomerSessionCreate, kt as PublicPaymentLink, l as ClaimRespond, lt as SubscriptionCreate, m as ClientFulfillmentProblem, mt as CustomerSubscription, n as BilleteErrorCode, nt as ProductLinkCreate, o as CheckoutCreate, ot as SubscriptionCancel, p as ClientCustomerClaimCreate, pt as WebhookEndpointUpdate, q as PlanCreate, r as RequestOptions, rt as ProductUpdate, s as CheckoutItemInput, st as SubscriptionChangeCreate, t as BilleteError, tt as ProductCreate, u as ClientCheckoutPay, ut as SubscriptionUpdate, v as ClientSubscriptionCancel, vt as PaymentMethodField, w as CustomFieldInput, wt as PublicCheckoutItem, x as CollectInput, xt as PaymentTestScenario, y as ClientSubscriptionSeats, yt as PaymentMethodOption, z as FulfillmentTrackingInput, zt as LatestApiVersion } from "./errors-DuKEl7b6.js";
|
|
2
|
+
import { $ as FulfillmentMethod, $t as PaymentFailureCode, A as Coupon, An as tokenEnvironment, At as ResetFrequency, B as ExchangeRate, Bt as SubscriptionRenewal, C as CheckoutPurpose, Cn as findBank, Ct as PortalSession, D as ClaimReason, Dn as ENVIRONMENTS, Dt as RESET_FREQUENCIES, E as ClaimOutcome, En as nationalPhone, Et as ProductVariant, F as CustomerFeature, Ft as SubmitLabel, G as FeatureOperation, Gt as Weekday, H as FULFILLMENT_METHODS, Ht as SubscriptionTerms, I as CustomerMember, It as Subscription, J as FeatureType, Jt as API_ERROR_TYPES, K as FeatureOperationResult, Kt as ReceiptReference, L as CustomerMemberList, Lt as SubscriptionChange, M as CustomField, Mt as RiskLevel, N as Customer, Nt as SUBMIT_LABELS, O as ClaimStatus, On as Environment, Ot as RISK_LEVELS, P as CustomerDetails, Pt as SUBSCRIPTION_STATUSES, Q as FulfillmentHandover, Qt as PAYMENT_FAILURE_CODES, R as CustomerSession, Rt as SubscriptionChangePreview, S as CheckoutItem, Sn as VENEZUELAN_BANKS, St as PlanSeats, T as ClaimMessage, Tn as isMobilePhone, Tt as ProductCategory, U as FULFILLMENT_STATUSES, Ut as USAGE_FEATURE_TYPES, V as FEATURE_TYPES, Vt as SubscriptionStatus, W as Feature, Wt as WebhookEndpoint, X as Fulfillment, Xt as ApiErrorEnvelope, Y as FeatureUsageResult, Yt as ApiErrorBody, Z as FulfillmentChoice, Zt as ApiErrorType, _ as CLAIM_STATUSES, _n as Metadata, _t as PaymentStatus, a as WEBHOOK_TEST_EVENT, an as BILLING_MONTHS, at as InvoiceReason, b as CarrierOffice, bn as TaxBehavior, bt as PlanFeatureValues, c as AfterCompletion, cn as CURRENCIES, ct as MAX_SEATS, d as CANCELLATION_FEEDBACK, dn as GracePeriodDays, dt as Payment, en as API_ERROR_CODES, et as FulfillmentStatus, f as CARRIERS, fn as List, ft as PaymentAttempt, g as CLAIM_REASONS, gn as MOBILE_PREFIXES, gt as PaymentSettlement, h as CLAIM_OUTCOMES, hn as MAX_QUANTITY, ht as PaymentLink, i as SubscribableEventType, in as AddressInput, it as Invoice, j as CurrencyAvailability, jn as tokenPrefix, jt as Retirement, k as CollectSettings, kn as TokenKind, kt as Refund, l as Balance, ln as Currency, lt as PAYMENT_STATUSES, m as CHECKOUT_PURPOSES, mn as ListSort, mt as PaymentFeeDetails, n as EventDataMap, nn as ACCOUNT_NUMBER_LENGTH, nt as INVOICE_REASONS, o as WebhookEvent, on as BankCode, ot as InvoiceStatus, p as CARRIER_TEST_SCENARIOS, pn as ListQuery, pt as PaymentFailure, q as FeatureReset, qt as ReceiptSend, r as EventType, rn as Address, rt as INVOICE_STATUSES, s as Actor, sn as BillingMonths, st as LineItem, t as EVENT_TYPES, tn as ApiErrorCode, tt as FulfillmentTracking, u as BalanceAmount, un as GRACE_PERIOD_DAYS, ut as PRODUCT_CATEGORIES, v as CancellationFeedback, vn as MobilePrefix, vt as Payout, w as Claim, wn as isLandlinePhone, wt as Product, x as Checkout, xn as Timestamp, xt as PlanPrice, y as Carrier, yn as TAX_BEHAVIORS, yt as Plan, z as Event, zt as SubscriptionChangeResult } from "./events-DCYMRhVr.js";
|
|
3
3
|
//#region src/create-client.d.ts
|
|
4
4
|
interface ClientOptions extends TransportOptions {
|
|
5
5
|
/**
|
|
@@ -14,7 +14,7 @@ interface ClientOptions extends TransportOptions {
|
|
|
14
14
|
* and customer data requires a short-lived customer session minted by your server.
|
|
15
15
|
*
|
|
16
16
|
* ```ts
|
|
17
|
-
* const billete = createClient({ apiVersion: "2026-10-
|
|
17
|
+
* const billete = createClient({ apiVersion: "2026-10-19", customerSession: token });
|
|
18
18
|
* const [subscription] = (await billete.customer.subscriptions()).data;
|
|
19
19
|
* if (subscription?.renewal?.status === "overdue") showBanner(subscription.renewal);
|
|
20
20
|
* ```
|
package/dist/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as segment, r as BilleteError, t as createTransport } from "./http-
|
|
1
|
+
import { n as segment, r as BilleteError, t as createTransport } from "./http-CjvNSEg5.js";
|
|
2
2
|
//#region src/create-client.ts
|
|
3
3
|
/**
|
|
4
4
|
* Browser client. It never holds a secret key: checkouts and Cobros are addressed by their
|
|
@@ -6,7 +6,7 @@ import { n as segment, r as BilleteError, t as createTransport } from "./http-D5
|
|
|
6
6
|
* and customer data requires a short-lived customer session minted by your server.
|
|
7
7
|
*
|
|
8
8
|
* ```ts
|
|
9
|
-
* const billete = createClient({ apiVersion: "2026-10-
|
|
9
|
+
* const billete = createClient({ apiVersion: "2026-10-19", customerSession: token });
|
|
10
10
|
* const [subscription] = (await billete.customer.subscriptions()).data;
|
|
11
11
|
* if (subscription?.renewal?.status === "overdue") showBanner(subscription.renewal);
|
|
12
12
|
* ```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as FulfillmentMethod, $t as PaymentFailureCode, C as CheckoutPurpose, D as ClaimReason, E as ClaimOutcome, Ft as SubmitLabel, It as Subscription, Kt as ReceiptReference, M as CustomField, O as ClaimStatus, On as Environment, P as CustomerDetails, S as CheckoutItem, St as PlanSeats, T as ClaimMessage, Tt as ProductCategory, X as Fulfillment, Yt as ApiErrorBody, Zt as ApiErrorType, _n as Metadata, _t as PaymentStatus, at as InvoiceReason, b as CarrierOffice, bn as TaxBehavior, c as AfterCompletion, dn as GracePeriodDays, et as FulfillmentStatus, i as SubscribableEventType, in as AddressInput, k as CollectSettings, kt as Refund, ln as Currency, ot as InvoiceStatus, pt as PaymentFailure, q as FeatureReset, rn as Address, sn as BillingMonths, st as LineItem, tn as ApiErrorCode, tt as FulfillmentTracking, v as CancellationFeedback, xn as Timestamp, xt as PlanPrice, y as Carrier } from "./events-
|
|
1
|
+
import { $ as FulfillmentMethod, $t as PaymentFailureCode, C as CheckoutPurpose, D as ClaimReason, E as ClaimOutcome, Ft as SubmitLabel, It as Subscription, Kt as ReceiptReference, M as CustomField, O as ClaimStatus, On as Environment, P as CustomerDetails, S as CheckoutItem, St as PlanSeats, T as ClaimMessage, Tt as ProductCategory, X as Fulfillment, Yt as ApiErrorBody, Zt as ApiErrorType, _n as Metadata, _t as PaymentStatus, at as InvoiceReason, b as CarrierOffice, bn as TaxBehavior, c as AfterCompletion, dn as GracePeriodDays, et as FulfillmentStatus, i as SubscribableEventType, in as AddressInput, k as CollectSettings, kt as Refund, ln as Currency, ot as InvoiceStatus, pt as PaymentFailure, q as FeatureReset, rn as Address, sn as BillingMonths, st as LineItem, tn as ApiErrorCode, tt as FulfillmentTracking, v as CancellationFeedback, xn as Timestamp, xt as PlanPrice, y as Carrier } from "./events-DCYMRhVr.js";
|
|
2
2
|
//#region ../contracts/src/api-versions.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Billete API versions. Kept free of runtime dependencies: the dashboard, the API, the worker and
|
|
@@ -10,7 +10,7 @@ import { $ as FulfillmentMethod, $t as PaymentFailureCode, C as CheckoutPurpose,
|
|
|
10
10
|
* that is still supported.
|
|
11
11
|
*/
|
|
12
12
|
/** Every version ever published, oldest first. Append only: retired versions stay listed. */
|
|
13
|
-
declare const API_VERSIONS: readonly ["2026-10-07.beta", "2026-10-08", "2026-10-09", "2026-10-10", "2026-10-16"];
|
|
13
|
+
declare const API_VERSIONS: readonly ["2026-10-07.beta", "2026-10-08", "2026-10-09", "2026-10-10", "2026-10-16", "2026-10-19"];
|
|
14
14
|
type ApiVersion = (typeof API_VERSIONS)[number];
|
|
15
15
|
type LatestApiVersion = typeof API_VERSIONS extends readonly [...unknown[], infer Last] ? Last : never;
|
|
16
16
|
/** The version the code speaks: responses are built in its shape. Always the last entry. */
|
|
@@ -294,6 +294,7 @@ declare const API_ERROR_CODES: {
|
|
|
294
294
|
readonly coupon_exists: "Ya existe un cupón con ese código.";
|
|
295
295
|
readonly coupon_expired: "El cupón venció.";
|
|
296
296
|
readonly coupon_first_purchase_only: "Este cupón es solo para tu primera compra.";
|
|
297
|
+
readonly coupon_in_use: "Este cupón ya se usó o está en uso: desactívalo en vez de eliminarlo.";
|
|
297
298
|
readonly coupon_inactive: "El cupón está desactivado.";
|
|
298
299
|
readonly coupon_minimum_not_met: "El pedido no llega a la compra mínima del cupón.";
|
|
299
300
|
readonly coupon_not_applicable: "Un cupón no aplica a puestos agregados a mitad del periodo.";
|
|
@@ -311,7 +312,7 @@ declare const API_ERROR_CODES: {
|
|
|
311
312
|
readonly email_required: "El correo es obligatorio.";
|
|
312
313
|
readonly entity_not_applicable: "Elige primero un tipo de organización con RIF propio.";
|
|
313
314
|
readonly event_not_found: "No existe el evento.";
|
|
314
|
-
readonly exchange_rate_changed: "
|
|
315
|
+
readonly exchange_rate_changed: "El `amount` enviado ya no es el que se cobra (venció la tasa BCV congelada o cambió el total): consulta de nuevo los métodos y muestra el nuevo monto.";
|
|
315
316
|
readonly exchange_rate_unavailable: "No hay una tasa oficial vigente para ese par de monedas; inténtalo en unos minutos.";
|
|
316
317
|
readonly fallback_plan_nested: "Un plan usado como respaldo no puede tener otro respaldo.";
|
|
317
318
|
readonly fallback_plan_not_free: "El respaldo debe ser un plan gratuito activo, en la misma moneda y sin respaldo propio.";
|
|
@@ -18,7 +18,7 @@ var BilleteError = class extends Error {
|
|
|
18
18
|
};
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/http.ts
|
|
21
|
-
const SDK_VERSION = "
|
|
21
|
+
const SDK_VERSION = "6.0.0";
|
|
22
22
|
const DEFAULT_BASE_URL = "https://api.billete.run";
|
|
23
23
|
const RETRYABLE_STATUS = /* @__PURE__ */ new Set([
|
|
24
24
|
429,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as ProductCheckoutCreate, A as CustomerUpdate, At as PublicPaymentState, B as InvoiceCreate, Bt as apiVersionLifecycle, C as CouponUpdate, Ct as PublicCheckout, D as CustomerMemberCreate, Dt as PublicFulfillment, E as CustomerInput, Et as PublicClaimSummary, F as FeatureUpdate, Ft as ApiVersion, G as PlanCheckoutCreate, Gt as supportedApiVersions, H as KEY_PATTERN, Ht as currentApiVersion, I as FulfillmentDeliverInput, It as ApiVersionLifecycle, J as PlanFeaturesInput, K as PlanCouponCreate, L as FulfillmentHandoverInput, Lt as ApiVersionStage, M as FeatureCreate, Mt as API_VERSIONS, N as FeatureOperationCommit, Nt as API_VERSION_HEADER, O as CustomerMemberUpdate, Ot as PublicInvoice, P as FeatureOperationCreate, Pt as API_VERSION_PATTERN, Q as PortalSessionCreate, R as FulfillmentInput, Rt as LATEST_API_VERSION, S as CouponCreate, St as PortalFeatures, T as CustomerCreate, Tt as PublicClaim, U as PaymentLinkCreate, Ut as isApiVersion, V as InvoiceLineInput, Vt as apiVersionStage, W as PaymentLinkUpdate, Wt as isApiVersionRetired, X as PlanPriceInput, Y as PlanLinkCreate, Z as PlanUpdate, _ as ClientPaymentCode, _t as PaymentInstructions, a as AfterCompletionInput, at as RetireInput, b as ClientSubscriptionUpdate, bt as PaymentNextAction, c as ClaimResolve, ct as SubscriptionChangePreviewInput, d as ClientCheckoutUpdate, dt as VariantInput, et as ProductCouponCreate, f as ClientClaimCreate, ft as WebhookEndpointCreate, g as ClientLinkCheckout, gt as FulfillmentOption, h as ClientInvoicePay, ht as CustomerSubscriptionChangeResult, i as TransportOptions, it as RefundCreate, j as EventSelector, jt as PublicPortal, k as CustomerSessionCreate, kt as PublicPaymentLink, l as ClaimRespond, lt as SubscriptionCreate, m as ClientFulfillmentProblem, mt as CustomerSubscription, n as BilleteErrorCode, nt as ProductLinkCreate, o as CheckoutCreate, ot as SubscriptionCancel, p as ClientCustomerClaimCreate, pt as WebhookEndpointUpdate, q as PlanCreate, r as RequestOptions, rt as ProductUpdate, s as CheckoutItemInput, st as SubscriptionChangeCreate, t as BilleteError, tt as ProductCreate, u as ClientCheckoutPay, ut as SubscriptionUpdate, v as ClientSubscriptionCancel, vt as PaymentMethodField, w as CustomFieldInput, wt as PublicCheckoutItem, x as CollectInput, xt as PaymentTestScenario, y as ClientSubscriptionSeats, yt as PaymentMethodOption, z as FulfillmentTrackingInput, zt as LatestApiVersion } from "./errors-
|
|
2
|
-
import { $ as FulfillmentMethod, $t as PaymentFailureCode, A as Coupon, An as tokenEnvironment, At as ResetFrequency, B as ExchangeRate, Bt as SubscriptionRenewal, C as CheckoutPurpose, Cn as findBank, Ct as PortalSession, D as ClaimReason, Dn as ENVIRONMENTS, Dt as RESET_FREQUENCIES, E as ClaimOutcome, En as nationalPhone, Et as ProductVariant, F as CustomerFeature, Ft as SubmitLabel, G as FeatureOperation, Gt as Weekday, H as FULFILLMENT_METHODS, Ht as SubscriptionTerms, I as CustomerMember, It as Subscription, J as FeatureType, Jt as API_ERROR_TYPES, K as FeatureOperationResult, Kt as ReceiptReference, L as CustomerMemberList, Lt as SubscriptionChange, M as CustomField, Mt as RiskLevel, N as Customer, Nt as SUBMIT_LABELS, O as ClaimStatus, On as Environment, Ot as RISK_LEVELS, P as CustomerDetails, Pt as SUBSCRIPTION_STATUSES, Q as FulfillmentHandover, Qt as PAYMENT_FAILURE_CODES, R as CustomerSession, Rt as SubscriptionChangePreview, S as CheckoutItem, Sn as VENEZUELAN_BANKS, St as PlanSeats, T as ClaimMessage, Tn as isMobilePhone, Tt as ProductCategory, U as FULFILLMENT_STATUSES, Ut as USAGE_FEATURE_TYPES, V as FEATURE_TYPES, Vt as SubscriptionStatus, W as Feature, Wt as WebhookEndpoint, X as Fulfillment, Xt as ApiErrorEnvelope, Y as FeatureUsageResult, Yt as ApiErrorBody, Z as FulfillmentChoice, Zt as ApiErrorType, _ as CLAIM_STATUSES, _n as Metadata, _t as PaymentStatus, a as WEBHOOK_TEST_EVENT, an as BILLING_MONTHS, at as InvoiceReason, b as CarrierOffice, bn as TaxBehavior, bt as PlanFeatureValues, c as AfterCompletion, cn as CURRENCIES, ct as MAX_SEATS, d as CANCELLATION_FEEDBACK, dn as GracePeriodDays, dt as Payment, en as API_ERROR_CODES, et as FulfillmentStatus, f as CARRIERS, fn as List, ft as PaymentAttempt, g as CLAIM_REASONS, gn as MOBILE_PREFIXES, gt as PaymentSettlement, h as CLAIM_OUTCOMES, hn as MAX_QUANTITY, ht as PaymentLink, i as SubscribableEventType, in as AddressInput, it as Invoice, j as CurrencyAvailability, jn as tokenPrefix, jt as Retirement, k as CollectSettings, kn as TokenKind, kt as Refund, l as Balance, ln as Currency, lt as PAYMENT_STATUSES, m as CHECKOUT_PURPOSES, mn as ListSort, mt as PaymentFeeDetails, n as EventDataMap, nn as ACCOUNT_NUMBER_LENGTH, nt as INVOICE_REASONS, o as WebhookEvent, on as BankCode, ot as InvoiceStatus, p as CARRIER_TEST_SCENARIOS, pn as ListQuery, pt as PaymentFailure, q as FeatureReset, qt as ReceiptSend, r as EventType, rn as Address, rt as INVOICE_STATUSES, s as Actor, sn as BillingMonths, st as LineItem, t as EVENT_TYPES, tn as ApiErrorCode, tt as FulfillmentTracking, u as BalanceAmount, un as GRACE_PERIOD_DAYS, ut as PRODUCT_CATEGORIES, v as CancellationFeedback, vn as MobilePrefix, vt as Payout, w as Claim, wn as isLandlinePhone, wt as Product, x as Checkout, xn as Timestamp, xt as PlanPrice, y as Carrier, yn as TAX_BEHAVIORS, yt as Plan, z as Event, zt as SubscriptionChangeResult } from "./events-
|
|
1
|
+
import { $ as ProductCheckoutCreate, A as CustomerUpdate, At as PublicPaymentState, B as InvoiceCreate, Bt as apiVersionLifecycle, C as CouponUpdate, Ct as PublicCheckout, D as CustomerMemberCreate, Dt as PublicFulfillment, E as CustomerInput, Et as PublicClaimSummary, F as FeatureUpdate, Ft as ApiVersion, G as PlanCheckoutCreate, Gt as supportedApiVersions, H as KEY_PATTERN, Ht as currentApiVersion, I as FulfillmentDeliverInput, It as ApiVersionLifecycle, J as PlanFeaturesInput, K as PlanCouponCreate, L as FulfillmentHandoverInput, Lt as ApiVersionStage, M as FeatureCreate, Mt as API_VERSIONS, N as FeatureOperationCommit, Nt as API_VERSION_HEADER, O as CustomerMemberUpdate, Ot as PublicInvoice, P as FeatureOperationCreate, Pt as API_VERSION_PATTERN, Q as PortalSessionCreate, R as FulfillmentInput, Rt as LATEST_API_VERSION, S as CouponCreate, St as PortalFeatures, T as CustomerCreate, Tt as PublicClaim, U as PaymentLinkCreate, Ut as isApiVersion, V as InvoiceLineInput, Vt as apiVersionStage, W as PaymentLinkUpdate, Wt as isApiVersionRetired, X as PlanPriceInput, Y as PlanLinkCreate, Z as PlanUpdate, _ as ClientPaymentCode, _t as PaymentInstructions, a as AfterCompletionInput, at as RetireInput, b as ClientSubscriptionUpdate, bt as PaymentNextAction, c as ClaimResolve, ct as SubscriptionChangePreviewInput, d as ClientCheckoutUpdate, dt as VariantInput, et as ProductCouponCreate, f as ClientClaimCreate, ft as WebhookEndpointCreate, g as ClientLinkCheckout, gt as FulfillmentOption, h as ClientInvoicePay, ht as CustomerSubscriptionChangeResult, i as TransportOptions, it as RefundCreate, j as EventSelector, jt as PublicPortal, k as CustomerSessionCreate, kt as PublicPaymentLink, l as ClaimRespond, lt as SubscriptionCreate, m as ClientFulfillmentProblem, mt as CustomerSubscription, n as BilleteErrorCode, nt as ProductLinkCreate, o as CheckoutCreate, ot as SubscriptionCancel, p as ClientCustomerClaimCreate, pt as WebhookEndpointUpdate, q as PlanCreate, r as RequestOptions, rt as ProductUpdate, s as CheckoutItemInput, st as SubscriptionChangeCreate, t as BilleteError, tt as ProductCreate, u as ClientCheckoutPay, ut as SubscriptionUpdate, v as ClientSubscriptionCancel, vt as PaymentMethodField, w as CustomFieldInput, wt as PublicCheckoutItem, x as CollectInput, xt as PaymentTestScenario, y as ClientSubscriptionSeats, yt as PaymentMethodOption, z as FulfillmentTrackingInput, zt as LatestApiVersion } from "./errors-DuKEl7b6.js";
|
|
2
|
+
import { $ as FulfillmentMethod, $t as PaymentFailureCode, A as Coupon, An as tokenEnvironment, At as ResetFrequency, B as ExchangeRate, Bt as SubscriptionRenewal, C as CheckoutPurpose, Cn as findBank, Ct as PortalSession, D as ClaimReason, Dn as ENVIRONMENTS, Dt as RESET_FREQUENCIES, E as ClaimOutcome, En as nationalPhone, Et as ProductVariant, F as CustomerFeature, Ft as SubmitLabel, G as FeatureOperation, Gt as Weekday, H as FULFILLMENT_METHODS, Ht as SubscriptionTerms, I as CustomerMember, It as Subscription, J as FeatureType, Jt as API_ERROR_TYPES, K as FeatureOperationResult, Kt as ReceiptReference, L as CustomerMemberList, Lt as SubscriptionChange, M as CustomField, Mt as RiskLevel, N as Customer, Nt as SUBMIT_LABELS, O as ClaimStatus, On as Environment, Ot as RISK_LEVELS, P as CustomerDetails, Pt as SUBSCRIPTION_STATUSES, Q as FulfillmentHandover, Qt as PAYMENT_FAILURE_CODES, R as CustomerSession, Rt as SubscriptionChangePreview, S as CheckoutItem, Sn as VENEZUELAN_BANKS, St as PlanSeats, T as ClaimMessage, Tn as isMobilePhone, Tt as ProductCategory, U as FULFILLMENT_STATUSES, Ut as USAGE_FEATURE_TYPES, V as FEATURE_TYPES, Vt as SubscriptionStatus, W as Feature, Wt as WebhookEndpoint, X as Fulfillment, Xt as ApiErrorEnvelope, Y as FeatureUsageResult, Yt as ApiErrorBody, Z as FulfillmentChoice, Zt as ApiErrorType, _ as CLAIM_STATUSES, _n as Metadata, _t as PaymentStatus, a as WEBHOOK_TEST_EVENT, an as BILLING_MONTHS, at as InvoiceReason, b as CarrierOffice, bn as TaxBehavior, bt as PlanFeatureValues, c as AfterCompletion, cn as CURRENCIES, ct as MAX_SEATS, d as CANCELLATION_FEEDBACK, dn as GracePeriodDays, dt as Payment, en as API_ERROR_CODES, et as FulfillmentStatus, f as CARRIERS, fn as List, ft as PaymentAttempt, g as CLAIM_REASONS, gn as MOBILE_PREFIXES, gt as PaymentSettlement, h as CLAIM_OUTCOMES, hn as MAX_QUANTITY, ht as PaymentLink, i as SubscribableEventType, in as AddressInput, it as Invoice, j as CurrencyAvailability, jn as tokenPrefix, jt as Retirement, k as CollectSettings, kn as TokenKind, kt as Refund, l as Balance, ln as Currency, lt as PAYMENT_STATUSES, m as CHECKOUT_PURPOSES, mn as ListSort, mt as PaymentFeeDetails, n as EventDataMap, nn as ACCOUNT_NUMBER_LENGTH, nt as INVOICE_REASONS, o as WebhookEvent, on as BankCode, ot as InvoiceStatus, p as CARRIER_TEST_SCENARIOS, pn as ListQuery, pt as PaymentFailure, q as FeatureReset, qt as ReceiptSend, r as EventType, rn as Address, rt as INVOICE_STATUSES, s as Actor, sn as BillingMonths, st as LineItem, t as EVENT_TYPES, tn as ApiErrorCode, tt as FulfillmentTracking, u as BalanceAmount, un as GRACE_PERIOD_DAYS, ut as PRODUCT_CATEGORIES, v as CancellationFeedback, vn as MobilePrefix, vt as Payout, w as Claim, wn as isLandlinePhone, wt as Product, x as Checkout, xn as Timestamp, xt as PlanPrice, y as Carrier, yn as TAX_BEHAVIORS, yt as Plan, z as Event, zt as SubscriptionChangeResult } from "./events-DCYMRhVr.js";
|
|
3
3
|
import { WebhookVerificationError, verifyWebhook } from "./webhooks.js";
|
|
4
4
|
//#region src/server.d.ts
|
|
5
5
|
type Filters<T> = ListQuery & T;
|
|
@@ -25,7 +25,7 @@ interface BilleteOptions extends TransportOptions {
|
|
|
25
25
|
*
|
|
26
26
|
* ```ts
|
|
27
27
|
* // Reads BILLETE_API_KEY.
|
|
28
|
-
* const billete = createBillete({ apiVersion: "2026-10-
|
|
28
|
+
* const billete = createBillete({ apiVersion: "2026-10-19", environment: "test" });
|
|
29
29
|
* const { allowed } = await billete.features.consume("user_123", "tokens", 850);
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
@@ -165,6 +165,8 @@ export declare function createBillete(options: BilleteOptions): {
|
|
|
165
165
|
search?: string;
|
|
166
166
|
sort?: ListSort<"created" | "code">;
|
|
167
167
|
}>) => AsyncGenerator<Coupon, any, any>;
|
|
168
|
+
/** Only a coupon nobody used and nothing holds (`coupon_in_use`); deactivate the rest. */
|
|
169
|
+
delete: (id: string, options?: RequestOptions) => Promise<void>;
|
|
168
170
|
};
|
|
169
171
|
checkouts: {
|
|
170
172
|
create: (input: CheckoutCreate, options?: RequestOptions) => Promise<Checkout>;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as segment, r as BilleteError, t as createTransport } from "./http-
|
|
1
|
+
import { n as segment, r as BilleteError, t as createTransport } from "./http-CjvNSEg5.js";
|
|
2
2
|
import { WebhookVerificationError, verifyWebhook } from "./webhooks.js";
|
|
3
3
|
//#region ../contracts/src/environment.ts
|
|
4
4
|
/**
|
|
@@ -64,7 +64,7 @@ function fromEnv(name) {
|
|
|
64
64
|
*
|
|
65
65
|
* ```ts
|
|
66
66
|
* // Reads BILLETE_API_KEY.
|
|
67
|
-
* const billete = createBillete({ apiVersion: "2026-10-
|
|
67
|
+
* const billete = createBillete({ apiVersion: "2026-10-19", environment: "test" });
|
|
68
68
|
* const { allowed } = await billete.features.consume("user_123", "tokens", 850);
|
|
69
69
|
* ```
|
|
70
70
|
*/
|
|
@@ -145,7 +145,15 @@ create: (input, options) => http.request({
|
|
|
145
145
|
})
|
|
146
146
|
};
|
|
147
147
|
const plans = collection(http, "/v1/plans");
|
|
148
|
-
const coupons =
|
|
148
|
+
const coupons = {
|
|
149
|
+
...collection(http, "/v1/coupons"),
|
|
150
|
+
/** Only a coupon nobody used and nothing holds (`coupon_in_use`); deactivate the rest. */
|
|
151
|
+
delete: (id, options) => http.request({
|
|
152
|
+
method: "DELETE",
|
|
153
|
+
path: `/v1/coupons/${segment(id)}`,
|
|
154
|
+
options
|
|
155
|
+
})
|
|
156
|
+
};
|
|
149
157
|
const paymentLinks = {
|
|
150
158
|
...collection(http, "/v1/payment-links"),
|
|
151
159
|
retire: (id, input = {}, options) => http.request({
|
package/dist/webhooks.d.ts
CHANGED