@boelabs/billete-sdk 9.2.0 → 10.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -5
- package/dist/client.d.ts +17 -8
- package/dist/client.js +23 -4
- package/dist/{errors-BOTgfVNl.d.ts → errors-Dk3plV2O.d.ts} +32 -6
- package/dist/{events-D9CrG3Kp.d.ts → events-CLifhYGq.d.ts} +13 -35
- package/dist/{http-SRcg7gff.js → http-moOPtD7S.js} +1 -1
- package/dist/index.d.ts +4 -16
- package/dist/index.js +2 -15
- 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-
|
|
66
|
+
const billete = createBillete({ apiVersion: "2026-11-06.beta", 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-
|
|
94
|
+
apiVersion: "2026-11-06.beta",
|
|
95
95
|
environment: "production",
|
|
96
96
|
apiKey: process.env.BILLETE_API_KEY,
|
|
97
97
|
timeoutMs: 30_000,
|
|
@@ -136,8 +136,6 @@ Todos los métodos devuelven promesas con el recurso tipado. Los recursos con li
|
|
|
136
136
|
| `subscriptions` | `cancel`, `resume` |
|
|
137
137
|
| `payments` | `refund`, `listRefunds` |
|
|
138
138
|
| `fulfillments` | `deliver`, `submitTracking` (entregas de productos físicos; también `retrieve`, `list` e `iterate`) |
|
|
139
|
-
| `payouts` | — |
|
|
140
|
-
| `balance` | `retrieve` |
|
|
141
139
|
| `webhookEndpoints` | `delete` |
|
|
142
140
|
| `events` | `retrieve`, `list`, `iterate` |
|
|
143
141
|
| `exchangeRates` | `list` |
|
|
@@ -257,7 +255,7 @@ return { token: session.token };
|
|
|
257
255
|
// Navegador
|
|
258
256
|
import { createClient } from "@boelabs/billete-sdk/client";
|
|
259
257
|
|
|
260
|
-
const billete = createClient({ apiVersion: "2026-
|
|
258
|
+
const billete = createClient({ apiVersion: "2026-11-06.beta", customerSession: token });
|
|
261
259
|
|
|
262
260
|
const { data: subscriptions } = await billete.customer.subscriptions();
|
|
263
261
|
const tokens = await billete.customer.feature("tokens");
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as PortalSessionCreate, A as CustomerSessionCreate, At as
|
|
2
|
-
import { $ as
|
|
1
|
+
import { $ as PortalSessionCreate, A as CustomerSessionCreate, At as PublicFulfillmentRefund, B as FulfillmentTrackingInput, Bt as ApiVersion, C as CouponCreate, Ct as PaymentsUnavailable, D as CustomerInput, Dt as PublicClaim, E as CustomerCreate, Et as PublicCheckoutItem, F as FeatureOperationCreate, Ft as PublicPortal, G as PaymentLinkUpdate, Gt as apiVersionLifecycle, H as InvoiceLineInput, Ht as ApiVersionStage, I as FeatureUpdate, It as PublicRefund, J as PlanCreate, Jt as isApiVersion, K as PlanCheckoutCreate, Kt as apiVersionStage, L as FulfillmentDeliverInput, Lt as API_VERSIONS, M as EventSelector, Mt as PublicMerchant, N as FeatureCreate, Nt as PublicPaymentLink, O as CustomerMemberCreate, Ot as PublicClaimSummary, P as FeatureOperationCommit, Pt as PublicPaymentState, Q as PlanUpdate, R as FulfillmentHandoverInput, Rt as API_VERSION_HEADER, S as CollectInput, St as PaymentTestScenario, T as CustomFieldInput, Tt as PublicCheckout, U as KEY_PATTERN, Ut as LATEST_API_VERSION, V as InvoiceCreate, Vt as ApiVersionLifecycle, W as PaymentLinkCreate, Wt as LatestApiVersion, X as PlanLinkCreate, Xt as supportedApiVersions, Y as PlanFeaturesInput, Yt as isApiVersionRetired, Z as PlanPriceInput, _ as ClientPaymentCode, _t as PaymentInstructions, a as AfterCompletionInput, at as RefundCreate, b as ClientSubscriptionSeats, bt as PaymentMethodOption, c as ClaimResolve, ct as SubscriptionChangePreviewInput, d as ClientCheckoutUpdate, dt as VariantInput, et as ProductCheckoutCreate, f as ClientClaimCreate, ft as WebhookEndpointCreate, g as ClientLinkCheckout, gt as FulfillmentOption, h as ClientInvoicePay, ht as CustomerSubscriptionChangeResult, i as TransportOptions, it as ProductUpdate, j as CustomerUpdate, jt as PublicInvoice, k as CustomerMemberUpdate, kt as PublicFulfillment, l as ClaimRespond, lt as SubscriptionCreate, m as ClientFulfillmentProblem, mt as CustomerSubscription, n as BilleteErrorCode, nt as ProductCreate, o as CheckoutCreate, ot as SubscriptionCancel, p as ClientCustomerClaimCreate, pt as WebhookEndpointUpdate, q as PlanCouponCreate, qt as currentApiVersion, r as RequestOptions, rt as ProductLinkCreate, s as CheckoutItemInput, st as SubscriptionChangeCreate, t as BilleteError, tt as ProductCouponCreate, u as ClientCheckoutPay, ut as SubscriptionUpdate, v as ClientRefundDestination, vt as PaymentMethodField, w as CouponUpdate, wt as PortalFeatures, x as ClientSubscriptionUpdate, xt as PaymentNextAction, y as ClientSubscriptionCancel, yt as PaymentMethodList, z as FulfillmentInput, zt as API_VERSION_PATTERN } from "./errors-Dk3plV2O.js";
|
|
2
|
+
import { $ as FulfillmentStatus, $t as API_ERROR_CODES, A as CustomField, An as TokenKind, At as ResetFrequency, B as FEATURE_TYPES, Bt as SubscriptionStatus, C as ClaimMessage, Cn as VENEZUELAN_BANKS, Ct as ProductCategory, D as CollectSettings, Dn as nationalPhone, Dt as RESET_FREQUENCIES, E as ClaimStatus, En as isMobilePhone, Et as REFUND_MODES, F as CustomerMemberList, Ft as Subscription, G as FeatureOperationResult, Gt as ReceiptReference, H as FULFILLMENT_STATUSES, Ht as USAGE_FEATURE_TYPES, I as CustomerSession, It as SubscriptionChange, J as FeatureUsageResult, Jt as ApiErrorBody, K as FeatureReset, Kt as ReceiptSend, L as Deletion, Lt as SubscriptionChangePreview, M as CustomerDetails, Mn as tokenPrefix, Mt as SUBMIT_LABELS, N as CustomerFeature, Nt as SUBSCRIPTION_STATUSES, O as Coupon, On as ENVIRONMENTS, Ot as RISK_LEVELS, P as CustomerMember, Pt as SubmitLabel, Q as FulfillmentMethod, Qt as PaymentFailureCode, R as Event, Rt as SubscriptionChangeResult, S as Claim, Sn as Timestamp, St as Product, T as ClaimReason, Tn as isLandlinePhone, Tt as ProductVariant, U as Feature, Ut as WebhookEndpoint, V as FULFILLMENT_METHODS, Vt as SubscriptionTerms, W as FeatureOperation, Wt as Weekday, X as FulfillmentChoice, Xt as ApiErrorType, Y as Fulfillment, Yt as ApiErrorEnvelope, Z as FulfillmentHandover, Zt as PAYMENT_FAILURE_CODES, _ as Carrier, _n as MobilePrefix, _t as Plan, a as WEBHOOK_TEST_EVENT, an as BankCode, at as InvoiceStatus, b as CheckoutItem, bn as TAX_BEHAVIORS, bt as PlanSeats, c as AfterCompletion, cn as Currency, ct as PAYMENT_STATUSES, d as CARRIER_TEST_SCENARIOS, dn as List, dt as PaymentAttempt, en as ApiErrorCode, et as FulfillmentTracking, f as CHECKOUT_PURPOSES, fn as ListQuery, ft as PaymentFailure, g as CancellationFeedback, gn as Metadata, gt as PaymentStatus, h as CLAIM_STATUSES, hn as MOBILE_PREFIXES, ht as PaymentSettlement, i as SubscribableEventType, in as BILLING_MONTHS, it as InvoiceReason, j as Customer, jn as tokenEnvironment, jt as RiskLevel, k as CurrencyAvailability, kn as Environment, kt as Refund, l as CANCELLATION_FEEDBACK, ln as GRACE_PERIOD_DAYS, lt as PRODUCT_CATEGORIES, m as CLAIM_REASONS, mn as MAX_QUANTITY, mt as PaymentLink, n as EventDataMap, nn as Address, nt as INVOICE_STATUSES, o as WebhookEvent, on as BillingMonths, ot as LineItem, p as CLAIM_OUTCOMES, pn as ListSort, pt as PaymentFeeDetails, q as FeatureType, qt as API_ERROR_TYPES, r as EventType, rn as AddressInput, rt as Invoice, s as Actor, sn as CURRENCIES, st as MAX_SEATS, t as EVENT_TYPES, tn as ACCOUNT_NUMBER_LENGTH, tt as INVOICE_REASONS, u as CARRIERS, un as GracePeriodDays, ut as Payment, v as CarrierOffice, vn as SUSPENSION_DAYS, vt as PlanFeatureValues, w as ClaimOutcome, wn as findBank, wt as ProductImage, x as CheckoutPurpose, xn as TaxBehavior, xt as PortalSession, y as Checkout, yn as SuspensionDays, yt as PlanPrice, z as ExchangeRate, zt as SubscriptionRenewal } from "./events-CLifhYGq.js";
|
|
3
3
|
interface ClientOptions extends TransportOptions {
|
|
4
4
|
/**
|
|
5
5
|
* Token from `billete.customerSessions.create()` on your server. Needed only for the
|
|
@@ -13,7 +13,7 @@ interface ClientOptions extends TransportOptions {
|
|
|
13
13
|
* and customer data requires a short-lived customer session minted by your server.
|
|
14
14
|
*
|
|
15
15
|
* ```ts
|
|
16
|
-
* const billete = createClient({ apiVersion: "2026-
|
|
16
|
+
* const billete = createClient({ apiVersion: "2026-11-06.beta", customerSession: token });
|
|
17
17
|
* const [subscription] = (await billete.customer.subscriptions()).data;
|
|
18
18
|
* if (subscription?.renewal?.status === "overdue") showBanner(subscription.renewal);
|
|
19
19
|
* ```
|
|
@@ -40,7 +40,7 @@ export declare function createClient(options: ClientOptions): {
|
|
|
40
40
|
/** Changes quantity, variant, billing cycle or coupon on a payment link checkout. */
|
|
41
41
|
update: (id: string, changes: ClientCheckoutUpdate, options?: RequestOptions) => Promise<PublicCheckout>;
|
|
42
42
|
/** Methods that can pay this checkout, with the converted amount and transfer details. */
|
|
43
|
-
paymentMethods: (id: string, options?: RequestOptions) => Promise<
|
|
43
|
+
paymentMethods: (id: string, options?: RequestOptions) => Promise<PaymentMethodList>;
|
|
44
44
|
/** Submits the payment; the returned checkout carries the payment status and any failure. */
|
|
45
45
|
pay: (id: string, input: ClientCheckoutPay, options?: RequestOptions) => Promise<PublicCheckout>;
|
|
46
46
|
openClaim: (id: string, input: ClientClaimCreate, options?: RequestOptions) => Promise<PublicClaim>;
|
|
@@ -62,7 +62,7 @@ export declare function createClient(options: ClientOptions): {
|
|
|
62
62
|
waitSeconds?: number;
|
|
63
63
|
}) => Promise<PublicInvoice>;
|
|
64
64
|
/** Methods that can pay this Cobro, with the converted amount and transfer details. */
|
|
65
|
-
paymentMethods: (id: string, options?: RequestOptions) => Promise<
|
|
65
|
+
paymentMethods: (id: string, options?: RequestOptions) => Promise<PaymentMethodList>;
|
|
66
66
|
/** Submits the payment; the returned Cobro carries the payment status and any failure. */
|
|
67
67
|
pay: (id: string, input: ClientInvoicePay, options?: RequestOptions) => Promise<PublicInvoice>;
|
|
68
68
|
openClaim: (id: string, input: ClientClaimCreate, options?: RequestOptions) => Promise<PublicClaim>;
|
|
@@ -81,14 +81,23 @@ export declare function createClient(options: ClientOptions): {
|
|
|
81
81
|
* claim (`claim`), whose page (`claim.url`) the customer follows.
|
|
82
82
|
*/
|
|
83
83
|
openClaim: (token: string, input: ClientClaimCreate, options?: RequestOptions) => Promise<PublicFulfillment>;
|
|
84
|
-
/** Something went wrong:
|
|
84
|
+
/** Something went wrong: Billete reviews it between the business and its customer. */
|
|
85
85
|
reportProblem: (token: string, input: ClientFulfillmentProblem, options?: RequestOptions) => Promise<PublicFulfillment>;
|
|
86
86
|
/**
|
|
87
|
-
* Where
|
|
87
|
+
* Where the business sends the customer's refund by Pago Móvil, while it waits for one
|
|
88
88
|
* (`refund.status: "needs_destination"`).
|
|
89
89
|
*/
|
|
90
90
|
setRefundDestination: (token: string, input: ClientRefundDestination, options?: RequestOptions) => Promise<PublicFulfillment>;
|
|
91
91
|
};
|
|
92
|
+
/**
|
|
93
|
+
* A refund its business returns by Pago Móvil, as its customer follows it. The `token` comes in
|
|
94
|
+
* its page's link, sent by email when the business needs to know where to send it.
|
|
95
|
+
*/
|
|
96
|
+
refunds: {
|
|
97
|
+
retrieve: (token: string, options?: RequestOptions) => Promise<PublicRefund>;
|
|
98
|
+
/** Where to receive it, while the business waits for it (`refund.status: "needs_destination"`). */
|
|
99
|
+
setDestination: (token: string, input: ClientRefundDestination, options?: RequestOptions) => Promise<PublicRefund>;
|
|
100
|
+
};
|
|
92
101
|
/**
|
|
93
102
|
* A claim about a payment, as its customer follows it. The `token` comes in its page's link
|
|
94
103
|
* (`url`), sent by email when it is opened, and is the only credential.
|
|
@@ -137,4 +146,4 @@ export declare function createClient(options: ClientOptions): {
|
|
|
137
146
|
};
|
|
138
147
|
};
|
|
139
148
|
type BilleteClient = ReturnType<typeof createClient>;
|
|
140
|
-
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
|
|
149
|
+
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 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 ClientRefundDestination, 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 PaymentMethodList, type PaymentMethodOption, type PaymentNextAction, type PaymentSettlement, type PaymentStatus, type PaymentTestScenario, type PaymentsUnavailable, 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 ProductImage, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicCheckoutItem, type PublicClaim, type PublicClaimSummary, type PublicFulfillment, type PublicFulfillmentRefund, type PublicInvoice, type PublicMerchant, type PublicPaymentLink, type PublicPaymentState, type PublicPortal, type PublicRefund, type REFUND_MODES, 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-moOPtD7S.js";
|
|
2
2
|
// 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-SR
|
|
|
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-
|
|
9
|
+
* const billete = createClient({ apiVersion: "2026-11-06.beta", customerSession: token });
|
|
10
10
|
* const [subscription] = (await billete.customer.subscriptions()).data;
|
|
11
11
|
* if (subscription?.renewal?.status === "overdue") showBanner(subscription.renewal);
|
|
12
12
|
* ```
|
|
@@ -67,6 +67,7 @@ function createClient(options) {
|
|
|
67
67
|
});
|
|
68
68
|
const invoicePath = (id) => `/v1/client/invoices/${segment(id)}`;
|
|
69
69
|
const fulfillmentPath = (token) => `/v1/client/fulfillments/${segment(token)}`;
|
|
70
|
+
const refundPath = (token) => `/v1/client/refunds/${segment(token)}`;
|
|
70
71
|
const claimPath = (token) => `/v1/client/claims/${segment(token)}`;
|
|
71
72
|
/** Opens a claim about the payment of a paid checkout or Cobro, from its page. */
|
|
72
73
|
const openClaim = (path) => (id, input, options) => http.request({
|
|
@@ -163,7 +164,7 @@ function createClient(options) {
|
|
|
163
164
|
body: input,
|
|
164
165
|
options
|
|
165
166
|
}),
|
|
166
|
-
/** Something went wrong:
|
|
167
|
+
/** Something went wrong: Billete reviews it between the business and its customer. */
|
|
167
168
|
reportProblem: (token, input, options) => http.request({
|
|
168
169
|
method: "POST",
|
|
169
170
|
path: `${fulfillmentPath(token)}/problem`,
|
|
@@ -171,7 +172,7 @@ function createClient(options) {
|
|
|
171
172
|
options
|
|
172
173
|
}),
|
|
173
174
|
/**
|
|
174
|
-
* Where
|
|
175
|
+
* Where the business sends the customer's refund by Pago Móvil, while it waits for one
|
|
175
176
|
* (`refund.status: "needs_destination"`).
|
|
176
177
|
*/
|
|
177
178
|
setRefundDestination: (token, input, options) => http.request({
|
|
@@ -182,6 +183,24 @@ function createClient(options) {
|
|
|
182
183
|
})
|
|
183
184
|
},
|
|
184
185
|
/**
|
|
186
|
+
* A refund its business returns by Pago Móvil, as its customer follows it. The `token` comes in
|
|
187
|
+
* its page's link, sent by email when the business needs to know where to send it.
|
|
188
|
+
*/
|
|
189
|
+
refunds: {
|
|
190
|
+
retrieve: (token, options) => http.request({
|
|
191
|
+
method: "GET",
|
|
192
|
+
path: refundPath(token),
|
|
193
|
+
options
|
|
194
|
+
}),
|
|
195
|
+
/** Where to receive it, while the business waits for it (`refund.status: "needs_destination"`). */
|
|
196
|
+
setDestination: (token, input, options) => http.request({
|
|
197
|
+
method: "PUT",
|
|
198
|
+
path: `${refundPath(token)}/destination`,
|
|
199
|
+
body: input,
|
|
200
|
+
options
|
|
201
|
+
})
|
|
202
|
+
},
|
|
203
|
+
/**
|
|
185
204
|
* A claim about a payment, as its customer follows it. The `token` comes in its page's link
|
|
186
205
|
* (`url`), sent by email when it is opened, and is the only credential.
|
|
187
206
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $
|
|
1
|
+
import { $ as FulfillmentStatus, A as CustomField, C as ClaimMessage, Ct as ProductCategory, D as CollectSettings, E as ClaimStatus, Ft as Subscription, Gt as ReceiptReference, Jt as ApiErrorBody, K as FeatureReset, M as CustomerDetails, Pt as SubmitLabel, Q as FulfillmentMethod, Qt as PaymentFailureCode, Sn as Timestamp, T as ClaimReason, Xt as ApiErrorType, Y as Fulfillment, _ as Carrier, at as InvoiceStatus, b as CheckoutItem, bt as PlanSeats, c as AfterCompletion, cn as Currency, dn as List, en as ApiErrorCode, et as FulfillmentTracking, ft as PaymentFailure, g as CancellationFeedback, gn as Metadata, gt as PaymentStatus, i as SubscribableEventType, it as InvoiceReason, kn as Environment, kt as Refund, nn as Address, on as BillingMonths, ot as LineItem, rn as AddressInput, un as GracePeriodDays, v as CarrierOffice, w as ClaimOutcome, x as CheckoutPurpose, xn as TaxBehavior, yn as SuspensionDays, yt as PlanPrice } from "./events-CLifhYGq.js";
|
|
2
2
|
/**
|
|
3
3
|
* Billete API versions. Kept free of runtime dependencies: the dashboard, the API, the worker and
|
|
4
4
|
* the docs read it, and the public SDK pins its newest entry as a type.
|
|
@@ -12,7 +12,7 @@ import { $t as ApiErrorType, C as CheckoutPurpose, Ct as PlanSeats, D as ClaimRe
|
|
|
12
12
|
* Every version published, oldest first. The history starts at `2026-10-24`, the first version
|
|
13
13
|
* open to businesses. Append only: retired versions stay listed.
|
|
14
14
|
*/
|
|
15
|
-
declare const API_VERSIONS: readonly ["2026-10-24"];
|
|
15
|
+
declare const API_VERSIONS: readonly ["2026-10-24", "2026-11-06.beta"];
|
|
16
16
|
type ApiVersion = (typeof API_VERSIONS)[number];
|
|
17
17
|
type LatestApiVersion = typeof API_VERSIONS extends readonly [...unknown[], infer Last] ? Last : never;
|
|
18
18
|
/** The version the code speaks: responses are built in its shape. Always the last entry. */
|
|
@@ -295,13 +295,22 @@ interface PublicFulfillment {
|
|
|
295
295
|
cancellationReason: Fulfillment["cancellationReason"];
|
|
296
296
|
/** The latest claim about it, followed on its page (`url`); `null` without one. */
|
|
297
297
|
claim: PublicClaimSummary | null;
|
|
298
|
-
/**
|
|
298
|
+
/** The latest refund of the purchase, as its customer follows it; `null` without one. */
|
|
299
299
|
refund: PublicFulfillmentRefund | null;
|
|
300
300
|
}
|
|
301
|
+
/** A refund's page: the business returning it, and where it stands. */
|
|
302
|
+
interface PublicRefund {
|
|
303
|
+
object: "refund";
|
|
304
|
+
environment: Environment;
|
|
305
|
+
merchant: {
|
|
306
|
+
name: string;
|
|
307
|
+
};
|
|
308
|
+
refund: PublicFulfillmentRefund;
|
|
309
|
+
}
|
|
301
310
|
/**
|
|
302
|
-
*
|
|
311
|
+
* A business returning a purchase's money by Pago Móvil. `needs_destination`: it waits for the
|
|
303
312
|
* customer to say where (`setRefundDestination`), also after a transfer to the previous one failed
|
|
304
|
-
* (`problem`). `processing`:
|
|
313
|
+
* (`problem`). `processing`: the business is sending it. `paid`: sent, with the bank's reference.
|
|
305
314
|
*/
|
|
306
315
|
interface PublicFulfillmentRefund {
|
|
307
316
|
amount: number;
|
|
@@ -430,6 +439,20 @@ interface PaymentMethodOption {
|
|
|
430
439
|
instructions: PaymentInstructions | null;
|
|
431
440
|
testScenarios: PaymentTestScenario[] | null;
|
|
432
441
|
}
|
|
442
|
+
/**
|
|
443
|
+
* Why a checkout or Cobro offers no method: the business takes no payments now
|
|
444
|
+
* (`account_suspended`), offers no method for this payment (`payment_method_unavailable`), or
|
|
445
|
+
* nothing can charge the ones it offers right now (`payments_unavailable`, the only one that may
|
|
446
|
+
* pass by trying again). `message` is meant for the payer.
|
|
447
|
+
*/
|
|
448
|
+
interface PaymentsUnavailable {
|
|
449
|
+
code: "account_suspended" | "payment_method_unavailable" | "payments_unavailable";
|
|
450
|
+
message: string;
|
|
451
|
+
}
|
|
452
|
+
/** The methods a checkout or Cobro can be paid with now; with none, why (`unavailable`). */
|
|
453
|
+
interface PaymentMethodList extends List<PaymentMethodOption> {
|
|
454
|
+
unavailable: PaymentsUnavailable | null;
|
|
455
|
+
}
|
|
433
456
|
/** Browser-safe view of a payment link, used to render its page before a checkout exists. */
|
|
434
457
|
interface PublicPaymentLink {
|
|
435
458
|
id: string;
|
|
@@ -958,6 +981,8 @@ interface RefundCreate {
|
|
|
958
981
|
/** Defaults to the remaining refundable amount, in the settlement currency. */
|
|
959
982
|
amount?: number;
|
|
960
983
|
reason?: string;
|
|
984
|
+
/** The bank's reference of the Pago Móvil the business returned it with. */
|
|
985
|
+
reference?: string;
|
|
961
986
|
}
|
|
962
987
|
/** An event type, or `*` for every event. */
|
|
963
988
|
type EventSelector = "*" | SubscribableEventType;
|
|
@@ -1094,6 +1119,7 @@ type ClaimResolve = {
|
|
|
1094
1119
|
note: string;
|
|
1095
1120
|
refund?: {
|
|
1096
1121
|
amount?: number;
|
|
1122
|
+
reference?: string;
|
|
1097
1123
|
};
|
|
1098
1124
|
} | {
|
|
1099
1125
|
outcome: "business";
|
|
@@ -1143,4 +1169,4 @@ declare class BilleteError extends Error {
|
|
|
1143
1169
|
code: BilleteErrorCode;
|
|
1144
1170
|
}, status: number, options?: ErrorOptions);
|
|
1145
1171
|
}
|
|
1146
|
-
export { PortalSessionCreate as $, CustomerSessionCreate as A,
|
|
1172
|
+
export { PortalSessionCreate as $, CustomerSessionCreate as A, PublicFulfillmentRefund as At, FulfillmentTrackingInput as B, ApiVersion as Bt, CouponCreate as C, PaymentsUnavailable as Ct, CustomerInput as D, PublicClaim as Dt, CustomerCreate as E, PublicCheckoutItem as Et, FeatureOperationCreate as F, PublicPortal as Ft, PaymentLinkUpdate as G, apiVersionLifecycle as Gt, InvoiceLineInput as H, ApiVersionStage as Ht, FeatureUpdate as I, PublicRefund as It, PlanCreate as J, isApiVersion as Jt, PlanCheckoutCreate as K, apiVersionStage as Kt, FulfillmentDeliverInput as L, API_VERSIONS as Lt, EventSelector as M, PublicMerchant as Mt, FeatureCreate as N, PublicPaymentLink as Nt, CustomerMemberCreate as O, PublicClaimSummary as Ot, FeatureOperationCommit as P, PublicPaymentState as Pt, PlanUpdate as Q, FulfillmentHandoverInput as R, API_VERSION_HEADER as Rt, CollectInput as S, PaymentTestScenario as St, CustomFieldInput as T, PublicCheckout as Tt, KEY_PATTERN as U, LATEST_API_VERSION as Ut, InvoiceCreate as V, ApiVersionLifecycle as Vt, PaymentLinkCreate as W, LatestApiVersion as Wt, PlanLinkCreate as X, supportedApiVersions as Xt, PlanFeaturesInput as Y, isApiVersionRetired as Yt, PlanPriceInput as Z, ClientPaymentCode as _, PaymentInstructions as _t, AfterCompletionInput as a, RefundCreate as at, ClientSubscriptionSeats as b, PaymentMethodOption as bt, ClaimResolve as c, SubscriptionChangePreviewInput as ct, ClientCheckoutUpdate as d, VariantInput as dt, ProductCheckoutCreate as et, ClientClaimCreate as f, WebhookEndpointCreate as ft, ClientLinkCheckout as g, FulfillmentOption as gt, ClientInvoicePay as h, CustomerSubscriptionChangeResult as ht, TransportOptions as i, ProductUpdate as it, CustomerUpdate as j, PublicInvoice as jt, CustomerMemberUpdate as k, PublicFulfillment as kt, ClaimRespond as l, SubscriptionCreate as lt, ClientFulfillmentProblem as m, CustomerSubscription as mt, BilleteErrorCode as n, ProductCreate as nt, CheckoutCreate as o, SubscriptionCancel as ot, ClientCustomerClaimCreate as p, WebhookEndpointUpdate as pt, PlanCouponCreate as q, currentApiVersion as qt, RequestOptions as r, ProductLinkCreate as rt, CheckoutItemInput as s, SubscriptionChangeCreate as st, BilleteError as t, ProductCouponCreate as tt, ClientCheckoutPay as u, SubscriptionUpdate as ut, ClientRefundDestination as v, PaymentMethodField as vt, CouponUpdate as w, PortalFeatures as wt, ClientSubscriptionUpdate as x, PaymentNextAction as xt, ClientSubscriptionCancel as y, PaymentMethodList as yt, FulfillmentInput as z, API_VERSION_PATTERN as zt };
|
|
@@ -259,7 +259,7 @@ type Timestamp = string;
|
|
|
259
259
|
*/
|
|
260
260
|
declare const API_ERROR_CODES: {
|
|
261
261
|
readonly account_not_found: "No existe el negocio.";
|
|
262
|
-
readonly account_suspended: "Este negocio está suspendido.";
|
|
262
|
+
readonly account_suspended: "Este negocio no está recibiendo pagos: está pausado o suspendido, o tiene un reembolso vencido.";
|
|
263
263
|
readonly address_required: "Falta la dirección que pide el checkout.";
|
|
264
264
|
readonly amount_required: "El producto sin variantes necesita un precio.";
|
|
265
265
|
readonly amount_too_large: "El importe total supera el máximo permitido.";
|
|
@@ -392,11 +392,11 @@ declare const API_ERROR_CODES: {
|
|
|
392
392
|
readonly payment_link_deleted: "Este enlace fue eliminado y no puede modificarse.";
|
|
393
393
|
readonly payment_link_not_found: "No existe el enlace de pago.";
|
|
394
394
|
readonly payment_link_unavailable: "Este enlace de pago ya no está disponible.";
|
|
395
|
-
readonly payment_method_unavailable: "
|
|
395
|
+
readonly payment_method_unavailable: "Este negocio no ofrece ese método para este pago: no existe, no cobra en esa moneda, solo funciona en pruebas o el negocio no lo tiene.";
|
|
396
396
|
readonly payment_not_claimable: "Solo puedes abrir un reclamo por un pago confirmado.";
|
|
397
397
|
readonly payment_not_found: "No existe el pago.";
|
|
398
398
|
readonly payment_not_refundable: "Solo se pueden reembolsar pagos confirmados.";
|
|
399
|
-
readonly payments_unavailable: "
|
|
399
|
+
readonly payments_unavailable: "Nada puede cobrar ese método ahora: su proveedor no responde o está en mantenimiento. Inténtalo de nuevo en unos minutos.";
|
|
400
400
|
readonly payout_account_change_pending: "Ya hay un cambio de la cuenta de retiro pendiente: cancélalo antes de pedir otro.";
|
|
401
401
|
readonly payout_not_found: "No existe el retiro.";
|
|
402
402
|
readonly phone_required: "Teléfono: este campo es obligatorio.";
|
|
@@ -1276,13 +1276,17 @@ interface Refund extends Resource<"refund"> {
|
|
|
1276
1276
|
currency: Currency;
|
|
1277
1277
|
reason: string | null;
|
|
1278
1278
|
/**
|
|
1279
|
-
* `provider`: the method's provider returns the funds
|
|
1280
|
-
*
|
|
1281
|
-
*
|
|
1282
|
-
* Billete decided
|
|
1279
|
+
* `provider`: the method's provider returns the funds, when they are still where it collected
|
|
1280
|
+
* them. `manual`: the business returns them from its own bank by Pago Móvil, to the payer's or to
|
|
1281
|
+
* where the customer says on the refund's page; `pending` until it records the reference (a
|
|
1282
|
+
* refund it asked for without paying it yet, or one Billete decided: a shipment not sent in time
|
|
1283
|
+
* or a problem with a delivery decided in the customer's favor). `billete`: only on refunds from
|
|
1284
|
+
* before Billete stopped keeping the businesses' money.
|
|
1283
1285
|
*/
|
|
1284
1286
|
mode: (typeof REFUND_MODES)[number];
|
|
1285
1287
|
status: "pending" | "succeeded" | "failed";
|
|
1288
|
+
/** The bank's reference of the Pago Móvil that returned it, once returned. */
|
|
1289
|
+
reference?: string | null;
|
|
1286
1290
|
}
|
|
1287
1291
|
/**
|
|
1288
1292
|
* Why a customer opened a claim. `not_received`: they paid and nothing arrived. `overcharged`:
|
|
@@ -1341,28 +1345,6 @@ interface Claim extends Resource<"claim"> {
|
|
|
1341
1345
|
withdrawnAt: Timestamp | null;
|
|
1342
1346
|
updatedAt: Timestamp;
|
|
1343
1347
|
}
|
|
1344
|
-
interface BalanceAmount {
|
|
1345
|
-
amount: number;
|
|
1346
|
-
currency: Currency;
|
|
1347
|
-
}
|
|
1348
|
-
interface Balance {
|
|
1349
|
-
object: "balance";
|
|
1350
|
-
environment: Environment;
|
|
1351
|
-
/** Funds that can be paid out. */
|
|
1352
|
-
available: BalanceAmount[];
|
|
1353
|
-
/** Funds still inside the settlement hold. */
|
|
1354
|
-
pending: BalanceAmount[];
|
|
1355
|
-
/** Funds of purchases the customer has not received yet; released when they do. */
|
|
1356
|
-
held: BalanceAmount[];
|
|
1357
|
-
}
|
|
1358
|
-
interface Payout extends Resource<"payout"> {
|
|
1359
|
-
amount: number;
|
|
1360
|
-
currency: Currency;
|
|
1361
|
-
status: "pending" | "in_transit" | "paid" | "failed" | "canceled";
|
|
1362
|
-
automatic: boolean;
|
|
1363
|
-
arrivalAt: Timestamp | null;
|
|
1364
|
-
failureMessage: string | null;
|
|
1365
|
-
}
|
|
1366
1348
|
interface WebhookEndpoint extends Resource<"webhook_endpoint">, Deletion {
|
|
1367
1349
|
url: string;
|
|
1368
1350
|
events: string[];
|
|
@@ -1453,10 +1435,6 @@ interface EventDataMap {
|
|
|
1453
1435
|
"refund.created": Refund;
|
|
1454
1436
|
/** The provider could not return the funds; the amount is back in the balance. */
|
|
1455
1437
|
"refund.failed": Refund;
|
|
1456
|
-
"payout.created": Payout;
|
|
1457
|
-
"payout.paid": Payout;
|
|
1458
|
-
"payout.failed": Payout;
|
|
1459
|
-
"payout.canceled": Payout;
|
|
1460
1438
|
"invoice.created": Invoice;
|
|
1461
1439
|
"invoice.paid": Invoice;
|
|
1462
1440
|
"invoice.voided": Invoice;
|
|
@@ -1487,7 +1465,7 @@ type EventType = keyof EventDataMap;
|
|
|
1487
1465
|
declare const WEBHOOK_TEST_EVENT: "webhook_endpoint.test";
|
|
1488
1466
|
/** What a webhook endpoint can subscribe to: everything that happens in a business. */
|
|
1489
1467
|
type SubscribableEventType = Exclude<EventType, typeof WEBHOOK_TEST_EVENT>;
|
|
1490
|
-
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", "
|
|
1468
|
+
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"];
|
|
1491
1469
|
/** A delivered webhook, discriminated by `type` so `data` narrows automatically. */
|
|
1492
1470
|
type WebhookEvent = { [TType in EventType]: {
|
|
1493
1471
|
id: string;
|
|
@@ -1499,4 +1477,4 @@ type WebhookEvent = { [TType in EventType]: {
|
|
|
1499
1477
|
createdAt: string;
|
|
1500
1478
|
data: EventDataMap[TType];
|
|
1501
1479
|
}; }[EventType];
|
|
1502
|
-
export {
|
|
1480
|
+
export { FulfillmentStatus as $, API_ERROR_CODES as $t, CustomField as A, TokenKind as An, ResetFrequency as At, FEATURE_TYPES as B, SubscriptionStatus as Bt, ClaimMessage as C, VENEZUELAN_BANKS as Cn, ProductCategory as Ct, CollectSettings as D, nationalPhone as Dn, RESET_FREQUENCIES as Dt, ClaimStatus as E, isMobilePhone as En, REFUND_MODES as Et, CustomerMemberList as F, Subscription as Ft, FeatureOperationResult as G, ReceiptReference as Gt, FULFILLMENT_STATUSES as H, USAGE_FEATURE_TYPES as Ht, CustomerSession as I, SubscriptionChange as It, FeatureUsageResult as J, ApiErrorBody as Jt, FeatureReset as K, ReceiptSend as Kt, Deletion as L, SubscriptionChangePreview as Lt, CustomerDetails as M, tokenPrefix as Mn, SUBMIT_LABELS as Mt, CustomerFeature as N, SUBSCRIPTION_STATUSES as Nt, Coupon as O, ENVIRONMENTS as On, RISK_LEVELS as Ot, CustomerMember as P, SubmitLabel as Pt, FulfillmentMethod as Q, PaymentFailureCode as Qt, Event as R, SubscriptionChangeResult as Rt, Claim as S, Timestamp as Sn, Product as St, ClaimReason as T, isLandlinePhone as Tn, ProductVariant as Tt, Feature as U, WebhookEndpoint as Ut, FULFILLMENT_METHODS as V, SubscriptionTerms as Vt, FeatureOperation as W, Weekday as Wt, FulfillmentChoice as X, ApiErrorType as Xt, Fulfillment as Y, ApiErrorEnvelope as Yt, FulfillmentHandover as Z, PAYMENT_FAILURE_CODES as Zt, Carrier as _, MobilePrefix as _n, Plan as _t, WEBHOOK_TEST_EVENT as a, BankCode as an, InvoiceStatus as at, CheckoutItem as b, TAX_BEHAVIORS as bn, PlanSeats as bt, AfterCompletion as c, Currency as cn, PAYMENT_STATUSES as ct, CARRIER_TEST_SCENARIOS as d, List as dn, PaymentAttempt as dt, ApiErrorCode as en, FulfillmentTracking as et, CHECKOUT_PURPOSES as f, ListQuery as fn, PaymentFailure as ft, CancellationFeedback as g, Metadata as gn, PaymentStatus as gt, CLAIM_STATUSES as h, MOBILE_PREFIXES as hn, PaymentSettlement as ht, SubscribableEventType as i, BILLING_MONTHS as in, InvoiceReason as it, Customer as j, tokenEnvironment as jn, RiskLevel as jt, CurrencyAvailability as k, Environment as kn, Refund as kt, CANCELLATION_FEEDBACK as l, GRACE_PERIOD_DAYS as ln, PRODUCT_CATEGORIES as lt, CLAIM_REASONS as m, MAX_QUANTITY as mn, PaymentLink as mt, EventDataMap as n, Address as nn, INVOICE_STATUSES as nt, WebhookEvent as o, BillingMonths as on, LineItem as ot, CLAIM_OUTCOMES as p, ListSort as pn, PaymentFeeDetails as pt, FeatureType as q, API_ERROR_TYPES as qt, EventType as r, AddressInput as rn, Invoice as rt, Actor as s, CURRENCIES as sn, MAX_SEATS as st, EVENT_TYPES as t, ACCOUNT_NUMBER_LENGTH as tn, INVOICE_REASONS as tt, CARRIERS as u, GracePeriodDays as un, Payment as ut, CarrierOffice as v, SUSPENSION_DAYS as vn, PlanFeatureValues as vt, ClaimOutcome as w, findBank as wn, ProductImage as wt, CheckoutPurpose as x, TaxBehavior as xn, PortalSession as xt, Checkout as y, SuspensionDays as yn, PlanPrice as yt, ExchangeRate as z, SubscriptionRenewal as zt };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $ as PortalSessionCreate, A as CustomerSessionCreate, At as
|
|
1
|
+
import { $ as FulfillmentStatus, $t as API_ERROR_CODES, A as CustomField, An as TokenKind, At as ResetFrequency, B as FEATURE_TYPES, Bt as SubscriptionStatus, C as ClaimMessage, Cn as VENEZUELAN_BANKS, Ct as ProductCategory, D as CollectSettings, Dn as nationalPhone, Dt as RESET_FREQUENCIES, E as ClaimStatus, En as isMobilePhone, Et as REFUND_MODES, F as CustomerMemberList, Ft as Subscription, G as FeatureOperationResult, Gt as ReceiptReference, H as FULFILLMENT_STATUSES, Ht as USAGE_FEATURE_TYPES, I as CustomerSession, It as SubscriptionChange, J as FeatureUsageResult, Jt as ApiErrorBody, K as FeatureReset, Kt as ReceiptSend, L as Deletion, Lt as SubscriptionChangePreview, M as CustomerDetails, Mn as tokenPrefix, Mt as SUBMIT_LABELS, N as CustomerFeature, Nt as SUBSCRIPTION_STATUSES, O as Coupon, On as ENVIRONMENTS, Ot as RISK_LEVELS, P as CustomerMember, Pt as SubmitLabel, Q as FulfillmentMethod, Qt as PaymentFailureCode, R as Event, Rt as SubscriptionChangeResult, S as Claim, Sn as Timestamp, St as Product, T as ClaimReason, Tn as isLandlinePhone, Tt as ProductVariant, U as Feature, Ut as WebhookEndpoint, V as FULFILLMENT_METHODS, Vt as SubscriptionTerms, W as FeatureOperation, Wt as Weekday, X as FulfillmentChoice, Xt as ApiErrorType, Y as Fulfillment, Yt as ApiErrorEnvelope, Z as FulfillmentHandover, Zt as PAYMENT_FAILURE_CODES, _ as Carrier, _n as MobilePrefix, _t as Plan, a as WEBHOOK_TEST_EVENT, an as BankCode, at as InvoiceStatus, b as CheckoutItem, bn as TAX_BEHAVIORS, bt as PlanSeats, c as AfterCompletion, cn as Currency, ct as PAYMENT_STATUSES, d as CARRIER_TEST_SCENARIOS, dn as List, dt as PaymentAttempt, en as ApiErrorCode, et as FulfillmentTracking, f as CHECKOUT_PURPOSES, fn as ListQuery, ft as PaymentFailure, g as CancellationFeedback, gn as Metadata, gt as PaymentStatus, h as CLAIM_STATUSES, hn as MOBILE_PREFIXES, ht as PaymentSettlement, i as SubscribableEventType, in as BILLING_MONTHS, it as InvoiceReason, j as Customer, jn as tokenEnvironment, jt as RiskLevel, k as CurrencyAvailability, kn as Environment, kt as Refund, l as CANCELLATION_FEEDBACK, ln as GRACE_PERIOD_DAYS, lt as PRODUCT_CATEGORIES, m as CLAIM_REASONS, mn as MAX_QUANTITY, mt as PaymentLink, n as EventDataMap, nn as Address, nt as INVOICE_STATUSES, o as WebhookEvent, on as BillingMonths, ot as LineItem, p as CLAIM_OUTCOMES, pn as ListSort, pt as PaymentFeeDetails, q as FeatureType, qt as API_ERROR_TYPES, r as EventType, rn as AddressInput, rt as Invoice, s as Actor, sn as CURRENCIES, st as MAX_SEATS, t as EVENT_TYPES, tn as ACCOUNT_NUMBER_LENGTH, tt as INVOICE_REASONS, u as CARRIERS, un as GracePeriodDays, ut as Payment, v as CarrierOffice, vn as SUSPENSION_DAYS, vt as PlanFeatureValues, w as ClaimOutcome, wn as findBank, wt as ProductImage, x as CheckoutPurpose, xn as TaxBehavior, xt as PortalSession, y as Checkout, yn as SuspensionDays, yt as PlanPrice, z as ExchangeRate, zt as SubscriptionRenewal } from "./events-CLifhYGq.js";
|
|
2
|
+
import { $ as PortalSessionCreate, A as CustomerSessionCreate, At as PublicFulfillmentRefund, B as FulfillmentTrackingInput, Bt as ApiVersion, C as CouponCreate, Ct as PaymentsUnavailable, D as CustomerInput, Dt as PublicClaim, E as CustomerCreate, Et as PublicCheckoutItem, F as FeatureOperationCreate, Ft as PublicPortal, G as PaymentLinkUpdate, Gt as apiVersionLifecycle, H as InvoiceLineInput, Ht as ApiVersionStage, I as FeatureUpdate, It as PublicRefund, J as PlanCreate, Jt as isApiVersion, K as PlanCheckoutCreate, Kt as apiVersionStage, L as FulfillmentDeliverInput, Lt as API_VERSIONS, M as EventSelector, Mt as PublicMerchant, N as FeatureCreate, Nt as PublicPaymentLink, O as CustomerMemberCreate, Ot as PublicClaimSummary, P as FeatureOperationCommit, Pt as PublicPaymentState, Q as PlanUpdate, R as FulfillmentHandoverInput, Rt as API_VERSION_HEADER, S as CollectInput, St as PaymentTestScenario, T as CustomFieldInput, Tt as PublicCheckout, U as KEY_PATTERN, Ut as LATEST_API_VERSION, V as InvoiceCreate, Vt as ApiVersionLifecycle, W as PaymentLinkCreate, Wt as LatestApiVersion, X as PlanLinkCreate, Xt as supportedApiVersions, Y as PlanFeaturesInput, Yt as isApiVersionRetired, Z as PlanPriceInput, _ as ClientPaymentCode, _t as PaymentInstructions, a as AfterCompletionInput, at as RefundCreate, b as ClientSubscriptionSeats, bt as PaymentMethodOption, c as ClaimResolve, ct as SubscriptionChangePreviewInput, d as ClientCheckoutUpdate, dt as VariantInput, et as ProductCheckoutCreate, f as ClientClaimCreate, ft as WebhookEndpointCreate, g as ClientLinkCheckout, gt as FulfillmentOption, h as ClientInvoicePay, ht as CustomerSubscriptionChangeResult, i as TransportOptions, it as ProductUpdate, j as CustomerUpdate, jt as PublicInvoice, k as CustomerMemberUpdate, kt as PublicFulfillment, l as ClaimRespond, lt as SubscriptionCreate, m as ClientFulfillmentProblem, mt as CustomerSubscription, n as BilleteErrorCode, nt as ProductCreate, o as CheckoutCreate, ot as SubscriptionCancel, p as ClientCustomerClaimCreate, pt as WebhookEndpointUpdate, q as PlanCouponCreate, qt as currentApiVersion, r as RequestOptions, rt as ProductLinkCreate, s as CheckoutItemInput, st as SubscriptionChangeCreate, t as BilleteError, tt as ProductCouponCreate, u as ClientCheckoutPay, ut as SubscriptionUpdate, v as ClientRefundDestination, vt as PaymentMethodField, w as CouponUpdate, wt as PortalFeatures, x as ClientSubscriptionUpdate, xt as PaymentNextAction, y as ClientSubscriptionCancel, yt as PaymentMethodList, z as FulfillmentInput, zt as API_VERSION_PATTERN } from "./errors-Dk3plV2O.js";
|
|
3
3
|
import { WebhookVerificationError, verifyWebhook } from "./webhooks.js";
|
|
4
4
|
type Filters<T> = ListQuery & T;
|
|
5
5
|
type MemberOptions = RequestOptions & {
|
|
@@ -24,7 +24,7 @@ interface BilleteOptions extends TransportOptions {
|
|
|
24
24
|
*
|
|
25
25
|
* ```ts
|
|
26
26
|
* // Reads BILLETE_API_KEY.
|
|
27
|
-
* const billete = createBillete({ apiVersion: "2026-
|
|
27
|
+
* const billete = createBillete({ apiVersion: "2026-11-06.beta", environment: "test" });
|
|
28
28
|
* const { allowed } = await billete.features.consume("user_123", "tokens", 850);
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
@@ -339,18 +339,6 @@ export declare function createBillete(options: BilleteOptions): {
|
|
|
339
339
|
*/
|
|
340
340
|
resolve: (id: string, input: ClaimResolve, options?: RequestOptions) => Promise<Claim>;
|
|
341
341
|
};
|
|
342
|
-
balance: {
|
|
343
|
-
retrieve: (options?: RequestOptions) => Promise<Balance>;
|
|
344
|
-
};
|
|
345
|
-
payouts: {
|
|
346
|
-
retrieve: (id: string, options?: RequestOptions) => Promise<Payout>;
|
|
347
|
-
list: (query?: Filters<{
|
|
348
|
-
sort?: ListSort<"created" | "amount">;
|
|
349
|
-
}>, options?: RequestOptions) => Promise<List<Payout>>;
|
|
350
|
-
iterate: (query?: Filters<{
|
|
351
|
-
sort?: ListSort<"created" | "amount">;
|
|
352
|
-
}>) => AsyncGenerator<Payout, any, any>;
|
|
353
|
-
};
|
|
354
342
|
webhookEndpoints: {
|
|
355
343
|
create: (input: WebhookEndpointCreate, options?: RequestOptions) => Promise<WebhookEndpoint>;
|
|
356
344
|
retrieve: (id: string, options?: RequestOptions) => Promise<WebhookEndpoint>;
|
|
@@ -387,4 +375,4 @@ export declare function createBillete(options: BilleteOptions): {
|
|
|
387
375
|
};
|
|
388
376
|
/** The server client: what `createBillete` returns. */
|
|
389
377
|
type Billete = ReturnType<typeof createBillete>;
|
|
390
|
-
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
|
|
378
|
+
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 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 ClientRefundDestination, 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 PaymentMethodList, type PaymentMethodOption, type PaymentNextAction, type PaymentSettlement, type PaymentStatus, type PaymentTestScenario, type PaymentsUnavailable, 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 ProductImage, type ProductLinkCreate, type ProductUpdate, type ProductVariant, type PublicCheckout, type PublicCheckoutItem, type PublicClaim, type PublicClaimSummary, type PublicFulfillment, type PublicFulfillmentRefund, type PublicInvoice, type PublicMerchant, type PublicPaymentLink, type PublicPaymentState, type PublicPortal, type PublicRefund, type REFUND_MODES, 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-moOPtD7S.js";
|
|
2
2
|
import { WebhookVerificationError, verifyWebhook } from "./webhooks.js";
|
|
3
3
|
// ../contracts/src/environment.ts
|
|
4
4
|
/**
|
|
@@ -74,7 +74,7 @@ function fromEnv(name) {
|
|
|
74
74
|
*
|
|
75
75
|
* ```ts
|
|
76
76
|
* // Reads BILLETE_API_KEY.
|
|
77
|
-
* const billete = createBillete({ apiVersion: "2026-
|
|
77
|
+
* const billete = createBillete({ apiVersion: "2026-11-06.beta", environment: "test" });
|
|
78
78
|
* const { allowed } = await billete.features.consume("user_123", "tokens", 850);
|
|
79
79
|
* ```
|
|
80
80
|
*/
|
|
@@ -422,17 +422,6 @@ create: (input, options) => http.request({
|
|
|
422
422
|
options
|
|
423
423
|
})
|
|
424
424
|
};
|
|
425
|
-
const balance = { retrieve: (options) => http.request({
|
|
426
|
-
method: "GET",
|
|
427
|
-
path: "/v1/balance",
|
|
428
|
-
options
|
|
429
|
-
}) };
|
|
430
|
-
const payoutCrud = collection(http, "/v1/payouts");
|
|
431
|
-
const payouts = {
|
|
432
|
-
retrieve: payoutCrud.retrieve,
|
|
433
|
-
list: payoutCrud.list,
|
|
434
|
-
iterate: payoutCrud.iterate
|
|
435
|
-
};
|
|
436
425
|
const webhookEndpoints = {
|
|
437
426
|
...collection(http, "/v1/webhook-endpoints"),
|
|
438
427
|
/** Stops its events; its deliveries stay as history. */
|
|
@@ -455,8 +444,6 @@ create: (input, options) => http.request({
|
|
|
455
444
|
payments,
|
|
456
445
|
fulfillments,
|
|
457
446
|
claims,
|
|
458
|
-
balance,
|
|
459
|
-
payouts,
|
|
460
447
|
webhookEndpoints,
|
|
461
448
|
events: {
|
|
462
449
|
retrieve: eventCrud.retrieve,
|
package/dist/webhooks.d.ts
CHANGED