dodopayments 2.47.0 → 2.48.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/client.d.mts +2 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +2 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/entitlements/grants.d.mts +12 -1
  10. package/resources/entitlements/grants.d.mts.map +1 -1
  11. package/resources/entitlements/grants.d.ts +12 -1
  12. package/resources/entitlements/grants.d.ts.map +1 -1
  13. package/resources/entitlements/grants.js.map +1 -1
  14. package/resources/entitlements/grants.mjs.map +1 -1
  15. package/resources/index.d.mts +1 -1
  16. package/resources/index.d.mts.map +1 -1
  17. package/resources/index.d.ts +1 -1
  18. package/resources/index.d.ts.map +1 -1
  19. package/resources/index.js.map +1 -1
  20. package/resources/index.mjs.map +1 -1
  21. package/resources/products/products.d.mts +19 -16
  22. package/resources/products/products.d.mts.map +1 -1
  23. package/resources/products/products.d.ts +19 -16
  24. package/resources/products/products.d.ts.map +1 -1
  25. package/resources/products/products.js +0 -1
  26. package/resources/products/products.js.map +1 -1
  27. package/resources/products/products.mjs +0 -1
  28. package/resources/products/products.mjs.map +1 -1
  29. package/resources/subscriptions.d.mts +122 -5
  30. package/resources/subscriptions.d.mts.map +1 -1
  31. package/resources/subscriptions.d.ts +122 -5
  32. package/resources/subscriptions.d.ts.map +1 -1
  33. package/resources/subscriptions.js +2 -6
  34. package/resources/subscriptions.js.map +1 -1
  35. package/resources/subscriptions.mjs +2 -6
  36. package/resources/subscriptions.mjs.map +1 -1
  37. package/src/client.ts +2 -0
  38. package/src/resources/entitlements/grants.ts +14 -1
  39. package/src/resources/index.ts +1 -0
  40. package/src/resources/products/products.ts +22 -19
  41. package/src/resources/subscriptions.ts +133 -9
  42. package/src/version.ts +1 -1
  43. package/version.d.mts +1 -1
  44. package/version.d.ts +1 -1
  45. package/version.js +1 -1
  46. package/version.mjs +1 -1
