dodopayments 2.31.0 → 2.31.2
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 +29 -0
- package/internal/utils/log.d.mts.map +1 -1
- package/internal/utils/log.d.ts.map +1 -1
- package/internal/utils/log.js +2 -0
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs +2 -0
- package/internal/utils/log.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/checkout-sessions.d.mts +50 -0
- package/resources/checkout-sessions.d.mts.map +1 -1
- package/resources/checkout-sessions.d.ts +50 -0
- package/resources/checkout-sessions.d.ts.map +1 -1
- package/resources/payments.d.mts +90 -3
- package/resources/payments.d.mts.map +1 -1
- package/resources/payments.d.ts +90 -3
- package/resources/payments.d.ts.map +1 -1
- package/resources/payments.js.map +1 -1
- package/resources/payments.mjs.map +1 -1
- package/resources/payouts/payouts.d.mts +6 -3
- package/resources/payouts/payouts.d.mts.map +1 -1
- package/resources/payouts/payouts.d.ts +6 -3
- package/resources/payouts/payouts.d.ts.map +1 -1
- package/resources/payouts/payouts.js.map +1 -1
- package/resources/payouts/payouts.mjs.map +1 -1
- package/resources/products/products.d.mts +18 -36
- package/resources/products/products.d.mts.map +1 -1
- package/resources/products/products.d.ts +18 -36
- package/resources/products/products.d.ts.map +1 -1
- package/resources/products/products.js.map +1 -1
- package/resources/products/products.mjs.map +1 -1
- package/resources/subscriptions.d.mts +139 -18
- package/resources/subscriptions.d.mts.map +1 -1
- package/resources/subscriptions.d.ts +139 -18
- package/resources/subscriptions.d.ts.map +1 -1
- package/resources/subscriptions.js.map +1 -1
- package/resources/subscriptions.mjs.map +1 -1
- package/resources/webhook-events.d.mts +1 -1
- package/resources/webhook-events.d.mts.map +1 -1
- package/resources/webhook-events.d.ts +1 -1
- package/resources/webhook-events.d.ts.map +1 -1
- package/src/internal/utils/log.ts +2 -0
- package/src/resources/checkout-sessions.ts +56 -0
- package/src/resources/payments.ts +107 -3
- package/src/resources/payouts/payouts.ts +6 -3
- package/src/resources/products/products.ts +18 -36
- package/src/resources/subscriptions.ts +162 -18
- package/src/resources/webhook-events.ts +3 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../core/resource';
|
|
4
4
|
import * as SubscriptionsAPI from './subscriptions';
|
|
5
|
+
import * as DiscountsAPI from './discounts';
|
|
5
6
|
import * as MiscAPI from './misc';
|
|
6
7
|
import * as PaymentsAPI from './payments';
|
|
7
8
|
import * as CreditEntitlementsAPI from './credit-entitlements/credit-entitlements';
|
|
@@ -527,15 +528,20 @@ export interface Subscription {
|
|
|
527
528
|
custom_field_responses?: Array<PaymentsAPI.CustomFieldResponse> | null;
|
|
528
529
|
|
|
529
530
|
/**
|
|
530
|
-
*
|
|
531
|
+
* DEPRECATED: Use discounts[].cycles_remaining instead.
|
|
531
532
|
*/
|
|
532
533
|
discount_cycles_remaining?: number | null;
|
|
533
534
|
|
|
534
535
|
/**
|
|
535
|
-
*
|
|
536
|
+
* DEPRECATED: Use discounts instead. Returns the first discount's ID if present.
|
|
536
537
|
*/
|
|
537
538
|
discount_id?: string | null;
|
|
538
539
|
|
|
540
|
+
/**
|
|
541
|
+
* All stacked discounts applied, ordered by position
|
|
542
|
+
*/
|
|
543
|
+
discounts?: Array<Subscription.Discount> | null;
|
|
544
|
+
|
|
539
545
|
/**
|
|
540
546
|
* Timestamp when the subscription will expire
|
|
541
547
|
*/
|
|
@@ -557,6 +563,95 @@ export interface Subscription {
|
|
|
557
563
|
tax_id?: string | null;
|
|
558
564
|
}
|
|
559
565
|
|
|
566
|
+
export namespace Subscription {
|
|
567
|
+
/**
|
|
568
|
+
* Response struct for a discount with its position in a stack and optional
|
|
569
|
+
* cycle-tracking information (for subscriptions).
|
|
570
|
+
*/
|
|
571
|
+
export interface Discount {
|
|
572
|
+
/**
|
|
573
|
+
* The discount amount (basis points for percentage, USD cents for flat)
|
|
574
|
+
*/
|
|
575
|
+
amount: number;
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* The business this discount belongs to
|
|
579
|
+
*/
|
|
580
|
+
business_id: string;
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* The discount code
|
|
584
|
+
*/
|
|
585
|
+
code: string;
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Timestamp when the discount was created
|
|
589
|
+
*/
|
|
590
|
+
created_at: string;
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* The unique discount ID
|
|
594
|
+
*/
|
|
595
|
+
discount_id: string;
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Additional metadata
|
|
599
|
+
*/
|
|
600
|
+
metadata: { [key: string]: string };
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Position of this discount in the stack (0-based)
|
|
604
|
+
*/
|
|
605
|
+
position: number;
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Whether this discount should be preserved when a subscription changes plans
|
|
609
|
+
*/
|
|
610
|
+
preserve_on_plan_change: boolean;
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* List of product IDs to which this discount is restricted
|
|
614
|
+
*/
|
|
615
|
+
restricted_to: Array<string>;
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* How many times this discount has been used
|
|
619
|
+
*/
|
|
620
|
+
times_used: number;
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* The type of discount
|
|
624
|
+
*/
|
|
625
|
+
type: DiscountsAPI.DiscountType;
|
|
626
|
+
|
|
627
|
+
/**
|
|
628
|
+
* Remaining billing cycles for this discount on this subscription (None for
|
|
629
|
+
* one-time payments)
|
|
630
|
+
*/
|
|
631
|
+
cycles_remaining?: number | null;
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Optional date/time after which discount is expired
|
|
635
|
+
*/
|
|
636
|
+
expires_at?: string | null;
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Name for the Discount
|
|
640
|
+
*/
|
|
641
|
+
name?: string | null;
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Number of subscription billing cycles this discount is valid for
|
|
645
|
+
*/
|
|
646
|
+
subscription_cycles?: number | null;
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Usage limit for this discount, if any
|
|
650
|
+
*/
|
|
651
|
+
usage_limit?: number | null;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
|
|
560
655
|
export type SubscriptionStatus = 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired';
|
|
561
656
|
|
|
562
657
|
export type TimeInterval = 'Day' | 'Week' | 'Month' | 'Year';
|
|
@@ -594,13 +689,18 @@ export interface UpdateSubscriptionPlanReq {
|
|
|
594
689
|
addons?: Array<AttachAddon> | null;
|
|
595
690
|
|
|
596
691
|
/**
|
|
597
|
-
*
|
|
598
|
-
* applies the discount to the plan change. If not provided and the subscription
|
|
599
|
-
* has an existing discount with `preserve_on_plan_change=true`, the existing
|
|
600
|
-
* discount will be preserved (if applicable to the new product).
|
|
692
|
+
* @deprecated Use `discount_id` instead.
|
|
601
693
|
*/
|
|
602
694
|
discount_code?: string | null;
|
|
603
695
|
|
|
696
|
+
/**
|
|
697
|
+
* Stacked discount codes to apply to the new plan. Max 20. Cannot be used together
|
|
698
|
+
* with discount_code. If provided, replaces any existing discount codes. Empty
|
|
699
|
+
* array removes all discounts. If not provided (None), existing discounts with
|
|
700
|
+
* preserve_on_plan_change=true are preserved.
|
|
701
|
+
*/
|
|
702
|
+
discount_codes?: Array<string> | null;
|
|
703
|
+
|
|
604
704
|
/**
|
|
605
705
|
* When to apply the plan change.
|
|
606
706
|
*
|
|
@@ -666,10 +766,15 @@ export interface SubscriptionCreateResponse {
|
|
|
666
766
|
client_secret?: string | null;
|
|
667
767
|
|
|
668
768
|
/**
|
|
669
|
-
*
|
|
769
|
+
* @deprecated Use `discounts` instead.
|
|
670
770
|
*/
|
|
671
771
|
discount_id?: string | null;
|
|
672
772
|
|
|
773
|
+
/**
|
|
774
|
+
* All stacked discount IDs applied, in order of application
|
|
775
|
+
*/
|
|
776
|
+
discount_ids?: Array<string> | null;
|
|
777
|
+
|
|
673
778
|
/**
|
|
674
779
|
* Expiry timestamp of the payment link
|
|
675
780
|
*/
|
|
@@ -723,6 +828,11 @@ export interface SubscriptionListResponse {
|
|
|
723
828
|
*/
|
|
724
829
|
customer: PaymentsAPI.CustomerLimitedDetails;
|
|
725
830
|
|
|
831
|
+
/**
|
|
832
|
+
* All stacked discounts applied, in order of application
|
|
833
|
+
*/
|
|
834
|
+
discounts: Array<SubscriptionListResponse.Discount>;
|
|
835
|
+
|
|
726
836
|
/**
|
|
727
837
|
* Additional custom data associated with the subscription
|
|
728
838
|
*/
|
|
@@ -806,12 +916,12 @@ export interface SubscriptionListResponse {
|
|
|
806
916
|
cancelled_at?: string | null;
|
|
807
917
|
|
|
808
918
|
/**
|
|
809
|
-
*
|
|
919
|
+
* DEPRECATED: Use discounts[].cycles_remaining instead.
|
|
810
920
|
*/
|
|
811
921
|
discount_cycles_remaining?: number | null;
|
|
812
922
|
|
|
813
923
|
/**
|
|
814
|
-
*
|
|
924
|
+
* DEPRECATED: Use discounts instead.
|
|
815
925
|
*/
|
|
816
926
|
discount_id?: string | null;
|
|
817
927
|
|
|
@@ -836,6 +946,24 @@ export interface SubscriptionListResponse {
|
|
|
836
946
|
tax_id?: string | null;
|
|
837
947
|
}
|
|
838
948
|
|
|
949
|
+
export namespace SubscriptionListResponse {
|
|
950
|
+
/**
|
|
951
|
+
* Lightweight discount info for list endpoints. Array order represents position
|
|
952
|
+
* (no explicit position field).
|
|
953
|
+
*/
|
|
954
|
+
export interface Discount {
|
|
955
|
+
/**
|
|
956
|
+
* The unique discount ID
|
|
957
|
+
*/
|
|
958
|
+
discount_id: string;
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* Remaining billing cycles for this discount on this subscription
|
|
962
|
+
*/
|
|
963
|
+
discount_cycles_remaining?: number | null;
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
|
|
839
967
|
export interface SubscriptionChargeResponse {
|
|
840
968
|
payment_id: string;
|
|
841
969
|
}
|
|
@@ -1137,10 +1265,16 @@ export interface SubscriptionCreateParams {
|
|
|
1137
1265
|
billing_currency?: MiscAPI.Currency | null;
|
|
1138
1266
|
|
|
1139
1267
|
/**
|
|
1140
|
-
*
|
|
1268
|
+
* @deprecated Use `discount_id` instead.
|
|
1141
1269
|
*/
|
|
1142
1270
|
discount_code?: string | null;
|
|
1143
1271
|
|
|
1272
|
+
/**
|
|
1273
|
+
* Stacked discount codes to apply, in order of application. Max 20. Cannot be used
|
|
1274
|
+
* together with discount_code.
|
|
1275
|
+
*/
|
|
1276
|
+
discount_codes?: Array<string> | null;
|
|
1277
|
+
|
|
1144
1278
|
/**
|
|
1145
1279
|
* Override merchant default 3DS behaviour for this subscription
|
|
1146
1280
|
*/
|
|
@@ -1362,13 +1496,18 @@ export interface SubscriptionChangePlanParams {
|
|
|
1362
1496
|
addons?: Array<AttachAddon> | null;
|
|
1363
1497
|
|
|
1364
1498
|
/**
|
|
1365
|
-
*
|
|
1366
|
-
* applies the discount to the plan change. If not provided and the subscription
|
|
1367
|
-
* has an existing discount with `preserve_on_plan_change=true`, the existing
|
|
1368
|
-
* discount will be preserved (if applicable to the new product).
|
|
1499
|
+
* @deprecated Use `discount_id` instead.
|
|
1369
1500
|
*/
|
|
1370
1501
|
discount_code?: string | null;
|
|
1371
1502
|
|
|
1503
|
+
/**
|
|
1504
|
+
* Stacked discount codes to apply to the new plan. Max 20. Cannot be used together
|
|
1505
|
+
* with discount_code. If provided, replaces any existing discount codes. Empty
|
|
1506
|
+
* array removes all discounts. If not provided (None), existing discounts with
|
|
1507
|
+
* preserve_on_plan_change=true are preserved.
|
|
1508
|
+
*/
|
|
1509
|
+
discount_codes?: Array<string> | null;
|
|
1510
|
+
|
|
1372
1511
|
/**
|
|
1373
1512
|
* When to apply the plan change.
|
|
1374
1513
|
*
|
|
@@ -1483,13 +1622,18 @@ export interface SubscriptionPreviewChangePlanParams {
|
|
|
1483
1622
|
addons?: Array<AttachAddon> | null;
|
|
1484
1623
|
|
|
1485
1624
|
/**
|
|
1486
|
-
*
|
|
1487
|
-
* applies the discount to the plan change. If not provided and the subscription
|
|
1488
|
-
* has an existing discount with `preserve_on_plan_change=true`, the existing
|
|
1489
|
-
* discount will be preserved (if applicable to the new product).
|
|
1625
|
+
* @deprecated Use `discount_id` instead.
|
|
1490
1626
|
*/
|
|
1491
1627
|
discount_code?: string | null;
|
|
1492
1628
|
|
|
1629
|
+
/**
|
|
1630
|
+
* Stacked discount codes to apply to the new plan. Max 20. Cannot be used together
|
|
1631
|
+
* with discount_code. If provided, replaces any existing discount codes. Empty
|
|
1632
|
+
* array removes all discounts. If not provided (None), existing discounts with
|
|
1633
|
+
* preserve_on_plan_change=true are preserved.
|
|
1634
|
+
*/
|
|
1635
|
+
discount_codes?: Array<string> | null;
|
|
1636
|
+
|
|
1493
1637
|
/**
|
|
1494
1638
|
* When to apply the plan change.
|
|
1495
1639
|
*
|
|
@@ -32,6 +32,9 @@ export type WebhookEventType =
|
|
|
32
32
|
| 'subscription.renewed'
|
|
33
33
|
| 'subscription.on_hold'
|
|
34
34
|
| 'subscription.cancelled'
|
|
35
|
+
| 'subscription.cancellation_scheduled'
|
|
36
|
+
| 'subscription.trial_ending'
|
|
37
|
+
| 'subscription.upcoming_renewal'
|
|
35
38
|
| 'subscription.failed'
|
|
36
39
|
| 'subscription.expired'
|
|
37
40
|
| 'subscription.plan_changed'
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '2.31.
|
|
1
|
+
export const VERSION = '2.31.2'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.31.
|
|
1
|
+
export declare const VERSION = "2.31.2";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.31.
|
|
1
|
+
export declare const VERSION = "2.31.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '2.31.
|
|
1
|
+
export const VERSION = '2.31.2'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|