@wavezfm/api 0.7.25 → 0.7.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ### Subscription prices, currency and localization
6
+
7
+ - Subscription checkout, subscription gifts and room gifts now require `expectedAmountMinor`, the current price shown to the buyer. Use whole yen/won for JPY/KRW and hundredths for the other supported currencies. Room gifts confirm the requested count times the displayed monthly unit price; fewer eligible recipients can reduce the final charge.
8
+ - Mercado Pago payment submission requires `expectedAmountMinor` for `subscription_prepaid` and `gift_subscription_prepaid`, using the displayed Mercado Pago checkout configuration's BRL amount multiplied by 100. The field remains optional for other payment kinds.
9
+ - New Mercado Pago Subscriber purchases remain prepaid, including card payments, without automatic renewal. The retained legacy `createMercadoPagoSubscription()` helper requires a confirmed BRL amount but does not make new recurring checkout available; Mercado Pago upgrade management applies only to existing managed recurring subscriptions.
10
+ - The updated server rejects missing confirmations with `BILLING_PRICE_CONFIRMATION_REQUIRED` and price changes with `BILLING_PRICE_CHANGED` before starting payment. Older clients must reload current prices and obtain buyer confirmation; the SDK never accepts a replacement price or retries payment automatically.
11
+ - Stripe annual upgrades retain the existing subscription's actual currency and credit unused monthly time on the invoice. That credit reduces the payment instead of adding monthly days to the new annual period. Current cycle synchronization resolves provider state rather than accepting an outdated webhook snapshot.
12
+ - New Stripe subscription product names use the supplied locale across all eleven website languages, including Czech. Existing paid invoices keep their historical names. Fixed local annual defaults were updated; explicit configured prices retain priority, and existing recurring subscriptions are not repriced retroactively.
13
+
14
+ ### Annual subscription upgrade confirmation
15
+
16
+ - Added `billing.previewSubscriptionUpgrade()` with typed amounts, ISO currency, proration credit, expiry and charge timing. `billing.upgradeSubscription()` now requires the returned `quoteId` after the buyer confirms the displayed charge. Older quote-free calls are rejected by the server before charging; no automatic retry or confirmation is performed by the SDK.
17
+
5
18
  ### October 10 contract synchronization
6
19
 
7
20
  - Added typed `billingCheckoutPolicy`, eight supported fiat currencies and donation currency maps, checkout payment modes, returned payment mode/amount/currency, and `subscriptionPaymentMode` plus announcement options to subscription checkout. Prepaid Stripe Pix remains BRL-only and does not renew automatically.
package/README.md CHANGED
@@ -388,12 +388,20 @@ item. The server rejects unsupported currencies rather than defaulting to USD.
388
388
  Prices are configured values; selecting a currency does not request a live FX
389
389
  conversion. Existing checkout helpers retain their string currency inputs.
390
390
 