package/src/client.ts CHANGED
@@ -166,6 +166,7 @@ import {
166
166
  ScheduledPlanChange,
167
167
  Subscription,
168
168
  SubscriptionChangePlanParams,
169
+ SubscriptionChangePlanResponse,
169
170
  SubscriptionChargeParams,
170
171
  SubscriptionChargeResponse,
171
172
  SubscriptionCreateParams,
@@ -1226,6 +1227,7 @@ export declare namespace DodoPayments {
1226
1227
  type UpdateSubscriptionPlanReq as UpdateSubscriptionPlanReq,
1227
1228
  type SubscriptionCreateResponse as SubscriptionCreateResponse,
1228
1229
  type SubscriptionListResponse as SubscriptionListResponse,
1230
+ type SubscriptionChangePlanResponse as SubscriptionChangePlanResponse,
1229
1231
  type SubscriptionChargeResponse as SubscriptionChargeResponse,
1230
1232
  type SubscriptionPreviewChangePlanResponse as SubscriptionPreviewChangePlanResponse,
1231
1233
  type SubscriptionRetrieveCreditUsageResponse as SubscriptionRetrieveCreditUsageResponse,
@@ -1,6 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
+ import * as LicenseKeysAPI from '../license-keys';
4
5
  import * as MiscAPI from '../misc';
5
6
  import * as EntitlementsAPI from './entitlements';
6
7
  import * as ProductsAPI from '../products/products';
@@ -210,7 +211,13 @@ export interface EntitlementGrant {
210
211
  */
211
212
  export interface LicenseKeyGrant {
212
213
  /**
213
- * Number of activations consumed so far.
214
+ * Identifier of the issued license key.
215
+ */
216
+ id: string;
217
+
218
+ /**
219
+ * Number of instances currently active. Activation increments it and deactivation
220
+ * decrements it, so it is a live count and not a total.
214
221
  */
215
222
  activations_used: number;
216
223
 
@@ -219,6 +226,12 @@ export interface LicenseKeyGrant {
219
226
  */
220
227
  key: string;
221
228
 
229
+ /**
230
+ * Current status of the license key. Activation fails unless it is `active`, so a
231
+ * client can warn before the customer tries.
232
+ */
233
+ status: LicenseKeysAPI.LicenseKeyStatus;
234
+
222
235
  /**
223
236
  * Maximum activations allowed by the entitlement, when set.
224
237
  */
@@ -230,6 +230,7 @@ export {
230
230
  type UpdateSubscriptionPlanReq,
231
231
  type SubscriptionCreateResponse,
232
232
  type SubscriptionListResponse,
233
+ type SubscriptionChangePlanResponse,
233
234
  type SubscriptionChargeResponse,
234
235
  type SubscriptionPreviewChangePlanResponse,
235
236
  type SubscriptionRetrieveCreditUsageResponse,
@@ -71,7 +71,6 @@ export class Products extends APIResource {
71
71
  * currency: 'AED',
72
72
  * discount: 0,
73
73
  * price: 0,
74
- * purchasing_power_parity: true,
75
74
  * type: 'one_time_price',
76
75
  * },
77
76
  * tax_category: 'digital_products',
@@ -501,12 +500,6 @@ export namespace Price {
501
500
  */
502
501
  price: number;
503
502
 
504
- /**
505
- * Indicates if purchasing power parity adjustments are applied to the price.
506
- * Purchasing power parity feature is not available as of now.
507
- */
508
- purchasing_power_parity: boolean;
509
-
510
503
  type: 'one_time_price';
511
504
 
512
505
  /**
@@ -515,6 +508,13 @@ export namespace Price {
515
508
  */
516
509
  pay_what_you_want?: boolean;
517
510
 
511
+ /**
512
+ * Opts this price in to purchasing power parity. The business must also enable
513
+ * purchasing power parity. The discount percentage per country is always
514
+ * business-wide. Defaults to `false`.
515
+ */
516
+ purchasing_power_parity?: boolean;
517
+
518
518
  /**
519
519
  * A suggested price for the user to pay. This value is only considered if
520
520
  * [`pay_what_you_want`](Self::pay_what_you_want) is `true`. Otherwise, it is
@@ -559,12 +559,6 @@ export namespace Price {
559
559
  */
560
560
  price: number;
561
561
 
562
- /**
563
- * Indicates if purchasing power parity adjustments are applied to the price.
564
- * Purchasing power parity feature is not available as of now
565
- */
566
- purchasing_power_parity: boolean;
567
-
568
562
  /**
569
563
  * Number of units for the subscription period. For example, a value of `12` with a
570
564
  * `subscription_period_interval` of `month` represents a one-year subscription.
@@ -578,6 +572,13 @@ export namespace Price {
578
572
 
579
573
  type: 'recurring_price';
580
574
 
575
+ /**
576
+ * Opts this price in to purchasing power parity. The business must also enable
577
+ * purchasing power parity. The discount percentage per country is always
578
+ * business-wide. Defaults to `false`.
579
+ */
580
+ purchasing_power_parity?: boolean;
581
+
581
582
  /**
582
583
  * Indicates if the price is tax inclusive
583
584
  */
@@ -632,12 +633,6 @@ export namespace Price {
632
633
  */
633
634
  payment_frequency_interval: SubscriptionsAPI.TimeInterval;
634
635
 
635
- /**
636
- * Indicates if purchasing power parity adjustments are applied to the price.
637
- * Purchasing power parity feature is not available as of now
638
- */
639
- purchasing_power_parity: boolean;
640
-
641
636
  /**
642
637
  * Number of units for the subscription period. For example, a value of `12` with a
643
638
  * `subscription_period_interval` of `month` represents a one-year subscription.
@@ -653,6 +648,14 @@ export namespace Price {
653
648
 
654
649
  meters?: Array<ProductsAPI.AddMeterToPrice> | null;
655
650
 
651
+ /**
652
+ * Opts this price in to purchasing power parity. The business must also enable
653
+ * purchasing power parity. The discount percentage per country is always
654
+ * business-wide. Applies to the fixed fee only, never to metered usage. Defaults
655
+ * to `false`.
656
+ */
657
+ purchasing_power_parity?: boolean;
658
+
656
659
  /**
657
660
  * Indicates if the price is tax inclusive
658
661
  */
@@ -91,7 +91,7 @@ export class Subscriptions extends APIResource {
91
91
  /**
92
92
  * @example
93
93
  * ```ts
94
- * await client.subscriptions.changePlan(
94
+ * const response = await client.subscriptions.changePlan(
95
95
  * 'sub_Iuaq622bbmmfOGrVTqdXv',
96
96
  * {
97
97
  * product_id: 'product_id',
@@ -105,12 +105,8 @@ export class Subscriptions extends APIResource {
105
105
  subscriptionID: string,
106
106
  body: SubscriptionChangePlanParams,
107
107
  options?: RequestOptions,
108
- ): APIPromise<void> {
109
- return this._client.post(path`/subscriptions/${subscriptionID}/change-plan`, {
110
- body,
111
- ...options,
112
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
113
- });
108
+ ): APIPromise<SubscriptionChangePlanResponse> {
109
+ return this._client.post(path`/subscriptions/${subscriptionID}/change-plan`, { body, ...options });
114
110
  }
115
111
 
116
112
  /**
@@ -738,6 +734,34 @@ export interface UpdateSubscriptionPlanReq {
738
734
  */
739
735
  addons?: Array<AttachAddon> | null;
740
736
 
737
+ /**
738
+ * Replace a scheduled plan change with this one.
739
+ *
740
+ * The scheduled change is cancelled by the transaction that applies this change. A
741
+ * change that never applies leaves the schedule in place.
742
+ *
743
+ * `effective_at: next_billing_date` is allowed. The new schedule then replaces the
744
+ * old one in the request transaction.
745
+ *
746
+ * A pending plan change still gets a `409`. This field does not affect it.
747
+ *
748
+ * The preview route shares this request body, so a preview that sets this field
749
+ * also passes the scheduled-change `409`.
750
+ */
751
+ cancel_scheduled_change_plan?: boolean;
752
+
753
+ /**
754
+ * Collect the plan-change amount with a payment link. The customer then pays on a
755
+ * checkout page.
756
+ *
757
+ * The business needs the `allow_plan_change_via_payment_link` capability. The
758
+ * request needs `effective_at: immediately`. The request also needs
759
+ * `on_payment_failure: prevent_change`.
760
+ *
761
+ * The preview route shares this request body and ignores this field.
762
+ */
763
+ collect_via_payment_link?: boolean;
764
+
741
765
  /**
742
766
  * @deprecated Use `discount_id` instead.
743
767
  */
@@ -1039,6 +1063,35 @@ export namespace SubscriptionListResponse {
1039
1063
  }
1040
1064
  }
1041
1065
 
1066
+ /**
1067
+ * Handles for a hosted checkout page that settles a plan change.
1068
+ *
1069
+ * The four fields repeat `UpdatePaymentMethodResponse` and a subset of
1070
+ * `CreateSubscriptionResponse`. A shared type would rename the generated SDK types
1071
+ * for all three routes, so each route keeps its own.
1072
+ */
1073
+ export interface SubscriptionChangePlanResponse {
1074
+ /**
1075
+ * Client secret for an embedded checkout.
1076
+ */
1077
+ client_secret?: string | null;
1078
+
1079
+ /**
1080
+ * When the link stops working.
1081
+ */
1082
+ expires_on?: string | null;
1083
+
1084
+ /**
1085
+ * Id of the payment that settles the plan change.
1086
+ */
1087
+ payment_id?: string | null;
1088
+
1089
+ /**
1090
+ * Checkout page URL. Give this to the customer.
1091
+ */
1092
+ payment_link?: string | null;
1093
+ }
1094
+
1042
1095
  export interface SubscriptionChargeResponse {
1043
1096
  payment_id: string;
1044
1097
  }
@@ -1535,11 +1588,25 @@ export interface SubscriptionUpdateParams {
1535
1588
  next_billing_date?: string | null;
1536
1589
 
1537
1590
  /**
1538
- * `Some(true)` pauses an active subscription; `Some(false)` unpauses a `Paused`
1539
- * (or abandoned `OnHold`) subscription. Exclusive of every other field.
1591
+ * Removed. Use `status: paused` to pause and `status: active` to resume. This
1592
+ * field always fails with 422, so a caller still on it gets a loud error instead
1593
+ * of a silent no-op.
1540
1594
  */
1541
1595
  pause?: boolean | null;
1542
1596
 
1597
+ /**
1598
+ * Set to `cancelled` to cancel the subscription. See `cancel_reason`,
1599
+ * `cancellation_feedback`, `cancellation_comment`, and
1600
+ * `cancel_at_next_billing_date` for cancellation options.
1601
+ *
1602
+ * Set to `paused` to pause an active subscription. Set to `active` to resume a
1603
+ * `paused` subscription. `active` also resumes an `on_hold` subscription that has
1604
+ * an unpaid pause invoice. This voids that invoice.
1605
+ *
1606
+ * Send `paused` or `active` alone. A request that combines either with any other
1607
+ * field fails with 422. `cancelled` is not exclusive this way — see
1608
+ * `cancel_reason` and friends below.
1609
+ */
1543
1610
  status?: SubscriptionStatus | null;
1544
1611
 
1545
1612
  /**
@@ -1680,6 +1747,34 @@ export interface SubscriptionChangePlanParams {
1680
1747
  */
1681
1748
  addons?: Array<AttachAddon> | null;
1682
1749
 
1750
+ /**
1751
+ * Replace a scheduled plan change with this one.
1752
+ *
1753
+ * The scheduled change is cancelled by the transaction that applies this change. A
1754
+ * change that never applies leaves the schedule in place.
1755
+ *
1756
+ * `effective_at: next_billing_date` is allowed. The new schedule then replaces the
1757
+ * old one in the request transaction.
1758
+ *
1759
+ * A pending plan change still gets a `409`. This field does not affect it.
1760
+ *
1761
+ * The preview route shares this request body, so a preview that sets this field
1762
+ * also passes the scheduled-change `409`.
1763
+ */
1764
+ cancel_scheduled_change_plan?: boolean;
1765
+
1766
+ /**
1767
+ * Collect the plan-change amount with a payment link. The customer then pays on a
1768
+ * checkout page.
1769
+ *
1770
+ * The business needs the `allow_plan_change_via_payment_link` capability. The
1771
+ * request needs `effective_at: immediately`. The request also needs
1772
+ * `on_payment_failure: prevent_change`.
1773
+ *
1774
+ * The preview route shares this request body and ignores this field.
1775
+ */
1776
+ collect_via_payment_link?: boolean;
1777
+
1683
1778
  /**
1684
1779
  * @deprecated Use `discount_id` instead.
1685
1780
  */
@@ -1796,6 +1891,34 @@ export interface SubscriptionPreviewChangePlanParams {
1796
1891
  */
1797
1892
  addons?: Array<AttachAddon> | null;
1798
1893
 
1894
+ /**
1895
+ * Replace a scheduled plan change with this one.
1896
+ *
1897
+ * The scheduled change is cancelled by the transaction that applies this change. A
1898
+ * change that never applies leaves the schedule in place.
1899
+ *
1900
+ * `effective_at: next_billing_date` is allowed. The new schedule then replaces the
1901
+ * old one in the request transaction.
1902
+ *
1903
+ * A pending plan change still gets a `409`. This field does not affect it.
1904
+ *
1905
+ * The preview route shares this request body, so a preview that sets this field
1906
+ * also passes the scheduled-change `409`.
1907
+ */
1908
+ cancel_scheduled_change_plan?: boolean;
1909
+
1910
+ /**
1911
+ * Collect the plan-change amount with a payment link. The customer then pays on a
1912
+ * checkout page.
1913
+ *
1914
+ * The business needs the `allow_plan_change_via_payment_link` capability. The
1915
+ * request needs `effective_at: immediately`. The request also needs
1916
+ * `on_payment_failure: prevent_change`.
1917
+ *
1918
+ * The preview route shares this request body and ignores this field.
1919
+ */
1920
+ collect_via_payment_link?: boolean;
1921
+
1799
1922
  /**
1800
1923
  * @deprecated Use `discount_id` instead.
1801
1924
  */
@@ -1851,6 +1974,7 @@ export declare namespace Subscriptions {
1851
1974
  type UpdateSubscriptionPlanReq as UpdateSubscriptionPlanReq,
1852
1975
  type SubscriptionCreateResponse as SubscriptionCreateResponse,
1853
1976
  type SubscriptionListResponse as SubscriptionListResponse,
1977
+ type SubscriptionChangePlanResponse as SubscriptionChangePlanResponse,
1854
1978
  type SubscriptionChargeResponse as SubscriptionChargeResponse,
1855
1979
  type SubscriptionPreviewChangePlanResponse as SubscriptionPreviewChangePlanResponse,
1856
1980
  type SubscriptionRetrieveCreditUsageResponse as SubscriptionRetrieveCreditUsageResponse,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '2.47.0'; // x-release-please-version
1
+ export const VERSION = '2.48.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.47.0";
1
+ export declare const VERSION = "2.48.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.47.0";
1
+ export declare const VERSION = "2.48.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '2.47.0'; // x-release-please-version
4
+ exports.VERSION = '2.48.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.47.0'; // x-release-please-version
1
+ export const VERSION = '2.48.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map