dodopayments 2.52.0 → 2.54.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 (47) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/client.d.mts +4 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +4 -4
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs +1 -1
  8. package/client.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/resources/checkout-sessions.d.mts +40 -8
  11. package/resources/checkout-sessions.d.mts.map +1 -1
  12. package/resources/checkout-sessions.d.ts +40 -8
  13. package/resources/checkout-sessions.d.ts.map +1 -1
  14. package/resources/customers/emails.d.mts +2 -1
  15. package/resources/customers/emails.d.mts.map +1 -1
  16. package/resources/customers/emails.d.ts +2 -1
  17. package/resources/customers/emails.d.ts.map +1 -1
  18. package/resources/index.d.mts +2 -2
  19. package/resources/index.d.mts.map +1 -1
  20. package/resources/index.d.ts +2 -2
  21. package/resources/index.d.ts.map +1 -1
  22. package/resources/index.js.map +1 -1
  23. package/resources/index.mjs.map +1 -1
  24. package/resources/payments.d.mts +10 -0
  25. package/resources/payments.d.mts.map +1 -1
  26. package/resources/payments.d.ts +10 -0
  27. package/resources/payments.d.ts.map +1 -1
  28. package/resources/refunds.d.mts +16 -1
  29. package/resources/refunds.d.mts.map +1 -1
  30. package/resources/refunds.d.ts +16 -1
  31. package/resources/refunds.d.ts.map +1 -1
  32. package/resources/subscriptions.d.mts +126 -6
  33. package/resources/subscriptions.d.mts.map +1 -1
  34. package/resources/subscriptions.d.ts +126 -6
  35. package/resources/subscriptions.d.ts.map +1 -1
  36. package/src/client.ts +11 -1
  37. package/src/resources/checkout-sessions.ts +40 -8
  38. package/src/resources/customers/emails.ts +2 -1
  39. package/src/resources/index.ts +2 -0
  40. package/src/resources/payments.ts +12 -0
  41. package/src/resources/refunds.ts +23 -0
  42. package/src/resources/subscriptions.ts +138 -5
  43. package/src/version.ts +1 -1
  44. package/version.d.mts +1 -1
  45. package/version.d.ts +1 -1
  46. package/version.js +1 -1
  47. package/version.mjs +1 -1
