@boelabs/billete-sdk 6.0.0 → 7.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 +8 -8
- package/dist/client.d.ts +4 -4
- package/dist/client.js +2 -2
- package/dist/{errors-DuKEl7b6.d.ts → errors-e_-7ZZmn.d.ts} +11 -8
- package/dist/{events-DCYMRhVr.d.ts → events-CWajoKsy.d.ts} +30 -22
- package/dist/{http-CjvNSEg5.js → http-Do9Fl8fk.js} +1 -1
- package/dist/index.d.ts +34 -15
- package/dist/index.js +40 -31
- 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-20", 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-20",
|
|
95
95
|
environment: "production",
|
|
96
96
|
apiKey: process.env.BILLETE_API_KEY,
|
|
97
97
|
timeoutMs: 30_000,
|
|
@@ -126,12 +126,12 @@ Todos los métodos devuelven promesas con el recurso tipado. Los recursos con li
|
|
|
126
126
|
| `customers` | — |
|
|
127
127
|
| `customerSessions` | `create` |
|
|
128
128
|
| `portalSessions` | `create` (enlace al portal del cliente, válido 60 minutos) |
|
|
129
|
-
| `products` | `
|
|
130
|
-
| `plans` |
|
|
131
|
-
| `features` | `check`, `isEnabled`, `listForCustomer`, `consume`, `release`, `set` |
|
|
132
|
-
| `coupons` |
|
|
129
|
+
| `products` | `delete`, `deleteVariant` |
|
|
130
|
+
| `plans` | `delete` |
|
|
131
|
+
| `features` | `delete`, `check`, `isEnabled`, `listForCustomer`, `consume`, `release`, `set` |
|
|
132
|
+
| `coupons` | `delete` |
|
|
133
133
|
| `checkouts` | `expire` |
|
|
134
|
-
| `paymentLinks` | `
|
|
134
|
+
| `paymentLinks` | `delete` |
|
|
135
135
|
| `invoices` | `void` (cobros: renovaciones y cobros sueltos, con página de pago en `url`) |
|
|
136
136
|
| `subscriptions` | `cancel`, `resume` |
|
|
137
137
|
| `payments` | `refund`, `listRefunds` |
|
|
@@ -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-20", 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
|
|
2
|
-
import { $ as
|
|
1
|
+
import { $ as ProductCheckoutCreate, A as CustomerUpdate, At as PublicPortal, B as InvoiceCreate, Bt as apiVersionStage, C as CouponUpdate, Ct as PublicCheckoutItem, D as CustomerMemberCreate, Dt as PublicInvoice, E as CustomerInput, Et as PublicFulfillment, F as FeatureUpdate, Ft as ApiVersionLifecycle, G as PlanCheckoutCreate, H as KEY_PATTERN, Ht as isApiVersion, I as FulfillmentDeliverInput, It as ApiVersionStage, J as PlanFeaturesInput, K as PlanCouponCreate, L as FulfillmentHandoverInput, Lt as LATEST_API_VERSION, M as FeatureCreate, Mt as API_VERSION_HEADER, N as FeatureOperationCommit, Nt as API_VERSION_PATTERN, O as CustomerMemberUpdate, Ot as PublicPaymentLink, P as FeatureOperationCreate, Pt as ApiVersion, Q as PortalSessionCreate, R as FulfillmentInput, Rt as LatestApiVersion, S as CouponCreate, St as PublicCheckout, T as CustomerCreate, Tt as PublicClaimSummary, U as PaymentLinkCreate, Ut as isApiVersionRetired, V as InvoiceLineInput, Vt as currentApiVersion, W as PaymentLinkUpdate, Wt as supportedApiVersions, X as PlanPriceInput, Y as PlanLinkCreate, Z as PlanUpdate, _ as ClientPaymentCode, _t as PaymentMethodField, a as AfterCompletionInput, at as SubscriptionCancel, b as ClientSubscriptionUpdate, bt as PaymentTestScenario, c as ClaimResolve, ct as SubscriptionCreate, d as ClientCheckoutUpdate, dt as WebhookEndpointCreate, et as ProductCouponCreate, f as ClientClaimCreate, ft as WebhookEndpointUpdate, g as ClientLinkCheckout, gt as PaymentInstructions, h as ClientInvoicePay, ht as FulfillmentOption, i as TransportOptions, it as RefundCreate, j as EventSelector, jt as API_VERSIONS, k as CustomerSessionCreate, kt as PublicPaymentState, l as ClaimRespond, lt as SubscriptionUpdate, m as ClientFulfillmentProblem, mt as CustomerSubscriptionChangeResult, n as BilleteErrorCode, nt as ProductLinkCreate, o as CheckoutCreate, ot as SubscriptionChangeCreate, p as ClientCustomerClaimCreate, pt as CustomerSubscription, q as PlanCreate, r as RequestOptions, rt as ProductUpdate, s as CheckoutItemInput, st as SubscriptionChangePreviewInput, t as BilleteError, tt as ProductCreate, u as ClientCheckoutPay, ut as VariantInput, v as ClientSubscriptionCancel, vt as PaymentMethodOption, w as CustomFieldInput, wt as PublicClaim, x as CollectInput, xt as PortalFeatures, y as ClientSubscriptionSeats, yt as PaymentNextAction, z as FulfillmentTrackingInput, zt as apiVersionLifecycle } from "./errors-e_-7ZZmn.js";
|
|
2
|
+
import { $ as FulfillmentHandover, $t as PaymentFailureCode, A as Coupon, An as tokenEnvironment, At as Refund, B as Event, Bt as SubscriptionRenewal, C as CheckoutPurpose, Cn as findBank, Ct as PlanSeats, D as ClaimReason, Dn as ENVIRONMENTS, Dt as ProductVariant, E as ClaimOutcome, En as nationalPhone, Et as ProductCategory, F as CustomerFeature, Ft as SubmitLabel, G as Feature, Gt as Weekday, H as FEATURE_TYPES, Ht as SubscriptionTerms, I as CustomerMember, It as Subscription, J as FeatureReset, Jt as API_ERROR_TYPES, K as FeatureOperation, 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 RESET_FREQUENCIES, P as CustomerDetails, Pt as SUBSCRIPTION_STATUSES, Q as FulfillmentChoice, Qt as PAYMENT_FAILURE_CODES, R as CustomerSession, Rt as SubscriptionChangePreview, S as CheckoutItem, Sn as VENEZUELAN_BANKS, St as PlanPrice, T as ClaimMessage, Tn as isMobilePhone, Tt as Product, U as FULFILLMENT_METHODS, Ut as USAGE_FEATURE_TYPES, V as ExchangeRate, Vt as SubscriptionStatus, W as FULFILLMENT_STATUSES, Wt as WebhookEndpoint, X as FeatureUsageResult, Xt as ApiErrorEnvelope, Y as FeatureType, Yt as ApiErrorBody, Z as Fulfillment, Zt as ApiErrorType, _ as CLAIM_STATUSES, _n as Metadata, _t as PaymentSettlement, a as WEBHOOK_TEST_EVENT, an as BILLING_MONTHS, at as Invoice, b as CarrierOffice, bn as TaxBehavior, bt as Plan, c as AfterCompletion, cn as CURRENCIES, ct as LineItem, d as CANCELLATION_FEEDBACK, dn as GracePeriodDays, dt as PRODUCT_CATEGORIES, en as API_ERROR_CODES, et as FulfillmentMethod, f as CARRIERS, fn as List, ft as Payment, g as CLAIM_REASONS, gn as MOBILE_PREFIXES, gt as PaymentLink, h as CLAIM_OUTCOMES, hn as MAX_QUANTITY, ht as PaymentFeeDetails, i as SubscribableEventType, in as AddressInput, it as INVOICE_STATUSES, j as CurrencyAvailability, jn as tokenPrefix, jt as ResetFrequency, k as CollectSettings, kn as TokenKind, kt as RISK_LEVELS, l as Balance, ln as Currency, lt as MAX_SEATS, m as CHECKOUT_PURPOSES, mn as ListSort, mt as PaymentFailure, n as EventDataMap, nn as ACCOUNT_NUMBER_LENGTH, nt as FulfillmentTracking, o as WebhookEvent, on as BankCode, ot as InvoiceReason, p as CARRIER_TEST_SCENARIOS, pn as ListQuery, pt as PaymentAttempt, q as FeatureOperationResult, qt as ReceiptSend, r as EventType, rn as Address, rt as INVOICE_REASONS, s as Actor, sn as BillingMonths, st as InvoiceStatus, t as EVENT_TYPES, tn as ApiErrorCode, tt as FulfillmentStatus, u as BalanceAmount, un as GRACE_PERIOD_DAYS, ut as PAYMENT_STATUSES, v as CancellationFeedback, vn as MobilePrefix, vt as PaymentStatus, w as Claim, wn as isLandlinePhone, wt as PortalSession, x as Checkout, xn as Timestamp, xt as PlanFeatureValues, y as Carrier, yn as TAX_BEHAVIORS, yt as Payout, z as Deletion, zt as SubscriptionChangeResult } from "./events-CWajoKsy.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-20", customerSession: token });
|
|
18
18
|
* const [subscription] = (await billete.customer.subscriptions()).data;
|
|
19
19
|
* if (subscription?.renewal?.status === "overdue") showBanner(subscription.renewal);
|
|
20
20
|
* ```
|
|
@@ -134,4 +134,4 @@ export declare function createClient(options: ClientOptions): {
|
|
|
134
134
|
};
|
|
135
135
|
type BilleteClient = ReturnType<typeof createClient>;
|
|
136
136
|
//#endregion
|
|
137
|
-
export { type ACCOUNT_NUMBER_LENGTH, type API_ERROR_CODES, type API_ERROR_TYPES, type API_VERSIONS, type API_VERSION_HEADER, type API_VERSION_PATTERN, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorCode, type ApiErrorEnvelope, type ApiErrorType, type ApiVersion, type ApiVersionLifecycle, type ApiVersionStage, type BILLING_MONTHS, type Balance, type BalanceAmount, type BankCode, type BilleteClient, BilleteError, type BilleteErrorCode, type BillingMonths, type CANCELLATION_FEEDBACK, type CARRIERS, type CARRIER_TEST_SCENARIOS, type CHECKOUT_PURPOSES, type CLAIM_OUTCOMES, type CLAIM_REASONS, type CLAIM_STATUSES, type CURRENCIES, type CancellationFeedback, type Carrier, type CarrierOffice, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPurpose, type Claim, type ClaimMessage, type ClaimOutcome, type ClaimReason, type ClaimResolve, type ClaimRespond, type ClaimStatus, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientClaimCreate, type ClientCustomerClaimCreate, type ClientFulfillmentProblem, type ClientInvoicePay, type ClientLinkCheckout, type ClientOptions, type ClientPaymentCode, type ClientSubscriptionCancel, type ClientSubscriptionSeats, type ClientSubscriptionUpdate, type CollectInput, type CollectSettings, type Coupon, type CouponCreate, type CouponUpdate, type Currency, type CurrencyAvailability, type CustomField, type CustomFieldInput, type Customer, type CustomerCreate, type CustomerDetails, type CustomerFeature, type CustomerInput, type CustomerMember, type CustomerMemberCreate, type CustomerMemberList, type CustomerMemberUpdate, type CustomerSession, type CustomerSessionCreate, type CustomerSubscription, type CustomerSubscriptionChangeResult, type CustomerUpdate, type ENVIRONMENTS, type EVENT_TYPES, type Environment, type Event, type EventDataMap, type EventSelector, type EventType, type ExchangeRate, type FEATURE_TYPES, type FULFILLMENT_METHODS, type FULFILLMENT_STATUSES, type Feature, type FeatureCreate, type FeatureOperation, type FeatureOperationCommit, type FeatureOperationCreate, type FeatureOperationResult, type FeatureReset, type FeatureType, type FeatureUpdate, type FeatureUsageResult, type Fulfillment, type FulfillmentChoice, type FulfillmentDeliverInput, type FulfillmentHandover, type FulfillmentHandoverInput, type FulfillmentInput, type FulfillmentMethod, type FulfillmentOption, type FulfillmentStatus, type FulfillmentTracking, type FulfillmentTrackingInput, type GRACE_PERIOD_DAYS, type GracePeriodDays, type INVOICE_REASONS, type INVOICE_STATUSES, type Invoice, type InvoiceCreate, type InvoiceLineInput, type InvoiceReason, type InvoiceStatus, type KEY_PATTERN, type LATEST_API_VERSION, type LatestApiVersion, type LineItem, type List, type ListQuery, type ListSort, type MAX_QUANTITY, type MAX_SEATS, type MOBILE_PREFIXES, type Metadata, type MobilePrefix, type PAYMENT_FAILURE_CODES, type PAYMENT_STATUSES, type PRODUCT_CATEGORIES, type Payment, type PaymentAttempt, type PaymentFailure, type PaymentFailureCode, type PaymentFeeDetails, type PaymentInstructions, type PaymentLink, type PaymentLinkCreate, type PaymentLinkUpdate, type PaymentMethodField, type PaymentMethodOption, type PaymentNextAction, type PaymentSettlement, type PaymentStatus, type PaymentTestScenario, type Payout, type Plan, type PlanCheckoutCreate, type PlanCouponCreate, type PlanCreate, type PlanFeatureValues, type PlanFeaturesInput, type PlanLinkCreate, type PlanPrice, type PlanPriceInput, type PlanSeats, type PlanUpdate, type PortalFeatures, type PortalSession, type PortalSessionCreate, type Product, type ProductCategory, type ProductCheckoutCreate, type ProductCouponCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicCheckoutItem, type PublicClaim, type PublicClaimSummary, type PublicFulfillment, type PublicInvoice, type PublicPaymentLink, type PublicPaymentState, type PublicPortal, type RESET_FREQUENCIES, type RISK_LEVELS, type ReceiptReference, type ReceiptSend, type Refund, type RefundCreate, type RequestOptions, type ResetFrequency, type
|
|
137
|
+
export { type ACCOUNT_NUMBER_LENGTH, type API_ERROR_CODES, type API_ERROR_TYPES, type API_VERSIONS, type API_VERSION_HEADER, type API_VERSION_PATTERN, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorCode, type ApiErrorEnvelope, type ApiErrorType, type ApiVersion, type ApiVersionLifecycle, type ApiVersionStage, type BILLING_MONTHS, type Balance, type BalanceAmount, type BankCode, type BilleteClient, BilleteError, type BilleteErrorCode, type BillingMonths, type CANCELLATION_FEEDBACK, type CARRIERS, type CARRIER_TEST_SCENARIOS, type CHECKOUT_PURPOSES, type CLAIM_OUTCOMES, type CLAIM_REASONS, type CLAIM_STATUSES, type CURRENCIES, type CancellationFeedback, type Carrier, type CarrierOffice, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPurpose, type Claim, type ClaimMessage, type ClaimOutcome, type ClaimReason, type ClaimResolve, type ClaimRespond, type ClaimStatus, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientClaimCreate, type ClientCustomerClaimCreate, type ClientFulfillmentProblem, type ClientInvoicePay, type ClientLinkCheckout, type ClientOptions, type ClientPaymentCode, type ClientSubscriptionCancel, type ClientSubscriptionSeats, type ClientSubscriptionUpdate, type CollectInput, type CollectSettings, type Coupon, type CouponCreate, type CouponUpdate, type Currency, type CurrencyAvailability, type CustomField, type CustomFieldInput, type Customer, type CustomerCreate, type CustomerDetails, type CustomerFeature, type CustomerInput, type CustomerMember, type CustomerMemberCreate, type CustomerMemberList, type CustomerMemberUpdate, type CustomerSession, type CustomerSessionCreate, type CustomerSubscription, type CustomerSubscriptionChangeResult, type CustomerUpdate, type Deletion, type ENVIRONMENTS, type EVENT_TYPES, type Environment, type Event, type EventDataMap, type EventSelector, type EventType, type ExchangeRate, type FEATURE_TYPES, type FULFILLMENT_METHODS, type FULFILLMENT_STATUSES, type Feature, type FeatureCreate, type FeatureOperation, type FeatureOperationCommit, type FeatureOperationCreate, type FeatureOperationResult, type FeatureReset, type FeatureType, type FeatureUpdate, type FeatureUsageResult, type Fulfillment, type FulfillmentChoice, type FulfillmentDeliverInput, type FulfillmentHandover, type FulfillmentHandoverInput, type FulfillmentInput, type FulfillmentMethod, type FulfillmentOption, type FulfillmentStatus, type FulfillmentTracking, type FulfillmentTrackingInput, type GRACE_PERIOD_DAYS, type GracePeriodDays, type INVOICE_REASONS, type INVOICE_STATUSES, type Invoice, type InvoiceCreate, type InvoiceLineInput, type InvoiceReason, type InvoiceStatus, type KEY_PATTERN, type LATEST_API_VERSION, type LatestApiVersion, type LineItem, type List, type ListQuery, type ListSort, type MAX_QUANTITY, type MAX_SEATS, type MOBILE_PREFIXES, type Metadata, type MobilePrefix, type PAYMENT_FAILURE_CODES, type PAYMENT_STATUSES, type PRODUCT_CATEGORIES, type Payment, type PaymentAttempt, type PaymentFailure, type PaymentFailureCode, type PaymentFeeDetails, type PaymentInstructions, type PaymentLink, type PaymentLinkCreate, type PaymentLinkUpdate, type PaymentMethodField, type PaymentMethodOption, type PaymentNextAction, type PaymentSettlement, type PaymentStatus, type PaymentTestScenario, type Payout, type Plan, type PlanCheckoutCreate, type PlanCouponCreate, type PlanCreate, type PlanFeatureValues, type PlanFeaturesInput, type PlanLinkCreate, type PlanPrice, type PlanPriceInput, type PlanSeats, type PlanUpdate, type PortalFeatures, type PortalSession, type PortalSessionCreate, type Product, type ProductCategory, type ProductCheckoutCreate, type ProductCouponCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicCheckoutItem, type PublicClaim, type PublicClaimSummary, type PublicFulfillment, type PublicInvoice, type PublicPaymentLink, type PublicPaymentState, type PublicPortal, type RESET_FREQUENCIES, type RISK_LEVELS, type ReceiptReference, type ReceiptSend, type Refund, type RefundCreate, type RequestOptions, type ResetFrequency, type RiskLevel, type SUBMIT_LABELS, type SUBSCRIPTION_STATUSES, type SubmitLabel, type SubscribableEventType, type Subscription, type SubscriptionCancel, type SubscriptionChange, type SubscriptionChangeCreate, type SubscriptionChangePreview, type SubscriptionChangePreviewInput, type SubscriptionChangeResult, type SubscriptionCreate, type SubscriptionRenewal, type SubscriptionStatus, type SubscriptionTerms, type SubscriptionUpdate, type TAX_BEHAVIORS, type TaxBehavior, type Timestamp, type TokenKind, type USAGE_FEATURE_TYPES, type VENEZUELAN_BANKS, type VariantInput, type WEBHOOK_TEST_EVENT, type WebhookEndpoint, type WebhookEndpointCreate, type WebhookEndpointUpdate, type WebhookEvent, type Weekday, type apiVersionLifecycle, type apiVersionStage, type currentApiVersion, type findBank, type isApiVersion, type isApiVersionRetired, type isLandlinePhone, type isMobilePhone, type nationalPhone, type supportedApiVersions, type tokenEnvironment, type tokenPrefix };
|
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-Do9Fl8fk.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-Cj
|
|
|
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-20", 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
|
|
1
|
+
import { $t as PaymentFailureCode, At as Refund, C as CheckoutPurpose, Ct as PlanSeats, D as ClaimReason, E as ClaimOutcome, Et as ProductCategory, Ft as SubmitLabel, It as Subscription, J as FeatureReset, Kt as ReceiptReference, M as CustomField, O as ClaimStatus, On as Environment, P as CustomerDetails, S as CheckoutItem, St as PlanPrice, T as ClaimMessage, Yt as ApiErrorBody, Z as Fulfillment, Zt as ApiErrorType, _n as Metadata, b as CarrierOffice, bn as TaxBehavior, c as AfterCompletion, ct as LineItem, dn as GracePeriodDays, et as FulfillmentMethod, i as SubscribableEventType, in as AddressInput, k as CollectSettings, ln as Currency, mt as PaymentFailure, nt as FulfillmentTracking, ot as InvoiceReason, rn as Address, sn as BillingMonths, st as InvoiceStatus, tn as ApiErrorCode, tt as FulfillmentStatus, v as CancellationFeedback, vt as PaymentStatus, xn as Timestamp, y as Carrier } from "./events-CWajoKsy.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", "2026-10-19"];
|
|
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", "2026-10-20"];
|
|
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. */
|
|
@@ -420,7 +420,8 @@ interface PaymentMethodOption {
|
|
|
420
420
|
interface PublicPaymentLink {
|
|
421
421
|
id: string;
|
|
422
422
|
object: "payment_link";
|
|
423
|
-
|
|
423
|
+
/** The business deleted the link, or what it sells. */
|
|
424
|
+
deleted: boolean;
|
|
424
425
|
environment: Environment;
|
|
425
426
|
type: "product" | "plan";
|
|
426
427
|
/** `false` when the link was deactivated or reached its payment limit. */
|
|
@@ -572,9 +573,6 @@ interface FeatureOperationCommit {
|
|
|
572
573
|
}
|
|
573
574
|
/** An existing customer (`cus_…` or your `externalId`), or one to create or update on the fly. */
|
|
574
575
|
type CustomerInput = string | CustomerCreate;
|
|
575
|
-
interface RetireInput {
|
|
576
|
-
reason?: string;
|
|
577
|
-
}
|
|
578
576
|
interface VariantInput {
|
|
579
577
|
/** Set to update a saved variant; omit to create one. */
|
|
580
578
|
id?: string;
|
|
@@ -618,7 +616,7 @@ interface ProductUpdate {
|
|
|
618
616
|
stock?: number | null;
|
|
619
617
|
taxBehavior?: TaxBehavior;
|
|
620
618
|
/**
|
|
621
|
-
* Updates existing variants and creates new ones.
|
|
619
|
+
* Updates existing variants and creates new ones. Delete saved variants explicitly before
|
|
622
620
|
* omitting them.
|
|
623
621
|
*/
|
|
624
622
|
variants?: VariantInput[];
|
|
@@ -742,6 +740,11 @@ interface SubscriptionChangeCreate extends SubscriptionChangePreviewInput {
|
|
|
742
740
|
interface SubscriptionCancel {
|
|
743
741
|
/** `false` ends the subscription immediately. */
|
|
744
742
|
atPeriodEnd?: boolean;
|
|
743
|
+
/**
|
|
744
|
+
* `false` ends it instead of moving it to its plan's free fallback. Only with
|
|
745
|
+
* `atPeriodEnd: false`.
|
|
746
|
+
*/
|
|
747
|
+
fallback?: boolean;
|
|
745
748
|
feedback?: CancellationFeedback;
|
|
746
749
|
comment?: string;
|
|
747
750
|
}
|
|
@@ -1121,4 +1124,4 @@ declare class BilleteError extends Error {
|
|
|
1121
1124
|
}, status: number, options?: ErrorOptions);
|
|
1122
1125
|
}
|
|
1123
1126
|
//#endregion
|
|
1124
|
-
export { ProductCheckoutCreate as $, CustomerUpdate as A,
|
|
1127
|
+
export { ProductCheckoutCreate as $, CustomerUpdate as A, PublicPortal as At, InvoiceCreate as B, apiVersionStage as Bt, CouponUpdate as C, PublicCheckoutItem as Ct, CustomerMemberCreate as D, PublicInvoice as Dt, CustomerInput as E, PublicFulfillment as Et, FeatureUpdate as F, ApiVersionLifecycle as Ft, PlanCheckoutCreate as G, KEY_PATTERN as H, isApiVersion as Ht, FulfillmentDeliverInput as I, ApiVersionStage as It, PlanFeaturesInput as J, PlanCouponCreate as K, FulfillmentHandoverInput as L, LATEST_API_VERSION as Lt, FeatureCreate as M, API_VERSION_HEADER as Mt, FeatureOperationCommit as N, API_VERSION_PATTERN as Nt, CustomerMemberUpdate as O, PublicPaymentLink as Ot, FeatureOperationCreate as P, ApiVersion as Pt, PortalSessionCreate as Q, FulfillmentInput as R, LatestApiVersion as Rt, CouponCreate as S, PublicCheckout as St, CustomerCreate as T, PublicClaimSummary as Tt, PaymentLinkCreate as U, isApiVersionRetired as Ut, InvoiceLineInput as V, currentApiVersion as Vt, PaymentLinkUpdate as W, supportedApiVersions as Wt, PlanPriceInput as X, PlanLinkCreate as Y, PlanUpdate as Z, ClientPaymentCode as _, PaymentMethodField as _t, AfterCompletionInput as a, SubscriptionCancel as at, ClientSubscriptionUpdate as b, PaymentTestScenario as bt, ClaimResolve as c, SubscriptionCreate as ct, ClientCheckoutUpdate as d, WebhookEndpointCreate as dt, ProductCouponCreate as et, ClientClaimCreate as f, WebhookEndpointUpdate as ft, ClientLinkCheckout as g, PaymentInstructions as gt, ClientInvoicePay as h, FulfillmentOption as ht, TransportOptions as i, RefundCreate as it, EventSelector as j, API_VERSIONS as jt, CustomerSessionCreate as k, PublicPaymentState as kt, ClaimRespond as l, SubscriptionUpdate as lt, ClientFulfillmentProblem as m, CustomerSubscriptionChangeResult as mt, BilleteErrorCode as n, ProductLinkCreate as nt, CheckoutCreate as o, SubscriptionChangeCreate as ot, ClientCustomerClaimCreate as p, CustomerSubscription as pt, PlanCreate as q, RequestOptions as r, ProductUpdate as rt, CheckoutItemInput as s, SubscriptionChangePreviewInput as st, BilleteError as t, ProductCreate as tt, ClientCheckoutPay as u, VariantInput as ut, ClientSubscriptionCancel as v, PaymentMethodOption as vt, CustomFieldInput as w, PublicClaim as wt, CollectInput as x, PortalFeatures as xt, ClientSubscriptionSeats as y, PaymentNextAction as yt, FulfillmentTrackingInput as z, apiVersionLifecycle as zt };
|
|
@@ -281,7 +281,7 @@ declare const API_ERROR_CODES: {
|
|
|
281
281
|
readonly checkout_not_editable: "Este checkout no se puede modificar.";
|
|
282
282
|
readonly checkout_not_found: "No existe el checkout.";
|
|
283
283
|
readonly checkout_not_open: "Solo se pueden vencer checkouts abiertos.";
|
|
284
|
-
readonly checkout_selection_locked: "El producto o la variante fue
|
|
284
|
+
readonly checkout_selection_locked: "El producto o la variante fue eliminado. Puedes completar el pago con la selección actual, pero no modificarla.";
|
|
285
285
|
readonly claim_already_open: "Ya tienes un reclamo abierto por este pago: síguelo desde el enlace que te enviamos por correo.";
|
|
286
286
|
readonly claim_closed: "Este reclamo ya está cerrado.";
|
|
287
287
|
readonly claim_limit_reached: "Ya no puedes abrir más reclamos por este pago: escribe directamente al negocio.";
|
|
@@ -290,11 +290,11 @@ declare const API_ERROR_CODES: {
|
|
|
290
290
|
readonly coupon_already_used: "Ya usaste este cupón.";
|
|
291
291
|
readonly coupon_applies_to_required: "Indica si el cupón es para productos o para planes (appliesTo).";
|
|
292
292
|
readonly coupon_currency_mismatch: "El cupón solo aplica a precios en otra moneda.";
|
|
293
|
+
readonly coupon_deleted: "Este cupón fue eliminado y no puede modificarse.";
|
|
293
294
|
readonly coupon_exhausted: "El cupón alcanzó su límite de usos.";
|
|
294
295
|
readonly coupon_exists: "Ya existe un cupón con ese código.";
|
|
295
296
|
readonly coupon_expired: "El cupón venció.";
|
|
296
297
|
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.";
|
|
298
298
|
readonly coupon_inactive: "El cupón está desactivado.";
|
|
299
299
|
readonly coupon_minimum_not_met: "El pedido no llega a la compra mínima del cupón.";
|
|
300
300
|
readonly coupon_not_applicable: "Un cupón no aplica a puestos agregados a mitad del periodo.";
|
|
@@ -316,7 +316,9 @@ declare const API_ERROR_CODES: {
|
|
|
316
316
|
readonly exchange_rate_unavailable: "No hay una tasa oficial vigente para ese par de monedas; inténtalo en unos minutos.";
|
|
317
317
|
readonly fallback_plan_nested: "Un plan usado como respaldo no puede tener otro respaldo.";
|
|
318
318
|
readonly fallback_plan_not_free: "El respaldo debe ser un plan gratuito activo, en la misma moneda y sin respaldo propio.";
|
|
319
|
+
readonly feature_deleted: "Esta cuota fue eliminada y no puede modificarse.";
|
|
319
320
|
readonly feature_exists: "Ya existe una cuota con esa clave.";
|
|
321
|
+
readonly feature_in_use: "Algún plan incluye esta cuota o hay consumos reservados en ella: quítala de sus planes antes de eliminarla.";
|
|
320
322
|
readonly feature_not_found: "No existe la cuota.";
|
|
321
323
|
readonly feature_not_metered: "Esa cuota no registra uso: solo las de consumo y de cantidad lo hacen.";
|
|
322
324
|
readonly feature_operation_not_allowed: "Solo las cuotas de consumo permiten operaciones.";
|
|
@@ -387,8 +389,8 @@ declare const API_ERROR_CODES: {
|
|
|
387
389
|
readonly payment_code_not_expected: "Este pago no está esperando un código.";
|
|
388
390
|
readonly payment_code_not_sent: "No pudimos enviar otro código.";
|
|
389
391
|
readonly payment_in_progress: "Espera a que termine el pago antes de cambiar la selección.";
|
|
392
|
+
readonly payment_link_deleted: "Este enlace fue eliminado y no puede modificarse.";
|
|
390
393
|
readonly payment_link_not_found: "No existe el enlace de pago.";
|
|
391
|
-
readonly payment_link_retired: "Un enlace retirado no puede modificarse ni reactivarse.";
|
|
392
394
|
readonly payment_link_unavailable: "Este enlace de pago ya no está disponible.";
|
|
393
395
|
readonly payment_method_unavailable: "Ese método no permite pagar en la moneda del checkout o del cobro.";
|
|
394
396
|
readonly payment_not_claimable: "Solo puedes abrir un reclamo por un pago confirmado.";
|
|
@@ -398,14 +400,16 @@ declare const API_ERROR_CODES: {
|
|
|
398
400
|
readonly payout_account_change_pending: "Ya hay un cambio de la cuenta de retiro pendiente: cancélalo antes de pedir otro.";
|
|
399
401
|
readonly payout_not_found: "No existe el retiro.";
|
|
400
402
|
readonly phone_required: "Teléfono: este campo es obligatorio.";
|
|
401
|
-
readonly
|
|
403
|
+
readonly plan_deleted: "Este plan fue eliminado y no puede modificarse.";
|
|
404
|
+
readonly plan_in_use: "El plan tiene suscripciones en curso o es el respaldo de otro plan: desactívalo para no aceptar nuevas.";
|
|
405
|
+
readonly plan_inactive: "El plan está desactivado.";
|
|
402
406
|
readonly plan_not_found: "No existe el plan.";
|
|
403
407
|
readonly plan_seats_locked: "No puedes cambiar la forma de cobro de un plan con suscripciones.";
|
|
404
408
|
readonly portal_action_disabled: "El negocio no permite hacer este cambio desde el portal.";
|
|
405
409
|
readonly portal_session_invalid: "Este enlace ya se abrió o venció.";
|
|
410
|
+
readonly product_deleted: "Este producto fue eliminado.";
|
|
406
411
|
readonly product_inactive: "Este producto está desactivado.";
|
|
407
412
|
readonly product_not_found: "No existe el producto.";
|
|
408
|
-
readonly product_retired: "Este producto fue retirado.";
|
|
409
413
|
readonly product_unavailable: "Uno de los productos ya no existe.";
|
|
410
414
|
readonly production_already_enabled: "El negocio ya opera en producción.";
|
|
411
415
|
readonly production_not_enabled: "Completa la activación del negocio para usar producción.";
|
|
@@ -450,13 +454,14 @@ declare const API_ERROR_CODES: {
|
|
|
450
454
|
readonly unsubscribe_invalid: "El enlace no es válido.";
|
|
451
455
|
readonly unused_credit_not_accepted: "Este cambio pierde crédito no utilizado; acéptalo expresamente o prográmalo para la renovación.";
|
|
452
456
|
readonly validation_failed: "El cuerpo o la consulta no cumple el esquema; `param` dice qué campo.";
|
|
457
|
+
readonly variant_deleted: "Esta variante fue eliminada y no puede modificarse.";
|
|
458
|
+
readonly variant_deletion_required: "Elimina la variante explícitamente antes de quitarla del producto.";
|
|
453
459
|
readonly variant_not_found: "No existe la variante.";
|
|
454
460
|
readonly variant_pricing_required: "Con variantes, el precio y el stock se configuran por variante.";
|
|
455
461
|
readonly variant_required: "El producto tiene variantes: elige una.";
|
|
456
|
-
readonly variant_retired: "Una variante retirada no puede modificarse ni reactivarse.";
|
|
457
|
-
readonly variant_retirement_required: "Retira la variante explícitamente antes de quitarla del producto.";
|
|
458
462
|
readonly webhook_delivery_in_progress: "Este envío está en curso; podrás reenviarlo cuando termine.";
|
|
459
463
|
readonly webhook_delivery_not_found: "No existe el envío.";
|
|
464
|
+
readonly webhook_endpoint_deleted: "Este webhook fue eliminado y no puede modificarse.";
|
|
460
465
|
readonly webhook_endpoint_disabled: "Este webhook está desactivado: actívalo para enviarle eventos.";
|
|
461
466
|
readonly webhook_endpoint_not_found: "No existe el webhook.";
|
|
462
467
|
readonly webhook_signature_invalid: "La firma del evento no es válida.";
|
|
@@ -555,12 +560,15 @@ type Actor = {
|
|
|
555
560
|
type: "user" | "api_key";
|
|
556
561
|
id: string;
|
|
557
562
|
};
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
563
|
+
/**
|
|
564
|
+
* Set when it was deleted: it leaves every list and can no longer be used or changed, but stays
|
|
565
|
+
* readable by ID, because what was sold or charged with it still names it.
|
|
566
|
+
*/
|
|
567
|
+
interface Deletion {
|
|
568
|
+
deletedAt: Timestamp | null;
|
|
569
|
+
deletedBy: Actor | null;
|
|
562
570
|
}
|
|
563
|
-
interface ProductVariant extends
|
|
571
|
+
interface ProductVariant extends Deletion {
|
|
564
572
|
id: string;
|
|
565
573
|
name: string;
|
|
566
574
|
/** Free-form descriptors such as `{ color: "Rojo", talla: "M" }`. */
|
|
@@ -572,7 +580,7 @@ interface ProductVariant extends Retirement {
|
|
|
572
580
|
isDefault: boolean;
|
|
573
581
|
active: boolean;
|
|
574
582
|
}
|
|
575
|
-
interface Product extends Resource<"product">,
|
|
583
|
+
interface Product extends Resource<"product">, Deletion {
|
|
576
584
|
name: string;
|
|
577
585
|
/**
|
|
578
586
|
* The business's own name for it, unique among its products in each environment: unlike
|
|
@@ -607,7 +615,7 @@ interface PlanPrice {
|
|
|
607
615
|
* unlimited, for `metered` and `count`; the value itself for `number`.
|
|
608
616
|
*/
|
|
609
617
|
type PlanFeatureValues = Record<string, boolean | number | null>;
|
|
610
|
-
interface Plan extends Resource<"plan"
|
|
618
|
+
interface Plan extends Resource<"plan">, Deletion {
|
|
611
619
|
seats: PlanSeats;
|
|
612
620
|
fallbackPlanId: string | null;
|
|
613
621
|
name: string;
|
|
@@ -667,7 +675,7 @@ type FeatureReset = {
|
|
|
667
675
|
hour: number;
|
|
668
676
|
day: number;
|
|
669
677
|
};
|
|
670
|
-
interface Feature extends Resource<"feature"
|
|
678
|
+
interface Feature extends Resource<"feature">, Deletion {
|
|
671
679
|
per: "customer" | "member";
|
|
672
680
|
key: string;
|
|
673
681
|
name: string;
|
|
@@ -782,7 +790,7 @@ interface Subscription extends Resource<"subscription"> {
|
|
|
782
790
|
metadata: Metadata;
|
|
783
791
|
updatedAt: Timestamp;
|
|
784
792
|
}
|
|
785
|
-
interface Coupon extends Resource<"coupon"
|
|
793
|
+
interface Coupon extends Resource<"coupon">, Deletion {
|
|
786
794
|
code: string;
|
|
787
795
|
name: string | null;
|
|
788
796
|
percentOff: number | null;
|
|
@@ -830,7 +838,7 @@ type AfterCompletion = {
|
|
|
830
838
|
};
|
|
831
839
|
declare const SUBMIT_LABELS: readonly ["pay", "subscribe", "book", "donate"];
|
|
832
840
|
type SubmitLabel = (typeof SUBMIT_LABELS)[number];
|
|
833
|
-
interface PaymentLink extends Resource<"payment_link">,
|
|
841
|
+
interface PaymentLink extends Resource<"payment_link">, Deletion {
|
|
834
842
|
url: string;
|
|
835
843
|
type: "product" | "plan";
|
|
836
844
|
productId: string | null;
|
|
@@ -1320,7 +1328,7 @@ interface Payout extends Resource<"payout"> {
|
|
|
1320
1328
|
arrivalAt: Timestamp | null;
|
|
1321
1329
|
failureMessage: string | null;
|
|
1322
1330
|
}
|
|
1323
|
-
interface WebhookEndpoint extends Resource<"webhook_endpoint"
|
|
1331
|
+
interface WebhookEndpoint extends Resource<"webhook_endpoint">, Deletion {
|
|
1324
1332
|
url: string;
|
|
1325
1333
|
events: string[];
|
|
1326
1334
|
/**
|
|
@@ -1371,9 +1379,9 @@ interface PortalSession {
|
|
|
1371
1379
|
//#endregion
|
|
1372
1380
|
//#region ../contracts/src/events.d.ts
|
|
1373
1381
|
interface EventDataMap {
|
|
1374
|
-
"product.retired": Product;
|
|
1375
1382
|
"product.updated": Product;
|
|
1376
|
-
"
|
|
1383
|
+
"product.deleted": Product;
|
|
1384
|
+
"payment_link.deleted": PaymentLink;
|
|
1377
1385
|
"customer.created": Customer;
|
|
1378
1386
|
"customer.updated": Customer;
|
|
1379
1387
|
"customer.member_added": CustomerMember;
|
|
@@ -1438,7 +1446,7 @@ type EventType = keyof EventDataMap;
|
|
|
1438
1446
|
declare const WEBHOOK_TEST_EVENT: "webhook_endpoint.test";
|
|
1439
1447
|
/** What a webhook endpoint can subscribe to: everything that happens in a business. */
|
|
1440
1448
|
type SubscribableEventType = Exclude<EventType, typeof WEBHOOK_TEST_EVENT>;
|
|
1441
|
-
declare const EVENT_TYPES: readonly ["product.
|
|
1449
|
+
declare const EVENT_TYPES: readonly ["product.updated", "product.deleted", "payment_link.deleted", "customer.created", "customer.updated", "customer.member_added", "customer.member_removed", "subscription.change_failed", "checkout.completed", "checkout.expired", "payment.succeeded", "payment.failed", "payment.refunded", "fulfillment.created", "fulfillment.shipped", "fulfillment.ready_for_pickup", "fulfillment.delivered", "fulfillment.received", "fulfillment.problem_reported", "fulfillment.canceled", "claim.created", "claim.updated", "claim.resolved", "claim.withdrawn", "refund.created", "refund.failed", "invoice.created", "invoice.paid", "invoice.voided", "invoice.uncollectible", "subscription.created", "subscription.updated", "subscription.renewal_due", "subscription.renewed", "subscription.past_due", "subscription.canceled", "subscription.expired"];
|
|
1442
1450
|
/** A delivered webhook, discriminated by `type` so `data` narrows automatically. */
|
|
1443
1451
|
type WebhookEvent = { [TType in EventType]: {
|
|
1444
1452
|
id: string;
|
|
@@ -1451,4 +1459,4 @@ type WebhookEvent = { [TType in EventType]: {
|
|
|
1451
1459
|
data: EventDataMap[TType];
|
|
1452
1460
|
}; }[EventType];
|
|
1453
1461
|
//#endregion
|
|
1454
|
-
export {
|
|
1462
|
+
export { FulfillmentHandover as $, PaymentFailureCode as $t, Coupon as A, tokenEnvironment as An, Refund as At, Event as B, SubscriptionRenewal as Bt, CheckoutPurpose as C, findBank as Cn, PlanSeats as Ct, ClaimReason as D, ENVIRONMENTS as Dn, ProductVariant as Dt, ClaimOutcome as E, nationalPhone as En, ProductCategory as Et, CustomerFeature as F, SubmitLabel as Ft, Feature as G, Weekday as Gt, FEATURE_TYPES as H, SubscriptionTerms as Ht, CustomerMember as I, Subscription as It, FeatureReset as J, API_ERROR_TYPES as Jt, FeatureOperation as K, ReceiptReference as Kt, CustomerMemberList as L, SubscriptionChange as Lt, CustomField as M, RiskLevel as Mt, Customer as N, SUBMIT_LABELS as Nt, ClaimStatus as O, Environment as On, RESET_FREQUENCIES as Ot, CustomerDetails as P, SUBSCRIPTION_STATUSES as Pt, FulfillmentChoice as Q, PAYMENT_FAILURE_CODES as Qt, CustomerSession as R, SubscriptionChangePreview as Rt, CheckoutItem as S, VENEZUELAN_BANKS as Sn, PlanPrice as St, ClaimMessage as T, isMobilePhone as Tn, Product as Tt, FULFILLMENT_METHODS as U, USAGE_FEATURE_TYPES as Ut, ExchangeRate as V, SubscriptionStatus as Vt, FULFILLMENT_STATUSES as W, WebhookEndpoint as Wt, FeatureUsageResult as X, ApiErrorEnvelope as Xt, FeatureType as Y, ApiErrorBody as Yt, Fulfillment as Z, ApiErrorType as Zt, CLAIM_STATUSES as _, Metadata as _n, PaymentSettlement as _t, WEBHOOK_TEST_EVENT as a, BILLING_MONTHS as an, Invoice as at, CarrierOffice as b, TaxBehavior as bn, Plan as bt, AfterCompletion as c, CURRENCIES as cn, LineItem as ct, CANCELLATION_FEEDBACK as d, GracePeriodDays as dn, PRODUCT_CATEGORIES as dt, API_ERROR_CODES as en, FulfillmentMethod as et, CARRIERS as f, List as fn, Payment as ft, CLAIM_REASONS as g, MOBILE_PREFIXES as gn, PaymentLink as gt, CLAIM_OUTCOMES as h, MAX_QUANTITY as hn, PaymentFeeDetails as ht, SubscribableEventType as i, AddressInput as in, INVOICE_STATUSES as it, CurrencyAvailability as j, tokenPrefix as jn, ResetFrequency as jt, CollectSettings as k, TokenKind as kn, RISK_LEVELS as kt, Balance as l, Currency as ln, MAX_SEATS as lt, CHECKOUT_PURPOSES as m, ListSort as mn, PaymentFailure as mt, EventDataMap as n, ACCOUNT_NUMBER_LENGTH as nn, FulfillmentTracking as nt, WebhookEvent as o, BankCode as on, InvoiceReason as ot, CARRIER_TEST_SCENARIOS as p, ListQuery as pn, PaymentAttempt as pt, FeatureOperationResult as q, ReceiptSend as qt, EventType as r, Address as rn, INVOICE_REASONS as rt, Actor as s, BillingMonths as sn, InvoiceStatus as st, EVENT_TYPES as t, ApiErrorCode as tn, FulfillmentStatus as tt, BalanceAmount as u, GRACE_PERIOD_DAYS as un, PAYMENT_STATUSES as ut, CancellationFeedback as v, MobilePrefix as vn, PaymentStatus as vt, Claim as w, isLandlinePhone as wn, PortalSession as wt, Checkout as x, Timestamp as xn, PlanFeatureValues as xt, Carrier as y, TAX_BEHAVIORS as yn, Payout as yt, Deletion as z, SubscriptionChangeResult as zt };
|
|
@@ -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 = "7.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
|
|
2
|
-
import { $ as
|
|
1
|
+
import { $ as ProductCheckoutCreate, A as CustomerUpdate, At as PublicPortal, B as InvoiceCreate, Bt as apiVersionStage, C as CouponUpdate, Ct as PublicCheckoutItem, D as CustomerMemberCreate, Dt as PublicInvoice, E as CustomerInput, Et as PublicFulfillment, F as FeatureUpdate, Ft as ApiVersionLifecycle, G as PlanCheckoutCreate, H as KEY_PATTERN, Ht as isApiVersion, I as FulfillmentDeliverInput, It as ApiVersionStage, J as PlanFeaturesInput, K as PlanCouponCreate, L as FulfillmentHandoverInput, Lt as LATEST_API_VERSION, M as FeatureCreate, Mt as API_VERSION_HEADER, N as FeatureOperationCommit, Nt as API_VERSION_PATTERN, O as CustomerMemberUpdate, Ot as PublicPaymentLink, P as FeatureOperationCreate, Pt as ApiVersion, Q as PortalSessionCreate, R as FulfillmentInput, Rt as LatestApiVersion, S as CouponCreate, St as PublicCheckout, T as CustomerCreate, Tt as PublicClaimSummary, U as PaymentLinkCreate, Ut as isApiVersionRetired, V as InvoiceLineInput, Vt as currentApiVersion, W as PaymentLinkUpdate, Wt as supportedApiVersions, X as PlanPriceInput, Y as PlanLinkCreate, Z as PlanUpdate, _ as ClientPaymentCode, _t as PaymentMethodField, a as AfterCompletionInput, at as SubscriptionCancel, b as ClientSubscriptionUpdate, bt as PaymentTestScenario, c as ClaimResolve, ct as SubscriptionCreate, d as ClientCheckoutUpdate, dt as WebhookEndpointCreate, et as ProductCouponCreate, f as ClientClaimCreate, ft as WebhookEndpointUpdate, g as ClientLinkCheckout, gt as PaymentInstructions, h as ClientInvoicePay, ht as FulfillmentOption, i as TransportOptions, it as RefundCreate, j as EventSelector, jt as API_VERSIONS, k as CustomerSessionCreate, kt as PublicPaymentState, l as ClaimRespond, lt as SubscriptionUpdate, m as ClientFulfillmentProblem, mt as CustomerSubscriptionChangeResult, n as BilleteErrorCode, nt as ProductLinkCreate, o as CheckoutCreate, ot as SubscriptionChangeCreate, p as ClientCustomerClaimCreate, pt as CustomerSubscription, q as PlanCreate, r as RequestOptions, rt as ProductUpdate, s as CheckoutItemInput, st as SubscriptionChangePreviewInput, t as BilleteError, tt as ProductCreate, u as ClientCheckoutPay, ut as VariantInput, v as ClientSubscriptionCancel, vt as PaymentMethodOption, w as CustomFieldInput, wt as PublicClaim, x as CollectInput, xt as PortalFeatures, y as ClientSubscriptionSeats, yt as PaymentNextAction, z as FulfillmentTrackingInput, zt as apiVersionLifecycle } from "./errors-e_-7ZZmn.js";
|
|
2
|
+
import { $ as FulfillmentHandover, $t as PaymentFailureCode, A as Coupon, An as tokenEnvironment, At as Refund, B as Event, Bt as SubscriptionRenewal, C as CheckoutPurpose, Cn as findBank, Ct as PlanSeats, D as ClaimReason, Dn as ENVIRONMENTS, Dt as ProductVariant, E as ClaimOutcome, En as nationalPhone, Et as ProductCategory, F as CustomerFeature, Ft as SubmitLabel, G as Feature, Gt as Weekday, H as FEATURE_TYPES, Ht as SubscriptionTerms, I as CustomerMember, It as Subscription, J as FeatureReset, Jt as API_ERROR_TYPES, K as FeatureOperation, 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 RESET_FREQUENCIES, P as CustomerDetails, Pt as SUBSCRIPTION_STATUSES, Q as FulfillmentChoice, Qt as PAYMENT_FAILURE_CODES, R as CustomerSession, Rt as SubscriptionChangePreview, S as CheckoutItem, Sn as VENEZUELAN_BANKS, St as PlanPrice, T as ClaimMessage, Tn as isMobilePhone, Tt as Product, U as FULFILLMENT_METHODS, Ut as USAGE_FEATURE_TYPES, V as ExchangeRate, Vt as SubscriptionStatus, W as FULFILLMENT_STATUSES, Wt as WebhookEndpoint, X as FeatureUsageResult, Xt as ApiErrorEnvelope, Y as FeatureType, Yt as ApiErrorBody, Z as Fulfillment, Zt as ApiErrorType, _ as CLAIM_STATUSES, _n as Metadata, _t as PaymentSettlement, a as WEBHOOK_TEST_EVENT, an as BILLING_MONTHS, at as Invoice, b as CarrierOffice, bn as TaxBehavior, bt as Plan, c as AfterCompletion, cn as CURRENCIES, ct as LineItem, d as CANCELLATION_FEEDBACK, dn as GracePeriodDays, dt as PRODUCT_CATEGORIES, en as API_ERROR_CODES, et as FulfillmentMethod, f as CARRIERS, fn as List, ft as Payment, g as CLAIM_REASONS, gn as MOBILE_PREFIXES, gt as PaymentLink, h as CLAIM_OUTCOMES, hn as MAX_QUANTITY, ht as PaymentFeeDetails, i as SubscribableEventType, in as AddressInput, it as INVOICE_STATUSES, j as CurrencyAvailability, jn as tokenPrefix, jt as ResetFrequency, k as CollectSettings, kn as TokenKind, kt as RISK_LEVELS, l as Balance, ln as Currency, lt as MAX_SEATS, m as CHECKOUT_PURPOSES, mn as ListSort, mt as PaymentFailure, n as EventDataMap, nn as ACCOUNT_NUMBER_LENGTH, nt as FulfillmentTracking, o as WebhookEvent, on as BankCode, ot as InvoiceReason, p as CARRIER_TEST_SCENARIOS, pn as ListQuery, pt as PaymentAttempt, q as FeatureOperationResult, qt as ReceiptSend, r as EventType, rn as Address, rt as INVOICE_REASONS, s as Actor, sn as BillingMonths, st as InvoiceStatus, t as EVENT_TYPES, tn as ApiErrorCode, tt as FulfillmentStatus, u as BalanceAmount, un as GRACE_PERIOD_DAYS, ut as PAYMENT_STATUSES, v as CancellationFeedback, vn as MobilePrefix, vt as PaymentStatus, w as Claim, wn as isLandlinePhone, wt as PortalSession, x as Checkout, xn as Timestamp, xt as PlanFeatureValues, y as Carrier, yn as TAX_BEHAVIORS, yt as Payout, z as Deletion, zt as SubscriptionChangeResult } from "./events-CWajoKsy.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-20", environment: "test" });
|
|
29
29
|
* const { allowed } = await billete.features.consume("user_123", "tokens", 850);
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
@@ -68,7 +68,7 @@ export declare function createBillete(options: BilleteOptions): {
|
|
|
68
68
|
update: (id: string, input: ProductUpdate, options?: RequestOptions) => Promise<Product>;
|
|
69
69
|
list: (query?: Filters<{
|
|
70
70
|
active?: boolean;
|
|
71
|
-
|
|
71
|
+
deleted?: boolean;
|
|
72
72
|
search?: string;
|
|
73
73
|
lookupKey?: string;
|
|
74
74
|
sort?: ListSort<"created" | "name">;
|
|
@@ -76,13 +76,15 @@ export declare function createBillete(options: BilleteOptions): {
|
|
|
76
76
|
/** Iterates every item across pages: `for await (const item of iterate())`. */
|
|
77
77
|
iterate: (query?: Filters<{
|
|
78
78
|
active?: boolean;
|
|
79
|
-
|
|
79
|
+
deleted?: boolean;
|
|
80
80
|
search?: string;
|
|
81
81
|
lookupKey?: string;
|
|
82
82
|
sort?: ListSort<"created" | "name">;
|
|
83
83
|
}>) => AsyncGenerator<Product, any, any>;
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
/** Also deletes its variants and payment links. Open checkouts can still be paid. */
|
|
85
|
+
delete: (id: string, options?: RequestOptions) => Promise<Product>;
|
|
86
|
+
/** Answers the product; links left without a variant to offer are deleted too. */
|
|
87
|
+
deleteVariant: (product: string, variant: string, options?: RequestOptions) => Promise<Product>;
|
|
86
88
|
};
|
|
87
89
|
plans: {
|
|
88
90
|
create: (input: PlanCreate, options?: RequestOptions) => Promise<Plan>;
|
|
@@ -101,6 +103,11 @@ export declare function createBillete(options: BilleteOptions): {
|
|
|
101
103
|
lookupKey?: string;
|
|
102
104
|
sort?: ListSort<"created" | "name">;
|
|
103
105
|
}>) => AsyncGenerator<Plan, any, any>;
|
|
106
|
+
/**
|
|
107
|
+
* Only a plan no subscription is in and no other plan falls back to (`plan_in_use`);
|
|
108
|
+
* deactivate the rest. Also deletes its payment links.
|
|
109
|
+
*/
|
|
110
|
+
delete: (id: string, options?: RequestOptions) => Promise<Plan>;
|
|
104
111
|
};
|
|
105
112
|
features: {
|
|
106
113
|
create: (input: FeatureCreate, options?: RequestOptions) => Promise<Feature>;
|
|
@@ -117,6 +124,11 @@ export declare function createBillete(options: BilleteOptions): {
|
|
|
117
124
|
retrieve: (key: string, options?: RequestOptions) => Promise<Feature>;
|
|
118
125
|
/** Renames a feature or changes its schedule; `key` also takes its `feat_` ID. */
|
|
119
126
|
update: (key: string, input: FeatureUpdate, options?: RequestOptions) => Promise<Feature>;
|
|
127
|
+
/**
|
|
128
|
+
* Only a feature no plan grants (`feature_in_use`). Frees its key; after that, only its `feat_`
|
|
129
|
+
* ID finds it.
|
|
130
|
+
*/
|
|
131
|
+
delete: (id: string, options?: RequestOptions) => Promise<Feature>;
|
|
120
132
|
/**
|
|
121
133
|
* Reserves `amount` of a metered feature for one job: it counts as used right away and the
|
|
122
134
|
* operation is closed later through `features.operations`. Repeating `operation` returns the
|
|
@@ -157,16 +169,18 @@ export declare function createBillete(options: BilleteOptions): {
|
|
|
157
169
|
retrieve: (id: string, options?: RequestOptions) => Promise<Coupon>;
|
|
158
170
|
update: (id: string, input: CouponUpdate, options?: RequestOptions) => Promise<Coupon>;
|
|
159
171
|
list: (query?: Filters<{
|
|
172
|
+
active?: boolean;
|
|
160
173
|
search?: string;
|
|
161
174
|
sort?: ListSort<"created" | "code">;
|
|
162
175
|
}>, options?: RequestOptions) => Promise<List<Coupon>>;
|
|
163
176
|
/** Iterates every item across pages: `for await (const item of iterate())`. */
|
|
164
177
|
iterate: (query?: Filters<{
|
|
178
|
+
active?: boolean;
|
|
165
179
|
search?: string;
|
|
166
180
|
sort?: ListSort<"created" | "code">;
|
|
167
181
|
}>) => AsyncGenerator<Coupon, any, any>;
|
|
168
|
-
/**
|
|
169
|
-
delete: (id: string, options?: RequestOptions) => Promise<
|
|
182
|
+
/** Frees its code; subscriptions and open payments that hold it keep their discount. */
|
|
183
|
+
delete: (id: string, options?: RequestOptions) => Promise<Coupon>;
|
|
170
184
|
};
|
|
171
185
|
checkouts: {
|
|
172
186
|
create: (input: CheckoutCreate, options?: RequestOptions) => Promise<Checkout>;
|
|
@@ -180,17 +194,20 @@ export declare function createBillete(options: BilleteOptions): {
|
|
|
180
194
|
retrieve: (id: string, options?: RequestOptions) => Promise<PaymentLink>;
|
|
181
195
|
update: (id: string, input: PaymentLinkUpdate, options?: RequestOptions) => Promise<PaymentLink>;
|
|
182
196
|
list: (query?: Filters<{
|
|
183
|
-
|
|
197
|
+
active?: boolean;
|
|
198
|
+
deleted?: boolean;
|
|
184
199
|
search?: string;
|
|
185
200
|
sort?: ListSort<"created">;
|
|
186
201
|
}>, options?: RequestOptions) => Promise<List<PaymentLink>>;
|
|
187
202
|
/** Iterates every item across pages: `for await (const item of iterate())`. */
|
|
188
203
|
iterate: (query?: Filters<{
|
|
189
|
-
|
|
204
|
+
active?: boolean;
|
|
205
|
+
deleted?: boolean;
|
|
190
206
|
search?: string;
|
|
191
207
|
sort?: ListSort<"created">;
|
|
192
208
|
}>) => AsyncGenerator<PaymentLink, any, any>;
|
|
193
|
-
|
|
209
|
+
/** Open checkouts can still be paid. */
|
|
210
|
+
delete: (id: string, options?: RequestOptions) => Promise<PaymentLink>;
|
|
194
211
|
};
|
|
195
212
|
invoices: {
|
|
196
213
|
create: (input: InvoiceCreate, options?: RequestOptions) => Promise<Invoice>;
|
|
@@ -240,7 +257,8 @@ export declare function createBillete(options: BilleteOptions): {
|
|
|
240
257
|
};
|
|
241
258
|
/**
|
|
242
259
|
* Cancels at period end by default; pass `{ atPeriodEnd: false }` to end it now. With a
|
|
243
|
-
* fallback plan it moves to that free plan instead (`subscription.updated`), keeping its ID
|
|
260
|
+
* fallback plan it moves to that free plan instead (`subscription.updated`), keeping its ID,
|
|
261
|
+
* unless you also pass `fallback: false`.
|
|
244
262
|
*/
|
|
245
263
|
cancel: (id: string, input?: SubscriptionCancel, options?: RequestOptions) => Promise<Subscription>;
|
|
246
264
|
resume: (id: string, options?: RequestOptions) => Promise<Subscription>;
|
|
@@ -341,7 +359,8 @@ export declare function createBillete(options: BilleteOptions): {
|
|
|
341
359
|
list: (query?: Filters<object>, options?: RequestOptions) => Promise<List<WebhookEndpoint>>;
|
|
342
360
|
/** Iterates every item across pages: `for await (const item of iterate())`. */
|
|
343
361
|
iterate: (query?: Filters<object>) => AsyncGenerator<WebhookEndpoint, any, any>;
|
|
344
|
-
|
|
362
|
+
/** Stops its events; its deliveries stay as history. */
|
|
363
|
+
delete: (id: string, options?: RequestOptions) => Promise<WebhookEndpoint>;
|
|
345
364
|
};
|
|
346
365
|
events: {
|
|
347
366
|
retrieve: (id: string, options?: RequestOptions) => Promise<Event<Record<string, unknown>>>;
|
|
@@ -370,4 +389,4 @@ export declare function createBillete(options: BilleteOptions): {
|
|
|
370
389
|
/** The server client: what `createBillete` returns. */
|
|
371
390
|
type Billete = ReturnType<typeof createBillete>;
|
|
372
391
|
//#endregion
|
|
373
|
-
export { type ACCOUNT_NUMBER_LENGTH, type API_ERROR_CODES, type API_ERROR_TYPES, type API_VERSIONS, type API_VERSION_HEADER, type API_VERSION_PATTERN, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorCode, type ApiErrorEnvelope, type ApiErrorType, type ApiVersion, type ApiVersionLifecycle, type ApiVersionStage, type BILLING_MONTHS, type Balance, type BalanceAmount, type BankCode, type Billete, BilleteError, type BilleteErrorCode, type BilleteOptions, type BillingMonths, type CANCELLATION_FEEDBACK, type CARRIERS, type CARRIER_TEST_SCENARIOS, type CHECKOUT_PURPOSES, type CLAIM_OUTCOMES, type CLAIM_REASONS, type CLAIM_STATUSES, type CURRENCIES, type CancellationFeedback, type Carrier, type CarrierOffice, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPurpose, type Claim, type ClaimMessage, type ClaimOutcome, type ClaimReason, type ClaimResolve, type ClaimRespond, type ClaimStatus, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientClaimCreate, type ClientCustomerClaimCreate, type ClientFulfillmentProblem, type ClientInvoicePay, type ClientLinkCheckout, type ClientPaymentCode, type ClientSubscriptionCancel, type ClientSubscriptionSeats, type ClientSubscriptionUpdate, type CollectInput, type CollectSettings, type Coupon, type CouponCreate, type CouponUpdate, type Currency, type CurrencyAvailability, type CustomField, type CustomFieldInput, type Customer, type CustomerCreate, type CustomerDetails, type CustomerFeature, type CustomerInput, type CustomerMember, type CustomerMemberCreate, type CustomerMemberList, type CustomerMemberUpdate, type CustomerSession, type CustomerSessionCreate, type CustomerSubscription, type CustomerSubscriptionChangeResult, type CustomerUpdate, type ENVIRONMENTS, type EVENT_TYPES, type Environment, type Event, type EventDataMap, type EventSelector, type EventType, type ExchangeRate, type FEATURE_TYPES, type FULFILLMENT_METHODS, type FULFILLMENT_STATUSES, type Feature, type FeatureCreate, type FeatureOperation, type FeatureOperationCommit, type FeatureOperationCreate, type FeatureOperationResult, type FeatureReset, type FeatureType, type FeatureUpdate, type FeatureUsageResult, type Fulfillment, type FulfillmentChoice, type FulfillmentDeliverInput, type FulfillmentHandover, type FulfillmentHandoverInput, type FulfillmentInput, type FulfillmentMethod, type FulfillmentOption, type FulfillmentStatus, type FulfillmentTracking, type FulfillmentTrackingInput, type GRACE_PERIOD_DAYS, type GracePeriodDays, type INVOICE_REASONS, type INVOICE_STATUSES, type Invoice, type InvoiceCreate, type InvoiceLineInput, type InvoiceReason, type InvoiceStatus, type KEY_PATTERN, type LATEST_API_VERSION, type LatestApiVersion, type LineItem, type List, type ListQuery, type ListSort, type MAX_QUANTITY, type MAX_SEATS, type MOBILE_PREFIXES, type Metadata, type MobilePrefix, type PAYMENT_FAILURE_CODES, type PAYMENT_STATUSES, type PRODUCT_CATEGORIES, type Payment, type PaymentAttempt, type PaymentFailure, type PaymentFailureCode, type PaymentFeeDetails, type PaymentInstructions, type PaymentLink, type PaymentLinkCreate, type PaymentLinkUpdate, type PaymentMethodField, type PaymentMethodOption, type PaymentNextAction, type PaymentSettlement, type PaymentStatus, type PaymentTestScenario, type Payout, type Plan, type PlanCheckoutCreate, type PlanCouponCreate, type PlanCreate, type PlanFeatureValues, type PlanFeaturesInput, type PlanLinkCreate, type PlanPrice, type PlanPriceInput, type PlanSeats, type PlanUpdate, type PortalFeatures, type PortalSession, type PortalSessionCreate, type Product, type ProductCategory, type ProductCheckoutCreate, type ProductCouponCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicCheckoutItem, type PublicClaim, type PublicClaimSummary, type PublicFulfillment, type PublicInvoice, type PublicPaymentLink, type PublicPaymentState, type PublicPortal, type RESET_FREQUENCIES, type RISK_LEVELS, type ReceiptReference, type ReceiptSend, type Refund, type RefundCreate, type RequestOptions, type ResetFrequency, type
|
|
392
|
+
export { type ACCOUNT_NUMBER_LENGTH, type API_ERROR_CODES, type API_ERROR_TYPES, type API_VERSIONS, type API_VERSION_HEADER, type API_VERSION_PATTERN, type Actor, type Address, type AddressInput, type AfterCompletion, type AfterCompletionInput, type ApiErrorBody, type ApiErrorCode, type ApiErrorEnvelope, type ApiErrorType, type ApiVersion, type ApiVersionLifecycle, type ApiVersionStage, type BILLING_MONTHS, type Balance, type BalanceAmount, type BankCode, type Billete, BilleteError, type BilleteErrorCode, type BilleteOptions, type BillingMonths, type CANCELLATION_FEEDBACK, type CARRIERS, type CARRIER_TEST_SCENARIOS, type CHECKOUT_PURPOSES, type CLAIM_OUTCOMES, type CLAIM_REASONS, type CLAIM_STATUSES, type CURRENCIES, type CancellationFeedback, type Carrier, type CarrierOffice, type Checkout, type CheckoutCreate, type CheckoutItem, type CheckoutItemInput, type CheckoutPurpose, type Claim, type ClaimMessage, type ClaimOutcome, type ClaimReason, type ClaimResolve, type ClaimRespond, type ClaimStatus, type ClientCheckoutPay, type ClientCheckoutUpdate, type ClientClaimCreate, type ClientCustomerClaimCreate, type ClientFulfillmentProblem, type ClientInvoicePay, type ClientLinkCheckout, type ClientPaymentCode, type ClientSubscriptionCancel, type ClientSubscriptionSeats, type ClientSubscriptionUpdate, type CollectInput, type CollectSettings, type Coupon, type CouponCreate, type CouponUpdate, type Currency, type CurrencyAvailability, type CustomField, type CustomFieldInput, type Customer, type CustomerCreate, type CustomerDetails, type CustomerFeature, type CustomerInput, type CustomerMember, type CustomerMemberCreate, type CustomerMemberList, type CustomerMemberUpdate, type CustomerSession, type CustomerSessionCreate, type CustomerSubscription, type CustomerSubscriptionChangeResult, type CustomerUpdate, type Deletion, type ENVIRONMENTS, type EVENT_TYPES, type Environment, type Event, type EventDataMap, type EventSelector, type EventType, type ExchangeRate, type FEATURE_TYPES, type FULFILLMENT_METHODS, type FULFILLMENT_STATUSES, type Feature, type FeatureCreate, type FeatureOperation, type FeatureOperationCommit, type FeatureOperationCreate, type FeatureOperationResult, type FeatureReset, type FeatureType, type FeatureUpdate, type FeatureUsageResult, type Fulfillment, type FulfillmentChoice, type FulfillmentDeliverInput, type FulfillmentHandover, type FulfillmentHandoverInput, type FulfillmentInput, type FulfillmentMethod, type FulfillmentOption, type FulfillmentStatus, type FulfillmentTracking, type FulfillmentTrackingInput, type GRACE_PERIOD_DAYS, type GracePeriodDays, type INVOICE_REASONS, type INVOICE_STATUSES, type Invoice, type InvoiceCreate, type InvoiceLineInput, type InvoiceReason, type InvoiceStatus, type KEY_PATTERN, type LATEST_API_VERSION, type LatestApiVersion, type LineItem, type List, type ListQuery, type ListSort, type MAX_QUANTITY, type MAX_SEATS, type MOBILE_PREFIXES, type Metadata, type MobilePrefix, type PAYMENT_FAILURE_CODES, type PAYMENT_STATUSES, type PRODUCT_CATEGORIES, type Payment, type PaymentAttempt, type PaymentFailure, type PaymentFailureCode, type PaymentFeeDetails, type PaymentInstructions, type PaymentLink, type PaymentLinkCreate, type PaymentLinkUpdate, type PaymentMethodField, type PaymentMethodOption, type PaymentNextAction, type PaymentSettlement, type PaymentStatus, type PaymentTestScenario, type Payout, type Plan, type PlanCheckoutCreate, type PlanCouponCreate, type PlanCreate, type PlanFeatureValues, type PlanFeaturesInput, type PlanLinkCreate, type PlanPrice, type PlanPriceInput, type PlanSeats, type PlanUpdate, type PortalFeatures, type PortalSession, type PortalSessionCreate, type Product, type ProductCategory, type ProductCheckoutCreate, type ProductCouponCreate, type ProductCreate, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicCheckoutItem, type PublicClaim, type PublicClaimSummary, type PublicFulfillment, type PublicInvoice, type PublicPaymentLink, type PublicPaymentState, type PublicPortal, type RESET_FREQUENCIES, type RISK_LEVELS, type ReceiptReference, type ReceiptSend, type Refund, type RefundCreate, type RequestOptions, type ResetFrequency, type RiskLevel, type SUBMIT_LABELS, type SUBSCRIPTION_STATUSES, type SubmitLabel, type SubscribableEventType, type Subscription, type SubscriptionCancel, type SubscriptionChange, type SubscriptionChangeCreate, type SubscriptionChangePreview, type SubscriptionChangePreviewInput, type SubscriptionChangeResult, type SubscriptionCreate, type SubscriptionRenewal, type SubscriptionStatus, type SubscriptionTerms, type SubscriptionUpdate, type TAX_BEHAVIORS, type TaxBehavior, type Timestamp, type TokenKind, type TransportOptions, type USAGE_FEATURE_TYPES, type VENEZUELAN_BANKS, type VariantInput, type WEBHOOK_TEST_EVENT, type WebhookEndpoint, type WebhookEndpointCreate, type WebhookEndpointUpdate, type WebhookEvent, WebhookVerificationError, type Weekday, type apiVersionLifecycle, type apiVersionStage, type currentApiVersion, type findBank, type isApiVersion, type isApiVersionRetired, type isLandlinePhone, type isMobilePhone, type nationalPhone, type supportedApiVersions, type tokenEnvironment, type tokenPrefix, verifyWebhook };
|
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-Do9Fl8fk.js";
|
|
2
2
|
import { WebhookVerificationError, verifyWebhook } from "./webhooks.js";
|
|
3
3
|
//#region ../contracts/src/environment.ts
|
|
4
4
|
/**
|
|
@@ -56,6 +56,17 @@ function collection(http, path) {
|
|
|
56
56
|
iterate: (query = {}) => http.paginate(path, { ...query })
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Deletes one: it leaves every list and can no longer be used, but stays readable by ID. Answers
|
|
61
|
+
* it as deleted (`deletedAt`); deleting it again changes nothing.
|
|
62
|
+
*/
|
|
63
|
+
function deletion(http, path) {
|
|
64
|
+
return (id, options) => http.request({
|
|
65
|
+
method: "DELETE",
|
|
66
|
+
path: `${path}/${segment(id)}`,
|
|
67
|
+
options
|
|
68
|
+
});
|
|
69
|
+
}
|
|
59
70
|
function fromEnv(name) {
|
|
60
71
|
return globalThis.process?.env?.[name];
|
|
61
72
|
}
|
|
@@ -64,7 +75,7 @@ function fromEnv(name) {
|
|
|
64
75
|
*
|
|
65
76
|
* ```ts
|
|
66
77
|
* // Reads BILLETE_API_KEY.
|
|
67
|
-
* const billete = createBillete({ apiVersion: "2026-10-
|
|
78
|
+
* const billete = createBillete({ apiVersion: "2026-10-20", environment: "test" });
|
|
68
79
|
* const { allowed } = await billete.features.consume("user_123", "tokens", 850);
|
|
69
80
|
* ```
|
|
70
81
|
*/
|
|
@@ -131,37 +142,32 @@ create: (input, options) => http.request({
|
|
|
131
142
|
}) };
|
|
132
143
|
const products = {
|
|
133
144
|
...collection(http, "/v1/products"),
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
retireVariant: (product, variant, input = {}, options) => http.request({
|
|
141
|
-
method: "POST",
|
|
142
|
-
path: `/v1/products/${segment(product)}/variants/${segment(variant)}/retire`,
|
|
143
|
-
body: input,
|
|
145
|
+
/** Also deletes its variants and payment links. Open checkouts can still be paid. */
|
|
146
|
+
delete: deletion(http, "/v1/products"),
|
|
147
|
+
/** Answers the product; links left without a variant to offer are deleted too. */
|
|
148
|
+
deleteVariant: (product, variant, options) => http.request({
|
|
149
|
+
method: "DELETE",
|
|
150
|
+
path: `/v1/products/${segment(product)}/variants/${segment(variant)}`,
|
|
144
151
|
options
|
|
145
152
|
})
|
|
146
153
|
};
|
|
147
|
-
const plans =
|
|
154
|
+
const plans = {
|
|
155
|
+
...collection(http, "/v1/plans"),
|
|
156
|
+
/**
|
|
157
|
+
* Only a plan no subscription is in and no other plan falls back to (`plan_in_use`);
|
|
158
|
+
* deactivate the rest. Also deletes its payment links.
|
|
159
|
+
*/
|
|
160
|
+
delete: deletion(http, "/v1/plans")
|
|
161
|
+
};
|
|
148
162
|
const coupons = {
|
|
149
163
|
...collection(http, "/v1/coupons"),
|
|
150
|
-
/**
|
|
151
|
-
delete: (
|
|
152
|
-
method: "DELETE",
|
|
153
|
-
path: `/v1/coupons/${segment(id)}`,
|
|
154
|
-
options
|
|
155
|
-
})
|
|
164
|
+
/** Frees its code; subscriptions and open payments that hold it keep their discount. */
|
|
165
|
+
delete: deletion(http, "/v1/coupons")
|
|
156
166
|
};
|
|
157
167
|
const paymentLinks = {
|
|
158
168
|
...collection(http, "/v1/payment-links"),
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
path: `/v1/payment-links/${segment(id)}/retire`,
|
|
162
|
-
body: input,
|
|
163
|
-
options
|
|
164
|
-
})
|
|
169
|
+
/** Open checkouts can still be paid. */
|
|
170
|
+
delete: deletion(http, "/v1/payment-links")
|
|
165
171
|
};
|
|
166
172
|
const customerFeature = (customer, key) => `/v1/customers/${segment(customer)}/features/${segment(key)}`;
|
|
167
173
|
const featureCrud = collection(http, "/v1/features");
|
|
@@ -173,6 +179,11 @@ create: (input, options) => http.request({
|
|
|
173
179
|
/** Renames a feature or changes its schedule; `key` also takes its `feat_` ID. */
|
|
174
180
|
update: (key, input, options) => featureCrud.update(key, input, options),
|
|
175
181
|
/**
|
|
182
|
+
* Only a feature no plan grants (`feature_in_use`). Frees its key; after that, only its `feat_`
|
|
183
|
+
* ID finds it.
|
|
184
|
+
*/
|
|
185
|
+
delete: deletion(http, "/v1/features"),
|
|
186
|
+
/**
|
|
176
187
|
* Reserves `amount` of a metered feature for one job: it counts as used right away and the
|
|
177
188
|
* operation is closed later through `features.operations`. Repeating `operation` returns the
|
|
178
189
|
* same reservation without consuming again; running each job once is your queue's job.
|
|
@@ -317,7 +328,8 @@ create: (input, options) => http.request({
|
|
|
317
328
|
},
|
|
318
329
|
/**
|
|
319
330
|
* Cancels at period end by default; pass `{ atPeriodEnd: false }` to end it now. With a
|
|
320
|
-
* fallback plan it moves to that free plan instead (`subscription.updated`), keeping its ID
|
|
331
|
+
* fallback plan it moves to that free plan instead (`subscription.updated`), keeping its ID,
|
|
332
|
+
* unless you also pass `fallback: false`.
|
|
321
333
|
*/
|
|
322
334
|
cancel: (id, input = {}, options) => http.request({
|
|
323
335
|
method: "POST",
|
|
@@ -424,11 +436,8 @@ create: (input, options) => http.request({
|
|
|
424
436
|
};
|
|
425
437
|
const webhookEndpoints = {
|
|
426
438
|
...collection(http, "/v1/webhook-endpoints"),
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
path: `/v1/webhook-endpoints/${segment(id)}`,
|
|
430
|
-
options
|
|
431
|
-
})
|
|
439
|
+
/** Stops its events; its deliveries stay as history. */
|
|
440
|
+
delete: deletion(http, "/v1/webhook-endpoints")
|
|
432
441
|
};
|
|
433
442
|
const eventCrud = collection(http, "/v1/events");
|
|
434
443
|
return {
|
package/dist/webhooks.d.ts
CHANGED