391
+ Subscription checkout and gifts require `expectedAmountMinor`, the current price
392
+ the buyer reviewed for the provider, currency and cycle. Use whole units for
393
+ JPY/KRW and hundredths for the other currencies. Obtain live prices before
394
+ enabling confirmation; `BILLING_PRICE_CHANGED` requires a new review rather than
395
+ an automatic retry. Room gifts confirm requested count × monthly unit price;
396
+ fewer eligible recipients can reduce the charge.
397
+
391
398
  ```ts
392
399
  const { data: status } = await client.system.status();
393
400
  if (status.billingCheckoutPolicy?.stripeBrlEnabled) {
394
401
  const { data: checkout } = await client.billing.createSubscriptionCheckout({
395
402
  currency: 'brl', provider: 'stripe', cycle: 'monthly',
396
403
  subscriptionPaymentMode: 'prepaid', locale: 'pt-BR', uiMode: 'hosted',
404
+ expectedAmountMinor: confirmedStripeBrlMonthlyAmountMinor,
397
405
  });
398
406
  // Hosted Stripe Pix: a one-time month or year, without automatic renewal.
399
407
  if (checkout.checkoutUrl) console.log(checkout.checkoutUrl);
@@ -404,6 +412,9 @@ if (status.billingCheckoutPolicy?.stripeBrlEnabled) {
404
412
  payments and prevents new recurring BRL Stripe checkout. Existing renewals are
405
413
  unchanged. Explicit `subscriptionPaymentMode: 'recurring'` requires card support;
406
414
  Stripe prepaid Pix is BRL-only. Mercado Pago remains the default BRL provider.
415
+ New Mercado Pago Subscriber purchases are prepaid card/Pix payments without
416
+ automatic renewal; submit the returned payment form through
417
+ `createMercadoPagoPayment()`.
407
418
  Check payment status before treating a purchase as fulfilled: pending Pix
408
419
  payments do not grant access. `getCheckoutSessionStatus()` exposes the payment
409
420
  mode, amount and currency along with the Stripe session status.
@@ -413,6 +424,17 @@ a major currency unit for every currency**, including JPY/KRW. For example,
413
424
  1,000 JPY is represented as `100000`. Stripe checkout converts JPY/KRW to
414
425
  whole-unit minor amounts. Format them without fractional currency digits.
415
426
 
427
+ Mercado Pago payment submission requires `expectedAmountMinor` for `subscription_prepaid` and
428
+ `gift_subscription_prepaid`, using the displayed Mercado Pago checkout
429
+ configuration's `mercadoPago.amount` multiplied by 100. It remains optional for
430
+ other payment kinds. Do not substitute the Stripe BRL price for this amount.
431
+
432
+ The SDK retains `createMercadoPagoSubscription()` for compatibility with the
433
+ legacy subscription handler, which also requires a confirmed BRL amount. It is
434
+ not an available new recurring checkout flow. Annual-upgrade management for
435
+ Mercado Pago applies only to existing managed recurring subscriptions, not new
436
+ prepaid purchases.
437
+
416
438
  ## Admin CDN images
417
439
 
418
440
  `client.adminMedia` uses an administrator **user session** and CSRF protection;
package/dist/index.d.ts CHANGED
@@ -20,7 +20,7 @@ export { createAdminMediaResource } from "./resources/adminMedia.js";
20
20
  export { parseRoomQueueSnapshot } from "./utils/roomQueue.js";
21
21
  export { formatMentionText } from "./utils/chat.js";
22
22
  export { createRoomBotRealtimeClient } from "./realtime/roomBot.js";
23
- export type { BotPrivateCommand, AdminMediaAsset, AdminMediaFolder, AdminMediaListing, BillingCurrency, BillingCheckoutPolicy, SubscriptionPaymentMode, CheckoutSessionStatus, RoomBotAppearance, RoomBotAppearanceAccess, CountryFlagSettings, TeamDirectory, StageHoverSettings, UserProfileOptions, ApiClientConfig, ApiLike, ApiQuery, ApiQueryValue, ApiRequestOptions, ApiSuccessResponse, AuthMode, AuthUser, BadgeAssignment, ChatImageUploadResponse, ChatLinkReview, ChatMediaPreviewResponse, ChatMessage, CheckoutSessionResponse, GifFavorite, Giveaway, GiveawayEntry, GiveawayJoinEligibility, GiveawayListResponse, GiveawayMutationResponse, GiveawayPrizeDeliveryStatus, GiveawayPrizeType, GiveawayScope, GiveawayStatus, InventoryResponse, InventoryCatalogEntry, InventoryCatalogItem, PurchaseHistoryCategory, PurchaseHistoryCurrency, PurchaseHistoryItem, PurchaseHistoryOptions, PurchaseHistoryResponse, LastFmAccountProfile, LastFmLinkStatus, LastFmWriteResponse, MediaSearchResponse, YouTubeRegionAvailability, RoomOwnershipTransferChallenge, RoomOwnershipTransferResult, MediaSearchResult, MiscShopUserState, MiscStoreCurrency, MiscStoreItemKind, MiscStoreRenderMode, NotificationCenterClearResponse, NotificationCenterStatus, PlaylistExternalImportResult, PlaylistExternalImportSource, PlaylistJsonExport, PlaylistJsonImportResult, PlaylistJsonTrack, PlaylistSummary, PlaylistTrack, PlaylistTrackAvailabilityInput, PlaylistTrackAvailabilityResult, PlaylistTrackSearchResult, PrivateConversation, PrivateMessage, PrivateMessageCustomEmoji, PrivateMessageReply, PrivateMessageSendInput, PrivateMessageSendResponse, PrivateMessageUser, RoomBotPermission, RoomExternalMediaMetadataResponse, RoomExternalMediaProvider, RoomExternalMediaSubtitleTrack, RoomExternalMediaValidationResponse, RoomActiveUser, RoomCustomEmoji, RoomLinkFiltersUpdateInput, RoomGuestPresenceResponse, RoomGuestViewer, RoomGlobalLimits, RoomGlobalLimitsUpdateInput, RoomPlaybackHistoryEntry, RoomPermission, RoomPermissionOverrideMap, RoomQueueEntry, RoomQueuePlayback, RoomQueueSnapshot, RoomQueueStatusResponse, RoomQueueUser, RoomQueueViewerStatus, RoomRoleName, RoomSettingsUpdateInput, RoomStateSnapshot, RoomBotEditMessageInput, RoomBotChatEmbed, RoomBotMessageReplyInput, RoomBotEventsResponse, RoomPresenceEventFilterType, RoomBotQueueAddResponse, RoomBotRealtimeClient, RoomBotRealtimeSendMessageInput, RoomBotRealtimeOptions, RoomActionActor, RoomBotUserKickedPayload, RoomBotUserBannedPayload, RoomBotUserUnbannedPayload, RoomBotQueueRemovalReason, RoomBotQueueRemovedPayload, RoomBotQueueLeftPayload, RoomBotTrackSkippedPayload, RoomBotQueueReorderedPayload, RoomBotMessageDeletedPayload, RoomBotChatClearedPayload, RoomBotUserUpdatedPayload, RoomBotRoomSettingsUpdatedPayload, RoomBotRealtimeEventPayloads, RoomBotRealtimeEventName, RoomBotSendMessageInput, RoomBotSendMessageResponse, RoomBotState, RoomBotToken, RoomBotSettings, RoomBotSettingsUpdateInput, RoomPresenceEvent, RoomPresenceEventType, RoomSummary, RoomSystemAlert, RoomEvent, RoomEventApprovalStatus, RoomEventListResponse, RoomEventMutationResponse, RoomEventScope, RoomEventStatus, RoomEventSubmissionInput, WavezApiLocale, WavezApiMessageKey, WavezApiMessages, WavezApiMessageValues, StoreCatalogResponse, StoreCatalogItem, StoreCatalogSection, MiscStoreItem, AdminSystemHealth, AdminSystemStatus, SystemDonationGoal, SystemAlert, SystemAlertAppearance, SystemAlertCustomEmoji, SystemAlertInput, SystemAlertResponse, SystemHealth, SystemPublicStats, SystemProgressionXp, SystemStatus, TwoFactorStatus, UserSettings, UserSystemAlert, UserProfile, UserBlockState, WalletBalance, WebSocketLike, WsPacket, } from "./types.js";
23
+ export type { BotPrivateCommand, AdminMediaAsset, AdminMediaFolder, AdminMediaListing, BillingCurrency, BillingCheckoutPolicy, SubscriptionPaymentMode, SubscriptionUpgradeQuote, SubscriptionUpgradePreviewResponse, CheckoutSessionStatus, RoomBotAppearance, RoomBotAppearanceAccess, CountryFlagSettings, TeamDirectory, StageHoverSettings, UserProfileOptions, ApiClientConfig, ApiLike, ApiQuery, ApiQueryValue, ApiRequestOptions, ApiSuccessResponse, AuthMode, AuthUser, BadgeAssignment, ChatImageUploadResponse, ChatLinkReview, ChatMediaPreviewResponse, ChatMessage, CheckoutSessionResponse, GifFavorite, Giveaway, GiveawayEntry, GiveawayJoinEligibility, GiveawayListResponse, GiveawayMutationResponse, GiveawayPrizeDeliveryStatus, GiveawayPrizeType, GiveawayScope, GiveawayStatus, InventoryResponse, InventoryCatalogEntry, InventoryCatalogItem, PurchaseHistoryCategory, PurchaseHistoryCurrency, PurchaseHistoryItem, PurchaseHistoryOptions, PurchaseHistoryResponse, LastFmAccountProfile, LastFmLinkStatus, LastFmWriteResponse, MediaSearchResponse, YouTubeRegionAvailability, RoomOwnershipTransferChallenge, RoomOwnershipTransferResult, MediaSearchResult, MiscShopUserState, MiscStoreCurrency, MiscStoreItemKind, MiscStoreRenderMode, NotificationCenterClearResponse, NotificationCenterStatus, PlaylistExternalImportResult, PlaylistExternalImportSource, PlaylistJsonExport, PlaylistJsonImportResult, PlaylistJsonTrack, PlaylistSummary, PlaylistTrack, PlaylistTrackAvailabilityInput, PlaylistTrackAvailabilityResult, PlaylistTrackSearchResult, PrivateConversation, PrivateMessage, PrivateMessageCustomEmoji, PrivateMessageReply, PrivateMessageSendInput, PrivateMessageSendResponse, PrivateMessageUser, RoomBotPermission, RoomExternalMediaMetadataResponse, RoomExternalMediaProvider, RoomExternalMediaSubtitleTrack, RoomExternalMediaValidationResponse, RoomActiveUser, RoomCustomEmoji, RoomLinkFiltersUpdateInput, RoomGuestPresenceResponse, RoomGuestViewer, RoomGlobalLimits, RoomGlobalLimitsUpdateInput, RoomPlaybackHistoryEntry, RoomPermission, RoomPermissionOverrideMap, RoomQueueEntry, RoomQueuePlayback, RoomQueueSnapshot, RoomQueueStatusResponse, RoomQueueUser, RoomQueueViewerStatus, RoomRoleName, RoomSettingsUpdateInput, RoomStateSnapshot, RoomBotEditMessageInput, RoomBotChatEmbed, RoomBotMessageReplyInput, RoomBotEventsResponse, RoomPresenceEventFilterType, RoomBotQueueAddResponse, RoomBotRealtimeClient, RoomBotRealtimeSendMessageInput, RoomBotRealtimeOptions, RoomActionActor, RoomBotUserKickedPayload, RoomBotUserBannedPayload, RoomBotUserUnbannedPayload, RoomBotQueueRemovalReason, RoomBotQueueRemovedPayload, RoomBotQueueLeftPayload, RoomBotTrackSkippedPayload, RoomBotQueueReorderedPayload, RoomBotMessageDeletedPayload, RoomBotChatClearedPayload, RoomBotUserUpdatedPayload, RoomBotRoomSettingsUpdatedPayload, RoomBotRealtimeEventPayloads, RoomBotRealtimeEventName, RoomBotSendMessageInput, RoomBotSendMessageResponse, RoomBotState, RoomBotToken, RoomBotSettings, RoomBotSettingsUpdateInput, RoomPresenceEvent, RoomPresenceEventType, RoomSummary, RoomSystemAlert, RoomEvent, RoomEventApprovalStatus, RoomEventListResponse, RoomEventMutationResponse, RoomEventScope, RoomEventStatus, RoomEventSubmissionInput, WavezApiLocale, WavezApiMessageKey, WavezApiMessages, WavezApiMessageValues, StoreCatalogResponse, StoreCatalogItem, StoreCatalogSection, MiscStoreItem, AdminSystemHealth, AdminSystemStatus, SystemDonationGoal, SystemAlert, SystemAlertAppearance, SystemAlertCustomEmoji, SystemAlertInput, SystemAlertResponse, SystemHealth, SystemPublicStats, SystemProgressionXp, SystemStatus, TwoFactorStatus, UserSettings, UserSystemAlert, UserProfile, UserBlockState, WalletBalance, WebSocketLike, WsPacket, } from "./types.js";
24
24
  import type { ApiClientConfig } from "./types.js";
25
25
  export declare function createApiClient(config: ApiClientConfig): {
26
26
  api: import("./core/api.js").WavezApi;
@@ -479,11 +479,16 @@ export declare function createApiClient(config: ApiClientConfig): {
479
479
  getCheckoutSessionStatus(sessionId: string): Promise<import("./types.js").ApiSuccessResponse<import("./types.js").CheckoutSessionStatus>>;
480
480
  cancelSubscription(): Promise<import("./types.js").ApiSuccessResponse<Record<string, unknown>>>;
481
481
  resumeSubscription(): Promise<import("./types.js").ApiSuccessResponse<Record<string, unknown>>>;
482
- upgradeSubscription(input?: {
482
+ previewSubscriptionUpgrade(input?: {
483
+ locale?: string | null;
484
+ }): Promise<import("./types.js").ApiSuccessResponse<import("./types.js").SubscriptionUpgradePreviewResponse>>;
485
+ upgradeSubscription(input: {
486
+ quoteId: string;
483
487
  locale?: string | null;
484
488
  }): Promise<import("./types.js").ApiSuccessResponse<Record<string, unknown>>>;
485
489
  listSubscriptionPaymentHistory(): Promise<import("./types.js").ApiSuccessResponse<unknown[]>>;
486
- createSubscriptionCheckout(input?: {
490
+ createSubscriptionCheckout(input: {
491
+ expectedAmountMinor: number;
487
492
  subscriptionPaymentMode?: import("./types.js").SubscriptionPaymentMode | null;
488
493
  announceInRoom?: boolean;
489
494
  announceRoomSlug?: string | null;
@@ -541,6 +546,7 @@ export declare function createApiClient(config: ApiClientConfig): {
541
546
  uiMode?: string | null;
542
547
  }): Promise<import("./types.js").ApiSuccessResponse<import("./types.js").CheckoutSessionResponse>>;
543
548
  createSubscriptionGiftCheckout(input: {
549
+ expectedAmountMinor: number;
544
550
  recipientUsername?: string | null;
545
551
  recipientUserId?: string | null;
546
552
  cycle?: string | null;
@@ -555,6 +561,7 @@ export declare function createApiClient(config: ApiClientConfig): {
555
561
  provider?: string | null;
556
562
  }): Promise<import("./types.js").ApiSuccessResponse<import("./types.js").CheckoutSessionResponse>>;
557
563
  createSubscriptionRoomGiftCheckout(input: {
564
+ expectedAmountMinor: number;
558
565
  roomSlug: string;
559
566
  count?: number;
560
567
  excludeActiveSubscribers?: boolean;
@@ -568,6 +575,7 @@ export declare function createApiClient(config: ApiClientConfig): {
568
575
  }): Promise<import("./types.js").ApiSuccessResponse<import("./types.js").CheckoutSessionResponse>>;
569
576
  createMercadoPagoPayment(input: {
570
577
  kind: string;
578
+ expectedAmountMinor?: number;
571
579
  cycle?: string | null;
572
580
  quantity?: number;
573
581
  amountCents?: number;
@@ -587,7 +595,8 @@ export declare function createApiClient(config: ApiClientConfig): {
587
595
  formData?: Record<string, unknown> | null;
588
596
  }): Promise<import("./types.js").ApiSuccessResponse<Record<string, unknown>>>;
589
597
  getMercadoPagoPaymentStatus(paymentId: string): Promise<import("./types.js").ApiSuccessResponse<Record<string, unknown>>>;
590
- createMercadoPagoSubscription(input?: {
598
+ createMercadoPagoSubscription(input: {
599
+ expectedAmountMinor: number;
591
600
  cycle?: string | null;
592
601
  locale?: string | null;
593
602
  returnPath?: string | null;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,Q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
1
- import type { ApiLike, CheckoutSessionResponse, CheckoutSessionStatus, SubscriptionPaymentMode } from "../types.js";
1
+ import type { ApiLike, CheckoutSessionResponse, CheckoutSessionStatus, SubscriptionPaymentMode, SubscriptionUpgradePreviewResponse } from "../types.js";
2
2
  export declare function createBillingResource(api: ApiLike): {
3
3
  getCheckoutSessionStatus(sessionId: string): Promise<import("../types.js").ApiSuccessResponse<CheckoutSessionStatus>>;
4
4
  cancelSubscription(): Promise<import("../types.js").ApiSuccessResponse<Record<string, unknown>>>;
5
5
  resumeSubscription(): Promise<import("../types.js").ApiSuccessResponse<Record<string, unknown>>>;
6
- upgradeSubscription(input?: {
6
+ previewSubscriptionUpgrade(input?: {
7
+ locale?: string | null;
8
+ }): Promise<import("../types.js").ApiSuccessResponse<SubscriptionUpgradePreviewResponse>>;
9
+ /** Confirm a current server quote after displaying its charge to the buyer. */
10
+ upgradeSubscription(input: {
11
+ quoteId: string;
7
12
  locale?: string | null;
8
13
  }): Promise<import("../types.js").ApiSuccessResponse<Record<string, unknown>>>;
9
14
  listSubscriptionPaymentHistory(): Promise<import("../types.js").ApiSuccessResponse<unknown[]>>;
10
- createSubscriptionCheckout(input?: {
15
+ createSubscriptionCheckout(input: {
16
+ /** Confirmed catalog amount in Stripe minor units: whole JPY/KRW; hundredths otherwise. */
17
+ expectedAmountMinor: number;
11
18
  /** Prepaid Stripe Pix is available only for BRL; recurring requires card support. */
12
19
  subscriptionPaymentMode?: SubscriptionPaymentMode | null;
13
20
  announceInRoom?: boolean;
@@ -66,6 +73,7 @@ export declare function createBillingResource(api: ApiLike): {
66
73
  uiMode?: string | null;
67
74
  }): Promise<import("../types.js").ApiSuccessResponse<CheckoutSessionResponse>>;
68
75
  createSubscriptionGiftCheckout(input: {
76
+ expectedAmountMinor: number;
69
77
  recipientUsername?: string | null;
70
78
  recipientUserId?: string | null;
71
79
  cycle?: string | null;
@@ -80,6 +88,8 @@ export declare function createBillingResource(api: ApiLike): {
80
88
  provider?: string | null;
81
89
  }): Promise<import("../types.js").ApiSuccessResponse<CheckoutSessionResponse>>;
82
90
  createSubscriptionRoomGiftCheckout(input: {
91
+ /** Requested count times the displayed monthly unit price, in minor units. */
92
+ expectedAmountMinor: number;
83
93
  roomSlug: string;
84
94
  count?: number;
85
95
  excludeActiveSubscribers?: boolean;
@@ -93,6 +103,8 @@ export declare function createBillingResource(api: ApiLike): {
93
103
  }): Promise<import("../types.js").ApiSuccessResponse<CheckoutSessionResponse>>;
94
104
  createMercadoPagoPayment(input: {
95
105
  kind: string;
106
+ /** Required for subscription_prepaid and gift_subscription_prepaid; BRL cents. */
107
+ expectedAmountMinor?: number;
96
108
  cycle?: string | null;
97
109
  quantity?: number;
98
110
  amountCents?: number;
@@ -112,7 +124,8 @@ export declare function createBillingResource(api: ApiLike): {
112
124
  formData?: Record<string, unknown> | null;
113
125
  }): Promise<import("../types.js").ApiSuccessResponse<Record<string, unknown>>>;
114
126
  getMercadoPagoPaymentStatus(paymentId: string): Promise<import("../types.js").ApiSuccessResponse<Record<string, unknown>>>;
115
- createMercadoPagoSubscription(input?: {
127
+ createMercadoPagoSubscription(input: {
128
+ expectedAmountMinor: number;
116
129
  cycle?: string | null;
117
130
  locale?: string | null;
118
131
  returnPath?: string | null;
@@ -11,14 +11,18 @@ export function createBillingResource(api) {
11
11
  resumeSubscription() {
12
12
  return api.post("/billing/subscription/resume", {});
13
13
  },
14
+ previewSubscriptionUpgrade(input) {
15
+ return api.post("/billing/subscription/upgrade/preview", input ?? {});
16
+ },
17
+ /** Confirm a current server quote after displaying its charge to the buyer. */
14
18
  upgradeSubscription(input) {
15
- return api.post("/billing/subscription/upgrade", input ?? {});
19
+ return api.post("/billing/subscription/upgrade", input);
16
20
  },
17
21
  listSubscriptionPaymentHistory() {
18
22
  return api.get("/billing/subscription/payment-history");
19
23
  },
20
24
  createSubscriptionCheckout(input) {
21
- return api.post("/billing/checkout/subscription", input ?? {});
25
+ return api.post("/billing/checkout/subscription", input);
22
26
  },
23
27
  createDiamondCheckout(input) {
24
28
  return api.post("/billing/checkout/diamonds", input ?? {});
@@ -1 +1 @@
1
- {"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/resources/billing.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,qBAAqB,CAAC,GAAY;IAC9C,OAAO;QACH,wBAAwB,CAAC,SAAiB;YACtC,OAAO,GAAG,CAAC,GAAG,CAAwB,kCAAkC,EAAE;gBACtE,KAAK,EAAE,EAAE,SAAS,EAAE;aACvB,CAAC,CAAC;QACP,CAAC;QAED,kBAAkB;YACd,OAAO,GAAG,CAAC,IAAI,CACX,8BAA8B,EAC9B,EAAE,CACL,CAAC;QACN,CAAC;QAED,kBAAkB;YACd,OAAO,GAAG,CAAC,IAAI,CACX,8BAA8B,EAC9B,EAAE,CACL,CAAC;QACN,CAAC;QAED,mBAAmB,CAAC,KAAkC;YAClD,OAAO,GAAG,CAAC,IAAI,CACX,+BAA+B,EAC/B,KAAK,IAAI,EAAE,CACd,CAAC;QACN,CAAC;QAED,8BAA8B;YAC1B,OAAO,GAAG,CAAC,GAAG,CACV,uCAAuC,CAC1C,CAAC;QACN,CAAC;QAED,0BAA0B,CAAC,KAW1B;YACG,OAAO,GAAG,CAAC,IAAI,CACX,gCAAgC,EAChC,KAAK,IAAI,EAAE,CACd,CAAC;QACN,CAAC;QAED,qBAAqB,CAAC,KAOrB;YACG,OAAO,GAAG,CAAC,IAAI,CACX,4BAA4B,EAC5B,KAAK,IAAI,EAAE,CACd,CAAC;QACN,CAAC;QAED,sBAAsB,CAAC,KAStB;YACG,OAAO,GAAG,CAAC,IAAI,CACX,8BAA8B,EAC9B,KAAK,CACR,CAAC;QACN,CAAC;QAED,0BAA0B,CACtB,MAAc,EACd,KAOC;YAED,OAAO,GAAG,CAAC,IAAI,CACX,2BAA2B,kBAAkB,CAAC,MAAM,CAAC,WAAW,EAChE,KAAK,IAAI,EAAE,CACd,CAAC;QACN,CAAC;QAED,4BAA4B,CAAC,KAO5B;YACG,OAAO,GAAG,CAAC,IAAI,CACX,mCAAmC,EACnC,KAAK,IAAI,EAAE,CACd,CAAC;QACN,CAAC;QAED,yBAAyB,CAAC,KAWzB;YACG,OAAO,GAAG,CAAC,IAAI,CACX,iCAAiC,EACjC,KAAK,CACR,CAAC;QACN,CAAC;QAED,8BAA8B,CAAC,KAa9B;YACG,OAAO,GAAG,CAAC,IAAI,CACX,qCAAqC,EACrC,KAAK,CACR,CAAC;QACN,CAAC;QAED,kCAAkC,CAAC,KAWlC;YACG,OAAO,GAAG,CAAC,IAAI,CACX,0CAA0C,EAC1C,KAAK,CACR,CAAC;QACN,CAAC;QAED,wBAAwB,CAAC,KAmBxB;YACG,OAAO,GAAG,CAAC,IAAI,CACX,8BAA8B,EAC9B,KAAK,CACR,CAAC;QACN,CAAC;QAED,2BAA2B,CAAC,SAAiB;YACzC,OAAO,GAAG,CAAC,GAAG,CACV,gCAAgC,kBAAkB,CAAC,SAAS,CAAC,SAAS,CACzE,CAAC;QACN,CAAC;QAED,6BAA6B,CAAC,KAK7B;YACG,OAAO,GAAG,CAAC,IAAI,CACX,mCAAmC,EACnC,KAAK,IAAI,EAAE,CACd,CAAC;QACN,CAAC;QAED,gBAAgB;YACZ,OAAO,GAAG,CAAC,GAAG,CAAY,wBAAwB,CAAC,CAAC;QACxD,CAAC;QAED,YAAY,CAAC,MAAc;YACvB,OAAO,GAAG,CAAC,IAAI,CACX,kBAAkB,kBAAkB,CAAC,MAAM,CAAC,OAAO,EACnD,EAAE,CACL,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/resources/billing.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,qBAAqB,CAAC,GAAY;IAC9C,OAAO;QACH,wBAAwB,CAAC,SAAiB;YACtC,OAAO,GAAG,CAAC,GAAG,CAAwB,kCAAkC,EAAE;gBACtE,KAAK,EAAE,EAAE,SAAS,EAAE;aACvB,CAAC,CAAC;QACP,CAAC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AG,CAAC,IAAI,CACX,qCAAqC,EACrC,KAAK,CACR,CAAC;QACN,CAAC;QAED,kCAAkC,CAAC,KAalC;YACG,OAAO,GAAG,CAAC,IAAI,CACX,0CAA0C,EAC1C,KAAK,CACR,CAAC;QACN,CAAC;QAED,wBAAwB,CAAC,KAqBxB;YACG,OAAO,GAAG,CAAC,IAAI,CACX,8BAA8B,EAC9B,KAAK,CACR,CAAC;QACN,CAAC;QAED,2BAA2B,CAAC,SAAiB;YACzC,OAAO,GAAG,CAAC,GAAG,CACV,gCAAgC,kBAAkB,CAAC,SAAS,CAAC,SAAS,CACzE,CAAC;QACN,CAAC;QAED,6BAA6B,CAAC,KAM7B;YACG,OAAO,GAAG,CAAC,IAAI,CACX,mCAAmC,EACnC,KAAK,IAAI,EAAE,CACd,CAAC;QACN,CAAC;QAED,gBAAgB;YACZ,OAAO,GAAG,CAAC,GAAG,CAAY,wBAAwB,CAAC,CAAC;QACxD,CAAC;QAED,YAAY,CAAC,MAAc;YACvB,OAAO,GAAG,CAAC,IAAI,CACX,kBAAkB,kBAAkB,CAAC,MAAM,CAAC,OAAO,EACnD,EAAE,CACL,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1162,6 +1162,24 @@ export interface CheckoutSessionResponse {
1162
1162
  publishableKey?: string | null;
1163
1163
  [key: string]: unknown;
1164
1164
  }
1165
+ export interface SubscriptionUpgradeQuote {
1166
+ /** Opaque account-bound confirmation token; expires after five minutes. */
1167
+ quoteId: string;
1168
+ provider: "stripe" | "mercadopago";
1169
+ currency: Uppercase<BillingCurrency>;
1170
+ /** Provider minor units: whole yen/won for JPY/KRW, hundredths otherwise. */
1171
+ amountDueMinor: number;
1172
+ /** Annual plan price before invoice taxes, discounts or account adjustments. */
1173
+ annualAmountMinor: number;
1174
+ prorationCreditMinor: number;
1175
+ expiresAt: string;
1176
+ chargeTiming: "immediate" | "next_billing_date";
1177
+ scheduledChangeAt: string | null;
1178
+ }
1179
+ export interface SubscriptionUpgradePreviewResponse {
1180
+ success: true;
1181
+ quote: SubscriptionUpgradeQuote;
1182
+ }
1165
1183
  export interface CheckoutSessionStatus {
1166
1184
  sessionId: string;
1167
1185
  status: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavezfm/api",
3
- "version": "0.7.25",
3
+ "version": "0.7.26",
4
4
  "description": "Official JavaScript/TypeScript API client for WavezFM.",
5
5
  "homepage": "https://docs.wavez.fm/docs",
6
6
  "repository": {