@@ -634,6 +634,12 @@ export interface Subscription {
634
634
  */
635
635
  cancelled_at?: string | null;
636
636
 
637
+ /**
638
+ * The caller that cancelled the subscription or scheduled its cancel. `null` when
639
+ * no caller is known, for example when the system cancelled the subscription.
640
+ */
641
+ cancelled_by?: SubscriptionCancelledBy | null;
642
+
637
643
  /**
638
644
  * Customer's responses to custom fields collected during checkout
639
645
  */
@@ -694,6 +700,28 @@ export interface Subscription {
694
700
  trial_amount?: number | null;
695
701
  }
696
702
 
703
+ /**
704
+ * The caller that cancelled a subscription or scheduled its cancel.
705
+ */
706
+ export interface SubscriptionCancelledBy {
707
+ /**
708
+ * The kind of caller.
709
+ */
710
+ actor_type: 'customer' | 'merchant_user' | 'api_key' | 'dodo_team';
711
+
712
+ /**
713
+ * Email of the customer or of the dashboard user. `null` for an API key or the
714
+ * Dodo Payments team.
715
+ */
716
+ email?: string | null;
717
+
718
+ /**
719
+ * Name of the customer or of the dashboard user. `null` for an API key or the Dodo
720
+ * Payments team.
721
+ */
722
+ name?: string | null;
723
+ }
724
+
697
725
  export type SubscriptionStatus =
698
726
  | 'pending'
699
727
  | 'active'
@@ -741,6 +769,22 @@ export interface UpdateSubscriptionPlanReq {
741
769
  */
742
770
  addons?: Array<AttachAddon> | null;
743
771
 
772
+ /**
773
+ * Cancel the payment link of a pending plan change, so that this change can
774
+ * replace it.
775
+ *
776
+ * The link is cancelled only if the customer has not started to pay. A paid or
777
+ * in-progress payment gives a `409`. A failed cancel gives a `503`, and a retry is
778
+ * safe.
779
+ *
780
+ * The request is validated before the cancel. A later failure, for example an
781
+ * amount below the minimum, leaves the subscription on its current plan with no
782
+ * open link. A retry is safe.
783
+ *
784
+ * The preview route shares this request body and ignores this field.
785
+ */
786
+ cancel_older_payment_link?: boolean;
787
+
744
788
  /**
745
789
  * Replace a scheduled plan change with this one.
746
790
  *
@@ -806,6 +850,20 @@ export interface UpdateSubscriptionPlanReq {
806
850
  * If not specified, uses the business-level default setting.
807
851
  */
808
852
  on_payment_failure?: 'prevent_change' | 'apply_change' | null;
853
+
854
+ /**
855
+ * The URL that receives the customer after they pay the payment link. Needs
856
+ * `collect_via_payment_link: true`. Without it, the request gets a `422`. A change
857
+ * that collects no money issues no link and does not use the URL. The preview
858
+ * route validates this field but does not use it.
859
+ *
860
+ * The redirect adds `subscription_id`, `payment_id` and `status`. The `status`
861
+ * value is the status of the plan-change payment. It is not the status of the
862
+ * subscription. When that payment fails, the subscription stays active on its
863
+ * current plan. To try again, call this endpoint again to get a new link. The new
864
+ * plan can apply after the redirect, when the payment webhook arrives.
865
+ */
866
+ return_url?: string | null;
809
867
  }
810
868
 
811
869
  export interface SubscriptionCreateResponse {
@@ -1014,6 +1072,12 @@ export interface SubscriptionListResponse {
1014
1072
  */
1015
1073
  cancelled_at?: string | null;
1016
1074
 
1075
+ /**
1076
+ * The caller that cancelled the subscription or scheduled its cancel. `null` when
1077
+ * no caller is known, for example when the system cancelled the subscription.
1078
+ */
1079
+ cancelled_by?: SubscriptionCancelledBy | null;
1080
+
1017
1081
  /**
1018
1082
  * Business / legal name associated with the tax id (B2B). When set this is used on
1019
1083
  * the invoice in place of the customer's personal name.
@@ -1225,14 +1289,22 @@ export namespace SubscriptionPreviewChangePlanResponse {
1225
1289
  currency: MiscAPI.Currency;
1226
1290
 
1227
1291
  /**
1228
- * Net credit movement in the smallest currency unit (e.g. cents). **Negative** –
1229
- * credits were deducted from the customer's balance to offset the charge (typical
1230
- * on upgrades). **Positive** – credits were added to the customer's balance,
1231
- * either from a downgrade proration refund or from topping-up the wallet to meet a
1232
- * gateway minimum-charge threshold. **Zero** – no credit movement occurred.
1292
+ * Net credit movement in the smallest unit of `customer_credits_currency` (e.g.
1293
+ * cents). Read `customer_credits_currency` for the currency. It can differ from
1294
+ * `currency`. **Negative** – credits were deducted from the customer's balance to
1295
+ * offset the charge (typical on upgrades). **Positive** – credits were added to
1296
+ * the customer's balance, either from a downgrade proration refund or from
1297
+ * topping-up the wallet to meet a gateway minimum-charge threshold. **Zero** – no
1298
+ * credit movement occurred.
1233
1299
  */
1234
1300
  customer_credits: number;
1235
1301
 
1302
+ /**
1303
+ * This field gives the currency of `customer_credits`. The credit wallet uses the
1304
+ * subscription currency.
1305
+ */
1306
+ customer_credits_currency: MiscAPI.Currency;
1307
+
1236
1308
  settlement_amount: number;
1237
1309
 
1238
1310
  settlement_currency: MiscAPI.Currency;
@@ -1767,6 +1839,22 @@ export interface SubscriptionChangePlanParams {
1767
1839
  */
1768
1840
  addons?: Array<AttachAddon> | null;
1769
1841
 
1842
+ /**
1843
+ * Cancel the payment link of a pending plan change, so that this change can
1844
+ * replace it.
1845
+ *
1846
+ * The link is cancelled only if the customer has not started to pay. A paid or
1847
+ * in-progress payment gives a `409`. A failed cancel gives a `503`, and a retry is
1848
+ * safe.
1849
+ *
1850
+ * The request is validated before the cancel. A later failure, for example an
1851
+ * amount below the minimum, leaves the subscription on its current plan with no
1852
+ * open link. A retry is safe.
1853
+ *
1854
+ * The preview route shares this request body and ignores this field.
1855
+ */
1856
+ cancel_older_payment_link?: boolean;
1857
+
1770
1858
  /**
1771
1859
  * Replace a scheduled plan change with this one.
1772
1860
  *
@@ -1832,6 +1920,20 @@ export interface SubscriptionChangePlanParams {
1832
1920
  * If not specified, uses the business-level default setting.
1833
1921
  */
1834
1922
  on_payment_failure?: 'prevent_change' | 'apply_change' | null;
1923
+
1924
+ /**
1925
+ * The URL that receives the customer after they pay the payment link. Needs
1926
+ * `collect_via_payment_link: true`. Without it, the request gets a `422`. A change
1927
+ * that collects no money issues no link and does not use the URL. The preview
1928
+ * route validates this field but does not use it.
1929
+ *
1930
+ * The redirect adds `subscription_id`, `payment_id` and `status`. The `status`
1931
+ * value is the status of the plan-change payment. It is not the status of the
1932
+ * subscription. When that payment fails, the subscription stays active on its
1933
+ * current plan. To try again, call this endpoint again to get a new link. The new
1934
+ * plan can apply after the redirect, when the payment webhook arrives.
1935
+ */
1936
+ return_url?: string | null;
1835
1937
  }
1836
1938
 
1837
1939
  export interface SubscriptionRetrieveUsageHistoryParams extends DefaultPageNumberPaginationParams {
@@ -1911,6 +2013,22 @@ export interface SubscriptionPreviewChangePlanParams {
1911
2013
  */
1912
2014
  addons?: Array<AttachAddon> | null;
1913
2015
 
2016
+ /**
2017
+ * Cancel the payment link of a pending plan change, so that this change can
2018
+ * replace it.
2019
+ *
2020
+ * The link is cancelled only if the customer has not started to pay. A paid or
2021
+ * in-progress payment gives a `409`. A failed cancel gives a `503`, and a retry is
2022
+ * safe.
2023
+ *
2024
+ * The request is validated before the cancel. A later failure, for example an
2025
+ * amount below the minimum, leaves the subscription on its current plan with no
2026
+ * open link. A retry is safe.
2027
+ *
2028
+ * The preview route shares this request body and ignores this field.
2029
+ */
2030
+ cancel_older_payment_link?: boolean;
2031
+
1914
2032
  /**
1915
2033
  * Replace a scheduled plan change with this one.
1916
2034
  *
@@ -1976,6 +2094,20 @@ export interface SubscriptionPreviewChangePlanParams {
1976
2094
  * If not specified, uses the business-level default setting.
1977
2095
  */
1978
2096
  on_payment_failure?: 'prevent_change' | 'apply_change' | null;
2097
+
2098
+ /**
2099
+ * The URL that receives the customer after they pay the payment link. Needs
2100
+ * `collect_via_payment_link: true`. Without it, the request gets a `422`. A change
2101
+ * that collects no money issues no link and does not use the URL. The preview
2102
+ * route validates this field but does not use it.
2103
+ *
2104
+ * The redirect adds `subscription_id`, `payment_id` and `status`. The `status`
2105
+ * value is the status of the plan-change payment. It is not the status of the
2106
+ * subscription. When that payment fails, the subscription stays active on its
2107
+ * current plan. To try again, call this endpoint again to get a new link. The new
2108
+ * plan can apply after the redirect, when the payment webhook arrives.
2109
+ */
2110
+ return_url?: string | null;
1979
2111
  }
1980
2112
 
1981
2113
  export declare namespace Subscriptions {
@@ -1989,6 +2121,7 @@ export declare namespace Subscriptions {
1989
2121
  type OnDemandSubscription as OnDemandSubscription,
1990
2122
  type ScheduledPlanChange as ScheduledPlanChange,
1991
2123
  type Subscription as Subscription,
2124
+ type SubscriptionCancelledBy as SubscriptionCancelledBy,
1992
2125
  type SubscriptionStatus as SubscriptionStatus,
1993
2126
  type TimeInterval as TimeInterval,
1994
2127
  type UpdateSubscriptionPlanReq as UpdateSubscriptionPlanReq,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '2.52.0'; // x-release-please-version
1
+ export const VERSION = '2.54.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.52.0";
1
+ export declare const VERSION = "2.54.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.52.0";
1
+ export declare const VERSION = "2.54.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.52.0'; // x-release-please-version
4
+ exports.VERSION = '2.54.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.52.0'; // x-release-please-version
1
+ export const VERSION = '2.54.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map