@boelabs/billete-sdk 6.1.0 → 8.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-DYVtvVCW.d.ts → errors-DERevGF5.d.ts} +16 -8
- package/dist/{events-DCYMRhVr.d.ts → events-b2qMWZF8.d.ts} +61 -26
- package/dist/{http-BXhZoczC.js → http-CNxkDxq4.js} +1 -1
- package/dist/index.d.ts +32 -14
- package/dist/index.js +38 -30
- 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-21", 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-21",
|
|
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-21", 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-DERevGF5.js";
|
|
2
|
+
import { $ as FulfillmentHandover, $t as PaymentFailureCode, A as Coupon, An as Environment, At as Refund, B as Event, Bt as SubscriptionRenewal, C as CheckoutPurpose, Cn as Timestamp, Ct as PlanSeats, D as ClaimReason, Dn as isMobilePhone, Dt as ProductVariant, E as ClaimOutcome, En as isLandlinePhone, 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, Mn as tokenEnvironment, Mt as RiskLevel, N as Customer, Nn as tokenPrefix, Nt as SUBMIT_LABELS, O as ClaimStatus, On as nationalPhone, 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 TaxBehavior, St as PlanPrice, T as ClaimMessage, Tn as findBank, 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 SuspensionDays, 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 TokenKind, jt as ResetFrequency, k as CollectSettings, kn as ENVIRONMENTS, 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 VENEZUELAN_BANKS, wt as PortalSession, x as Checkout, xn as TAX_BEHAVIORS, xt as PlanFeatureValues, y as Carrier, yn as SUSPENSION_DAYS, yt as Payout, z as Deletion, zt as SubscriptionChangeResult } from "./events-b2qMWZF8.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-21", 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 SUSPENSION_DAYS, 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 SuspensionDays, 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-CNxkDxq4.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-BX
|
|
|
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-21", 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, An as Environment, At as Refund, C as CheckoutPurpose, Cn as Timestamp, 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, P as CustomerDetails, S as CheckoutItem, Sn as TaxBehavior, St as PlanPrice, T as ClaimMessage, Yt as ApiErrorBody, Z as Fulfillment, Zt as ApiErrorType, _n as Metadata, b as CarrierOffice, bn as SuspensionDays, 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, y as Carrier } from "./events-b2qMWZF8.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", "2026-10-21"];
|
|
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[];
|
|
@@ -676,6 +674,11 @@ interface PlanCreate {
|
|
|
676
674
|
prices: PlanPriceInput[];
|
|
677
675
|
trialDays?: number;
|
|
678
676
|
gracePeriodDays?: GracePeriodDays;
|
|
677
|
+
/**
|
|
678
|
+
* Days the subscription stays suspended after the grace period, payable to reactivate it, before
|
|
679
|
+
* it expires. Not with `fallbackPlanId`: a plan either falls back or suspends.
|
|
680
|
+
*/
|
|
681
|
+
suspensionDays?: SuspensionDays;
|
|
679
682
|
taxBehavior?: TaxBehavior;
|
|
680
683
|
highlights?: string[];
|
|
681
684
|
features?: PlanFeaturesInput;
|
|
@@ -692,6 +695,11 @@ interface PlanUpdate {
|
|
|
692
695
|
prices?: PlanPriceInput[];
|
|
693
696
|
trialDays?: number;
|
|
694
697
|
gracePeriodDays?: GracePeriodDays;
|
|
698
|
+
/**
|
|
699
|
+
* Days the subscription stays suspended after the grace period, payable to reactivate it, before
|
|
700
|
+
* it expires. Not with `fallbackPlanId`: a plan either falls back or suspends.
|
|
701
|
+
*/
|
|
702
|
+
suspensionDays?: SuspensionDays;
|
|
695
703
|
taxBehavior?: TaxBehavior;
|
|
696
704
|
highlights?: string[];
|
|
697
705
|
/** Replaces the plan feature grants. Takes effect immediately for every subscriber. */
|
|
@@ -1126,4 +1134,4 @@ declare class BilleteError extends Error {
|
|
|
1126
1134
|
}, status: number, options?: ErrorOptions);
|
|
1127
1135
|
}
|
|
1128
1136
|
//#endregion
|
|
1129
|
-
export { ProductCheckoutCreate as $, CustomerUpdate as A,
|
|
1137
|
+
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 };
|
|
@@ -33,6 +33,12 @@ declare const MAX_QUANTITY = 999;
|
|
|
33
33
|
*/
|
|
34
34
|
declare const GRACE_PERIOD_DAYS: readonly [0, 1, 3, 7];
|
|
35
35
|
type GracePeriodDays = (typeof GRACE_PERIOD_DAYS)[number];
|
|
36
|
+
/**
|
|
37
|
+
* Days a subscription stays suspended once its grace period ends unpaid: without access, its
|
|
38
|
+
* renewal still payable to reactivate it. `0`, the default, is none: it expires instead.
|
|
39
|
+
*/
|
|
40
|
+
declare const SUSPENSION_DAYS: readonly [0, 7, 14, 30, 60, 90];
|
|
41
|
+
type SuspensionDays = (typeof SUSPENSION_DAYS)[number];
|
|
36
42
|
/** `inclusive`: the price already contains the account tax. `exclusive`: tax is added on top. */
|
|
37
43
|
declare const TAX_BEHAVIORS: readonly ["inclusive", "exclusive"];
|
|
38
44
|
type TaxBehavior = (typeof TAX_BEHAVIORS)[number];
|
|
@@ -281,7 +287,7 @@ declare const API_ERROR_CODES: {
|
|
|
281
287
|
readonly checkout_not_editable: "Este checkout no se puede modificar.";
|
|
282
288
|
readonly checkout_not_found: "No existe el checkout.";
|
|
283
289
|
readonly checkout_not_open: "Solo se pueden vencer checkouts abiertos.";
|
|
284
|
-
readonly checkout_selection_locked: "El producto o la variante fue
|
|
290
|
+
readonly checkout_selection_locked: "El producto o la variante fue eliminado. Puedes completar el pago con la selección actual, pero no modificarla.";
|
|
285
291
|
readonly claim_already_open: "Ya tienes un reclamo abierto por este pago: síguelo desde el enlace que te enviamos por correo.";
|
|
286
292
|
readonly claim_closed: "Este reclamo ya está cerrado.";
|
|
287
293
|
readonly claim_limit_reached: "Ya no puedes abrir más reclamos por este pago: escribe directamente al negocio.";
|
|
@@ -290,11 +296,11 @@ declare const API_ERROR_CODES: {
|
|
|
290
296
|
readonly coupon_already_used: "Ya usaste este cupón.";
|
|
291
297
|
readonly coupon_applies_to_required: "Indica si el cupón es para productos o para planes (appliesTo).";
|
|
292
298
|
readonly coupon_currency_mismatch: "El cupón solo aplica a precios en otra moneda.";
|
|
299
|
+
readonly coupon_deleted: "Este cupón fue eliminado y no puede modificarse.";
|
|
293
300
|
readonly coupon_exhausted: "El cupón alcanzó su límite de usos.";
|
|
294
301
|
readonly coupon_exists: "Ya existe un cupón con ese código.";
|
|
295
302
|
readonly coupon_expired: "El cupón venció.";
|
|
296
303
|
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
304
|
readonly coupon_inactive: "El cupón está desactivado.";
|
|
299
305
|
readonly coupon_minimum_not_met: "El pedido no llega a la compra mínima del cupón.";
|
|
300
306
|
readonly coupon_not_applicable: "Un cupón no aplica a puestos agregados a mitad del periodo.";
|
|
@@ -316,7 +322,9 @@ declare const API_ERROR_CODES: {
|
|
|
316
322
|
readonly exchange_rate_unavailable: "No hay una tasa oficial vigente para ese par de monedas; inténtalo en unos minutos.";
|
|
317
323
|
readonly fallback_plan_nested: "Un plan usado como respaldo no puede tener otro respaldo.";
|
|
318
324
|
readonly fallback_plan_not_free: "El respaldo debe ser un plan gratuito activo, en la misma moneda y sin respaldo propio.";
|
|
325
|
+
readonly feature_deleted: "Esta cuota fue eliminada y no puede modificarse.";
|
|
319
326
|
readonly feature_exists: "Ya existe una cuota con esa clave.";
|
|
327
|
+
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
328
|
readonly feature_not_found: "No existe la cuota.";
|
|
321
329
|
readonly feature_not_metered: "Esa cuota no registra uso: solo las de consumo y de cantidad lo hacen.";
|
|
322
330
|
readonly feature_operation_not_allowed: "Solo las cuotas de consumo permiten operaciones.";
|
|
@@ -387,8 +395,8 @@ declare const API_ERROR_CODES: {
|
|
|
387
395
|
readonly payment_code_not_expected: "Este pago no está esperando un código.";
|
|
388
396
|
readonly payment_code_not_sent: "No pudimos enviar otro código.";
|
|
389
397
|
readonly payment_in_progress: "Espera a que termine el pago antes de cambiar la selección.";
|
|
398
|
+
readonly payment_link_deleted: "Este enlace fue eliminado y no puede modificarse.";
|
|
390
399
|
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
400
|
readonly payment_link_unavailable: "Este enlace de pago ya no está disponible.";
|
|
393
401
|
readonly payment_method_unavailable: "Ese método no permite pagar en la moneda del checkout o del cobro.";
|
|
394
402
|
readonly payment_not_claimable: "Solo puedes abrir un reclamo por un pago confirmado.";
|
|
@@ -398,14 +406,16 @@ declare const API_ERROR_CODES: {
|
|
|
398
406
|
readonly payout_account_change_pending: "Ya hay un cambio de la cuenta de retiro pendiente: cancélalo antes de pedir otro.";
|
|
399
407
|
readonly payout_not_found: "No existe el retiro.";
|
|
400
408
|
readonly phone_required: "Teléfono: este campo es obligatorio.";
|
|
401
|
-
readonly
|
|
409
|
+
readonly plan_deleted: "Este plan fue eliminado y no puede modificarse.";
|
|
410
|
+
readonly plan_in_use: "El plan tiene suscripciones en curso o es el respaldo de otro plan: desactívalo para no aceptar nuevas.";
|
|
411
|
+
readonly plan_inactive: "El plan está desactivado.";
|
|
402
412
|
readonly plan_not_found: "No existe el plan.";
|
|
403
413
|
readonly plan_seats_locked: "No puedes cambiar la forma de cobro de un plan con suscripciones.";
|
|
404
414
|
readonly portal_action_disabled: "El negocio no permite hacer este cambio desde el portal.";
|
|
405
415
|
readonly portal_session_invalid: "Este enlace ya se abrió o venció.";
|
|
416
|
+
readonly product_deleted: "Este producto fue eliminado.";
|
|
406
417
|
readonly product_inactive: "Este producto está desactivado.";
|
|
407
418
|
readonly product_not_found: "No existe el producto.";
|
|
408
|
-
readonly product_retired: "Este producto fue retirado.";
|
|
409
419
|
readonly product_unavailable: "Uno de los productos ya no existe.";
|
|
410
420
|
readonly production_already_enabled: "El negocio ya opera en producción.";
|
|
411
421
|
readonly production_not_enabled: "Completa la activación del negocio para usar producción.";
|
|
@@ -438,6 +448,8 @@ declare const API_ERROR_CODES: {
|
|
|
438
448
|
readonly subscription_not_canceling: "Esta suscripción no tiene una cancelación programada.";
|
|
439
449
|
readonly subscription_not_found: "No existe la suscripción.";
|
|
440
450
|
readonly subscription_renewal_open: "Paga la renovación o programa el cambio para el próximo periodo.";
|
|
451
|
+
readonly subscription_suspended: "La suscripción está suspendida: paga su renovación para reactivarla o cancélala.";
|
|
452
|
+
readonly suspension_with_fallback: "Un plan con suspensión no tiene plan de respaldo: elige uno de los dos.";
|
|
441
453
|
readonly tax_behavior_mismatch: "Todos los productos deben tratar los impuestos igual.";
|
|
442
454
|
readonly tax_id_prefix: "El RIF no corresponde al tipo de organización.";
|
|
443
455
|
readonly too_many_attempts: "Demasiados intentos de pago para este checkout.";
|
|
@@ -450,13 +462,14 @@ declare const API_ERROR_CODES: {
|
|
|
450
462
|
readonly unsubscribe_invalid: "El enlace no es válido.";
|
|
451
463
|
readonly unused_credit_not_accepted: "Este cambio pierde crédito no utilizado; acéptalo expresamente o prográmalo para la renovación.";
|
|
452
464
|
readonly validation_failed: "El cuerpo o la consulta no cumple el esquema; `param` dice qué campo.";
|
|
465
|
+
readonly variant_deleted: "Esta variante fue eliminada y no puede modificarse.";
|
|
466
|
+
readonly variant_deletion_required: "Elimina la variante explícitamente antes de quitarla del producto.";
|
|
453
467
|
readonly variant_not_found: "No existe la variante.";
|
|
454
468
|
readonly variant_pricing_required: "Con variantes, el precio y el stock se configuran por variante.";
|
|
455
469
|
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
470
|
readonly webhook_delivery_in_progress: "Este envío está en curso; podrás reenviarlo cuando termine.";
|
|
459
471
|
readonly webhook_delivery_not_found: "No existe el envío.";
|
|
472
|
+
readonly webhook_endpoint_deleted: "Este webhook fue eliminado y no puede modificarse.";
|
|
460
473
|
readonly webhook_endpoint_disabled: "Este webhook está desactivado: actívalo para enviarle eventos.";
|
|
461
474
|
readonly webhook_endpoint_not_found: "No existe el webhook.";
|
|
462
475
|
readonly webhook_signature_invalid: "La firma del evento no es válida.";
|
|
@@ -555,12 +568,15 @@ type Actor = {
|
|
|
555
568
|
type: "user" | "api_key";
|
|
556
569
|
id: string;
|
|
557
570
|
};
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
571
|
+
/**
|
|
572
|
+
* Set when it was deleted: it leaves every list and can no longer be used or changed, but stays
|
|
573
|
+
* readable by ID, because what was sold or charged with it still names it.
|
|
574
|
+
*/
|
|
575
|
+
interface Deletion {
|
|
576
|
+
deletedAt: Timestamp | null;
|
|
577
|
+
deletedBy: Actor | null;
|
|
562
578
|
}
|
|
563
|
-
interface ProductVariant extends
|
|
579
|
+
interface ProductVariant extends Deletion {
|
|
564
580
|
id: string;
|
|
565
581
|
name: string;
|
|
566
582
|
/** Free-form descriptors such as `{ color: "Rojo", talla: "M" }`. */
|
|
@@ -572,7 +588,7 @@ interface ProductVariant extends Retirement {
|
|
|
572
588
|
isDefault: boolean;
|
|
573
589
|
active: boolean;
|
|
574
590
|
}
|
|
575
|
-
interface Product extends Resource<"product">,
|
|
591
|
+
interface Product extends Resource<"product">, Deletion {
|
|
576
592
|
name: string;
|
|
577
593
|
/**
|
|
578
594
|
* The business's own name for it, unique among its products in each environment: unlike
|
|
@@ -607,7 +623,7 @@ interface PlanPrice {
|
|
|
607
623
|
* unlimited, for `metered` and `count`; the value itself for `number`.
|
|
608
624
|
*/
|
|
609
625
|
type PlanFeatureValues = Record<string, boolean | number | null>;
|
|
610
|
-
interface Plan extends Resource<"plan"
|
|
626
|
+
interface Plan extends Resource<"plan">, Deletion {
|
|
611
627
|
seats: PlanSeats;
|
|
612
628
|
fallbackPlanId: string | null;
|
|
613
629
|
name: string;
|
|
@@ -621,6 +637,11 @@ interface Plan extends Resource<"plan"> {
|
|
|
621
637
|
prices: PlanPrice[];
|
|
622
638
|
trialDays: number;
|
|
623
639
|
gracePeriodDays: GracePeriodDays;
|
|
640
|
+
/**
|
|
641
|
+
* Days an unpaid subscription stays `suspended` once the grace period ends: without access, its
|
|
642
|
+
* renewal payable to reactivate it. `0`: it expires (or falls back to `fallbackPlanId`) instead.
|
|
643
|
+
*/
|
|
644
|
+
suspensionDays: SuspensionDays;
|
|
624
645
|
taxBehavior: TaxBehavior;
|
|
625
646
|
/** Marketing bullet points shown on checkout pages. */
|
|
626
647
|
highlights: string[];
|
|
@@ -667,7 +688,7 @@ type FeatureReset = {
|
|
|
667
688
|
hour: number;
|
|
668
689
|
day: number;
|
|
669
690
|
};
|
|
670
|
-
interface Feature extends Resource<"feature"
|
|
691
|
+
interface Feature extends Resource<"feature">, Deletion {
|
|
671
692
|
per: "customer" | "member";
|
|
672
693
|
key: string;
|
|
673
694
|
name: string;
|
|
@@ -724,15 +745,25 @@ interface FeatureOperationResult extends FeatureUsageResult {
|
|
|
724
745
|
created: boolean;
|
|
725
746
|
operation: FeatureOperation | null;
|
|
726
747
|
}
|
|
727
|
-
declare const SUBSCRIPTION_STATUSES: readonly ["trialing", "active", "past_due",
|
|
748
|
+
declare const SUBSCRIPTION_STATUSES: readonly ["trialing", "active", "past_due",
|
|
749
|
+
/** Unpaid after the grace period: no access, its renewal still payable to reactivate it. */
|
|
750
|
+
"suspended", "canceled", "expired"];
|
|
728
751
|
type SubscriptionStatus = (typeof SUBSCRIPTION_STATUSES)[number];
|
|
729
752
|
interface SubscriptionRenewal {
|
|
730
|
-
/**
|
|
731
|
-
|
|
753
|
+
/**
|
|
754
|
+
* `upcoming`: not payable yet. `due`: payable before `dueAt`. `overdue`: in the grace period.
|
|
755
|
+
* `suspended`: access is lost; paying before `suspensionEndsAt` reactivates it.
|
|
756
|
+
*/
|
|
757
|
+
status: "upcoming" | "due" | "overdue" | "suspended";
|
|
732
758
|
opensAt: Timestamp;
|
|
733
759
|
dueAt: Timestamp;
|
|
734
760
|
graceEndsAt: Timestamp;
|
|
735
|
-
/**
|
|
761
|
+
/** When a suspended subscription expires; `null` when its plan does not suspend. */
|
|
762
|
+
suspensionEndsAt: Timestamp | null;
|
|
763
|
+
/**
|
|
764
|
+
* Whole days left until access is lost (`dueAt` or, when overdue, `graceEndsAt`) or, when
|
|
765
|
+
* suspended, until it expires (`suspensionEndsAt`).
|
|
766
|
+
*/
|
|
736
767
|
daysRemaining: number;
|
|
737
768
|
amount: number;
|
|
738
769
|
currency: Currency;
|
|
@@ -782,7 +813,7 @@ interface Subscription extends Resource<"subscription"> {
|
|
|
782
813
|
metadata: Metadata;
|
|
783
814
|
updatedAt: Timestamp;
|
|
784
815
|
}
|
|
785
|
-
interface Coupon extends Resource<"coupon"
|
|
816
|
+
interface Coupon extends Resource<"coupon">, Deletion {
|
|
786
817
|
code: string;
|
|
787
818
|
name: string | null;
|
|
788
819
|
percentOff: number | null;
|
|
@@ -830,7 +861,7 @@ type AfterCompletion = {
|
|
|
830
861
|
};
|
|
831
862
|
declare const SUBMIT_LABELS: readonly ["pay", "subscribe", "book", "donate"];
|
|
832
863
|
type SubmitLabel = (typeof SUBMIT_LABELS)[number];
|
|
833
|
-
interface PaymentLink extends Resource<"payment_link">,
|
|
864
|
+
interface PaymentLink extends Resource<"payment_link">, Deletion {
|
|
834
865
|
url: string;
|
|
835
866
|
type: "product" | "plan";
|
|
836
867
|
productId: string | null;
|
|
@@ -1320,7 +1351,7 @@ interface Payout extends Resource<"payout"> {
|
|
|
1320
1351
|
arrivalAt: Timestamp | null;
|
|
1321
1352
|
failureMessage: string | null;
|
|
1322
1353
|
}
|
|
1323
|
-
interface WebhookEndpoint extends Resource<"webhook_endpoint"
|
|
1354
|
+
interface WebhookEndpoint extends Resource<"webhook_endpoint">, Deletion {
|
|
1324
1355
|
url: string;
|
|
1325
1356
|
events: string[];
|
|
1326
1357
|
/**
|
|
@@ -1371,9 +1402,9 @@ interface PortalSession {
|
|
|
1371
1402
|
//#endregion
|
|
1372
1403
|
//#region ../contracts/src/events.d.ts
|
|
1373
1404
|
interface EventDataMap {
|
|
1374
|
-
"product.retired": Product;
|
|
1375
1405
|
"product.updated": Product;
|
|
1376
|
-
"
|
|
1406
|
+
"product.deleted": Product;
|
|
1407
|
+
"payment_link.deleted": PaymentLink;
|
|
1377
1408
|
"customer.created": Customer;
|
|
1378
1409
|
"customer.updated": Customer;
|
|
1379
1410
|
"customer.member_added": CustomerMember;
|
|
@@ -1424,6 +1455,10 @@ interface EventDataMap {
|
|
|
1424
1455
|
"subscription.renewed": Subscription;
|
|
1425
1456
|
/** The period ended unpaid; the customer keeps access until the grace period ends. */
|
|
1426
1457
|
"subscription.past_due": Subscription;
|
|
1458
|
+
/** Grace period over without payment: access is revoked until the renewal is paid. */
|
|
1459
|
+
"subscription.suspended": Subscription;
|
|
1460
|
+
/** A suspended subscription's renewal was paid: access is back, with a new period. */
|
|
1461
|
+
"subscription.reactivated": Subscription;
|
|
1427
1462
|
"subscription.canceled": Subscription;
|
|
1428
1463
|
/** Grace period over without payment; access is revoked. */
|
|
1429
1464
|
"subscription.expired": Subscription;
|
|
@@ -1438,7 +1473,7 @@ type EventType = keyof EventDataMap;
|
|
|
1438
1473
|
declare const WEBHOOK_TEST_EVENT: "webhook_endpoint.test";
|
|
1439
1474
|
/** What a webhook endpoint can subscribe to: everything that happens in a business. */
|
|
1440
1475
|
type SubscribableEventType = Exclude<EventType, typeof WEBHOOK_TEST_EVENT>;
|
|
1441
|
-
declare const EVENT_TYPES: readonly ["product.
|
|
1476
|
+
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.suspended", "subscription.reactivated", "subscription.canceled", "subscription.expired"];
|
|
1442
1477
|
/** A delivered webhook, discriminated by `type` so `data` narrows automatically. */
|
|
1443
1478
|
type WebhookEvent = { [TType in EventType]: {
|
|
1444
1479
|
id: string;
|
|
@@ -1451,4 +1486,4 @@ type WebhookEvent = { [TType in EventType]: {
|
|
|
1451
1486
|
data: EventDataMap[TType];
|
|
1452
1487
|
}; }[EventType];
|
|
1453
1488
|
//#endregion
|
|
1454
|
-
export {
|
|
1489
|
+
export { FulfillmentHandover as $, PaymentFailureCode as $t, Coupon as A, Environment as An, Refund as At, Event as B, SubscriptionRenewal as Bt, CheckoutPurpose as C, Timestamp as Cn, PlanSeats as Ct, ClaimReason as D, isMobilePhone as Dn, ProductVariant as Dt, ClaimOutcome as E, isLandlinePhone 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, tokenEnvironment as Mn, RiskLevel as Mt, Customer as N, tokenPrefix as Nn, SUBMIT_LABELS as Nt, ClaimStatus as O, nationalPhone 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, TaxBehavior as Sn, PlanPrice as St, ClaimMessage as T, findBank 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, SuspensionDays 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, TokenKind as jn, ResetFrequency as jt, CollectSettings as k, ENVIRONMENTS 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, VENEZUELAN_BANKS as wn, PortalSession as wt, Checkout as x, TAX_BEHAVIORS as xn, PlanFeatureValues as xt, Carrier as y, SUSPENSION_DAYS 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 = "8.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-DERevGF5.js";
|
|
2
|
+
import { $ as FulfillmentHandover, $t as PaymentFailureCode, A as Coupon, An as Environment, At as Refund, B as Event, Bt as SubscriptionRenewal, C as CheckoutPurpose, Cn as Timestamp, Ct as PlanSeats, D as ClaimReason, Dn as isMobilePhone, Dt as ProductVariant, E as ClaimOutcome, En as isLandlinePhone, 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, Mn as tokenEnvironment, Mt as RiskLevel, N as Customer, Nn as tokenPrefix, Nt as SUBMIT_LABELS, O as ClaimStatus, On as nationalPhone, 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 TaxBehavior, St as PlanPrice, T as ClaimMessage, Tn as findBank, 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 SuspensionDays, 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 TokenKind, jt as ResetFrequency, k as CollectSettings, kn as ENVIRONMENTS, 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 VENEZUELAN_BANKS, wt as PortalSession, x as Checkout, xn as TAX_BEHAVIORS, xt as PlanFeatureValues, y as Carrier, yn as SUSPENSION_DAYS, yt as Payout, z as Deletion, zt as SubscriptionChangeResult } from "./events-b2qMWZF8.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-21", 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>;
|
|
@@ -342,7 +359,8 @@ export declare function createBillete(options: BilleteOptions): {
|
|
|
342
359
|
list: (query?: Filters<object>, options?: RequestOptions) => Promise<List<WebhookEndpoint>>;
|
|
343
360
|
/** Iterates every item across pages: `for await (const item of iterate())`. */
|
|
344
361
|
iterate: (query?: Filters<object>) => AsyncGenerator<WebhookEndpoint, any, any>;
|
|
345
|
-
|
|
362
|
+
/** Stops its events; its deliveries stay as history. */
|
|
363
|
+
delete: (id: string, options?: RequestOptions) => Promise<WebhookEndpoint>;
|
|
346
364
|
};
|
|
347
365
|
events: {
|
|
348
366
|
retrieve: (id: string, options?: RequestOptions) => Promise<Event<Record<string, unknown>>>;
|
|
@@ -371,4 +389,4 @@ export declare function createBillete(options: BilleteOptions): {
|
|
|
371
389
|
/** The server client: what `createBillete` returns. */
|
|
372
390
|
type Billete = ReturnType<typeof createBillete>;
|
|
373
391
|
//#endregion
|
|
374
|
-
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 SUSPENSION_DAYS, 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 SuspensionDays, 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-CNxkDxq4.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-21", 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.
|
|
@@ -425,11 +436,8 @@ create: (input, options) => http.request({
|
|
|
425
436
|
};
|
|
426
437
|
const webhookEndpoints = {
|
|
427
438
|
...collection(http, "/v1/webhook-endpoints"),
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
path: `/v1/webhook-endpoints/${segment(id)}`,
|
|
431
|
-
options
|
|
432
|
-
})
|
|
439
|
+
/** Stops its events; its deliveries stay as history. */
|
|
440
|
+
delete: deletion(http, "/v1/webhook-endpoints")
|
|
433
441
|
};
|
|
434
442
|
const eventCrud = collection(http, "/v1/events");
|
|
435
443
|
return {
|
package/dist/webhooks.d.ts
CHANGED