dodopayments 2.42.1 → 2.43.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 (74) hide show
  1. package/CHANGELOG.md +16 -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/checkout-sessions.d.mts +24 -1
  10. package/resources/checkout-sessions.d.mts.map +1 -1
  11. package/resources/checkout-sessions.d.ts +24 -1
  12. package/resources/checkout-sessions.d.ts.map +1 -1
  13. package/resources/credit-entitlements/balances.d.mts +3 -1
  14. package/resources/credit-entitlements/balances.d.mts.map +1 -1
  15. package/resources/credit-entitlements/balances.d.ts +3 -1
  16. package/resources/credit-entitlements/balances.d.ts.map +1 -1
  17. package/resources/discounts.d.mts +155 -6
  18. package/resources/discounts.d.mts.map +1 -1
  19. package/resources/discounts.d.ts +155 -6
  20. package/resources/discounts.d.ts.map +1 -1
  21. package/resources/discounts.js +1 -1
  22. package/resources/discounts.mjs +1 -1
  23. package/resources/index.d.mts +1 -1
  24. package/resources/index.d.mts.map +1 -1
  25. package/resources/index.d.ts +1 -1
  26. package/resources/index.d.ts.map +1 -1
  27. package/resources/index.js.map +1 -1
  28. package/resources/index.mjs.map +1 -1
  29. package/resources/payments.d.mts +60 -1
  30. package/resources/payments.d.mts.map +1 -1
  31. package/resources/payments.d.ts +60 -1
  32. package/resources/payments.d.ts.map +1 -1
  33. package/resources/products/products.d.mts +10 -0
  34. package/resources/products/products.d.mts.map +1 -1
  35. package/resources/products/products.d.ts +10 -0
  36. package/resources/products/products.d.ts.map +1 -1
  37. package/resources/products/products.js.map +1 -1
  38. package/resources/products/products.mjs.map +1 -1
  39. package/resources/subscriptions.d.mts +21 -0
  40. package/resources/subscriptions.d.mts.map +1 -1
  41. package/resources/subscriptions.d.ts +21 -0
  42. package/resources/subscriptions.d.ts.map +1 -1
  43. package/resources/webhook-events.d.mts +1 -1
  44. package/resources/webhook-events.d.mts.map +1 -1
  45. package/resources/webhook-events.d.ts +1 -1
  46. package/resources/webhook-events.d.ts.map +1 -1
  47. package/resources/webhooks/index.d.mts +1 -1
  48. package/resources/webhooks/index.d.mts.map +1 -1
  49. package/resources/webhooks/index.d.ts +1 -1
  50. package/resources/webhooks/index.d.ts.map +1 -1
  51. package/resources/webhooks/index.js.map +1 -1
  52. package/resources/webhooks/index.mjs.map +1 -1
  53. package/resources/webhooks/webhooks.d.mts +39 -3
  54. package/resources/webhooks/webhooks.d.mts.map +1 -1
  55. package/resources/webhooks/webhooks.d.ts +39 -3
  56. package/resources/webhooks/webhooks.d.ts.map +1 -1
  57. package/resources/webhooks/webhooks.js.map +1 -1
  58. package/resources/webhooks/webhooks.mjs.map +1 -1
  59. package/src/client.ts +2 -0
  60. package/src/resources/checkout-sessions.ts +27 -1
  61. package/src/resources/credit-entitlements/balances.ts +3 -1
  62. package/src/resources/discounts.ts +179 -6
  63. package/src/resources/index.ts +1 -0
  64. package/src/resources/payments.ts +242 -1
  65. package/src/resources/products/products.ts +12 -0
  66. package/src/resources/subscriptions.ts +25 -0
  67. package/src/resources/webhook-events.ts +1 -0
  68. package/src/resources/webhooks/index.ts +1 -0
  69. package/src/resources/webhooks/webhooks.ts +47 -0
  70. package/src/version.ts +1 -1
  71. package/version.d.mts +1 -1
  72. package/version.d.ts +1 -1
  73. package/version.js +1 -1
  74. package/version.mjs +1 -1
@@ -247,6 +247,12 @@ export interface Payment {
247
247
  */
248
248
  disputes: Array<DisputesAPI.Dispute>;
249
249
 
250
+ /**
251
+ * Whether this payment was created solely to update a subscription's payment
252
+ * method (a zero-/setup-amount charge). `false` for normal charges.
253
+ */
254
+ is_update_payment_method: boolean;
255
+
250
256
  /**
251
257
  * Additional custom data associated with the payment
252
258
  */
@@ -352,6 +358,15 @@ export interface Payment {
352
358
  */
353
359
  error_message?: string | null;
354
360
 
361
+ /**
362
+ * Purpose-built failure messaging for the merchant and the customer, derived from
363
+ * `error_code`. Present whenever `error_code` is set, regardless of payment
364
+ * status; unrecognised codes still resolve via a generic fallback rather than
365
+ * being omitted. The customer copy is always generic for fraud-sensitive declines
366
+ * (lost/stolen/pickup/fraudulent) so the true reason is never leaked.
367
+ */
368
+ failure_details?: Payment.FailureDetails | null;
369
+
355
370
  /**
356
371
  * Invoice ID for this payment. Uses India-specific invoice ID if available.
357
372
  */
@@ -372,6 +387,11 @@ export interface Payment {
372
387
  */
373
388
  payment_method?: string | null;
374
389
 
390
+ /**
391
+ * Identifier of the saved payment method used for this payment, if any.
392
+ */
393
+ payment_method_id?: string | null;
394
+
375
395
  /**
376
396
  * Specific type of payment method (e.g. "visa", "mastercard")
377
397
  */
@@ -418,6 +438,78 @@ export interface Payment {
418
438
  }
419
439
 
420
440
  export namespace Payment {
441
+ /**
442
+ * Purpose-built failure messaging for the merchant and the customer, derived from
443
+ * `error_code`. Present whenever `error_code` is set, regardless of payment
444
+ * status; unrecognised codes still resolve via a generic fallback rather than
445
+ * being omitted. The customer copy is always generic for fraud-sensitive declines
446
+ * (lost/stolen/pickup/fraudulent) so the true reason is never leaked.
447
+ */
448
+ export interface FailureDetails {
449
+ /**
450
+ * The unified error code (echoes `error_code`).
451
+ */
452
+ code: string;
453
+
454
+ /**
455
+ * The primary CTA to show the customer.
456
+ */
457
+ customer_cta:
458
+ | 'edit_and_retry'
459
+ | 'use_another_method'
460
+ | 'try_again'
461
+ | 'try_later'
462
+ | 'retry_and_verify'
463
+ | 'restart'
464
+ | 'update_method';
465
+
466
+ /**
467
+ * Whether the customer can resolve this themselves (e.g. fix CVC).
468
+ */
469
+ customer_fixable: boolean;
470
+
471
+ /**
472
+ * The customer-facing string. Always generic (`C11`) for the fraud-4.
473
+ */
474
+ customer_message: string;
475
+
476
+ /**
477
+ * The customer message template identifier (C1..C20).
478
+ */
479
+ customer_template:
480
+ | 'C1'
481
+ | 'C2'
482
+ | 'C3'
483
+ | 'C4'
484
+ | 'C5'
485
+ | 'C6'
486
+ | 'C7'
487
+ | 'C8'
488
+ | 'C9'
489
+ | 'C10'
490
+ | 'C11'
491
+ | 'C12'
492
+ | 'C13'
493
+ | 'C14'
494
+ | 'C15'
495
+ | 'C16'
496
+ | 'C17'
497
+ | 'C18'
498
+ | 'C19'
499
+ | 'C20';
500
+
501
+ /**
502
+ * Soft or hard decline.
503
+ */
504
+ decline_type: 'soft' | 'hard';
505
+
506
+ /**
507
+ * Merchant-facing headline + recommended action (Payment Details). For the fraud-4
508
+ * this includes the operator "do not reveal" warning.
509
+ */
510
+ merchant_message: string;
511
+ }
512
+
421
513
  export interface ProductCart {
422
514
  product_id: string;
423
515
 
@@ -508,7 +600,6 @@ export type PaymentMethodTypes =
508
600
  | 'sepa'
509
601
  | 'sepa_bank_transfer'
510
602
  | 'sofort'
511
- | 'sunbit'
512
603
  | 'swish'
513
604
  | 'touch_n_go'
514
605
  | 'trustly'
@@ -747,6 +838,156 @@ export interface PaymentListParams extends DefaultPageNumberPaginationParams {
747
838
  */
748
839
  created_at_lte?: string;
749
840
 
841
+ /**
842
+ * Filter by currency
843
+ */
844
+ currency?:
845
+ | 'AED'
846
+ | 'ALL'
847
+ | 'AMD'
848
+ | 'ANG'
849
+ | 'AOA'
850
+ | 'ARS'
851
+ | 'AUD'
852
+ | 'AWG'
853
+ | 'AZN'
854
+ | 'BAM'
855
+ | 'BBD'
856
+ | 'BDT'
857
+ | 'BGN'
858
+ | 'BHD'
859
+ | 'BIF'
860
+ | 'BMD'
861
+ | 'BND'
862
+ | 'BOB'
863
+ | 'BRL'
864
+ | 'BSD'
865
+ | 'BWP'
866
+ | 'BYN'
867
+ | 'BZD'
868
+ | 'CAD'
869
+ | 'CHF'
870
+ | 'CLP'
871
+ | 'CNY'
872
+ | 'COP'
873
+ | 'CRC'
874
+ | 'CUP'
875
+ | 'CVE'
876
+ | 'CZK'
877
+ | 'DJF'
878
+ | 'DKK'
879
+ | 'DOP'
880
+ | 'DZD'
881
+ | 'EGP'
882
+ | 'ETB'
883
+ | 'EUR'
884
+ | 'FJD'
885
+ | 'FKP'
886
+ | 'GBP'
887
+ | 'GEL'
888
+ | 'GHS'
889
+ | 'GIP'
890
+ | 'GMD'
891
+ | 'GNF'
892
+ | 'GTQ'
893
+ | 'GYD'
894
+ | 'HKD'
895
+ | 'HNL'
896
+ | 'HRK'
897
+ | 'HTG'
898
+ | 'HUF'
899
+ | 'IDR'
900
+ | 'ILS'
901
+ | 'INR'
902
+ | 'IQD'
903
+ | 'JMD'
904
+ | 'JOD'
905
+ | 'JPY'
906
+ | 'KES'
907
+ | 'KGS'
908
+ | 'KHR'
909
+ | 'KMF'
910
+ | 'KRW'
911
+ | 'KWD'
912
+ | 'KYD'
913
+ | 'KZT'
914
+ | 'LAK'
915
+ | 'LBP'
916
+ | 'LKR'
917
+ | 'LRD'
918
+ | 'LSL'
919
+ | 'LYD'
920
+ | 'MAD'
921
+ | 'MDL'
922
+ | 'MGA'
923
+ | 'MKD'
924
+ | 'MMK'
925
+ | 'MNT'
926
+ | 'MOP'
927
+ | 'MRU'
928
+ | 'MUR'
929
+ | 'MVR'
930
+ | 'MWK'
931
+ | 'MXN'
932
+ | 'MYR'
933
+ | 'MZN'
934
+ | 'NAD'
935
+ | 'NGN'
936
+ | 'NIO'
937
+ | 'NOK'
938
+ | 'NPR'
939
+ | 'NZD'
940
+ | 'OMR'
941
+ | 'PAB'
942
+ | 'PEN'
943
+ | 'PGK'
944
+ | 'PHP'
945
+ | 'PKR'
946
+ | 'PLN'
947
+ | 'PYG'
948
+ | 'QAR'
949
+ | 'RON'
950
+ | 'RSD'
951
+ | 'RUB'
952
+ | 'RWF'
953
+ | 'SAR'
954
+ | 'SBD'
955
+ | 'SCR'
956
+ | 'SEK'
957
+ | 'SGD'
958
+ | 'SHP'
959
+ | 'SLE'
960
+ | 'SLL'
961
+ | 'SOS'
962
+ | 'SRD'
963
+ | 'SSP'
964
+ | 'STN'
965
+ | 'SVC'
966
+ | 'SZL'
967
+ | 'THB'
968
+ | 'TND'
969
+ | 'TOP'
970
+ | 'TRY'
971
+ | 'TTD'
972
+ | 'TWD'
973
+ | 'TZS'
974
+ | 'UAH'
975
+ | 'UGX'
976
+ | 'USD'
977
+ | 'UYU'
978
+ | 'UZS'
979
+ | 'VES'
980
+ | 'VND'
981
+ | 'VUV'
982
+ | 'WST'
983
+ | 'XAF'
984
+ | 'XCD'
985
+ | 'XOF'
986
+ | 'XPF'
987
+ | 'YER'
988
+ | 'ZAR'
989
+ | 'ZMW';
990
+
750
991
  /**
751
992
  * Filter by customer id
752
993
  */
@@ -583,6 +583,18 @@ export namespace Price {
583
583
  */
584
584
  tax_inclusive?: boolean | null;
585
585
 
586
+ /**
587
+ * Amount charged today for a paid trial, in the price currency's minor units.
588
+ * Requires `trial_period_days > 0`. Omit or null for a free trial (the default).
589
+ */
590
+ trial_amount?: number | null;
591
+
592
+ /**
593
+ * Whether discount codes reduce the trial charge. Defaults to false. Only
594
+ * meaningful when a paid trial is configured.
595
+ */
596
+ trial_apply_discounts?: boolean | null;
597
+
586
598
  /**
587
599
  * Number of days for the trial period. A value of `0` indicates no trial period.
588
600
  */
@@ -677,6 +677,13 @@ export interface Subscription {
677
677
  * Tax identifier provided for this subscription (if applicable)
678
678
  */
679
679
  tax_id?: string | null;
680
+
681
+ /**
682
+ * Per-unit trial amount after discounts, snapshotted at subscription creation
683
+ * (price currency minor units, pre-quantity, pre-tax). Null for a free trial or no
684
+ * trial.
685
+ */
686
+ trial_amount?: number | null;
680
687
  }
681
688
 
682
689
  export type SubscriptionStatus = 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired';
@@ -819,6 +826,12 @@ export interface SubscriptionCreateResponse {
819
826
  * URL to checkout page
820
827
  */
821
828
  payment_link?: string | null;
829
+
830
+ /**
831
+ * Per-unit trial amount after discounts, in the price currency's minor units
832
+ * (pre-quantity, pre-tax). Null for a free trial or no trial.
833
+ */
834
+ trial_amount?: number | null;
822
835
  }
823
836
 
824
837
  export namespace SubscriptionCreateResponse {
@@ -980,6 +993,13 @@ export interface SubscriptionListResponse {
980
993
  * Tax identifier provided for this subscription (if applicable)
981
994
  */
982
995
  tax_id?: string | null;
996
+
997
+ /**
998
+ * Per-unit trial amount after discounts, snapshotted at subscription creation
999
+ * (price currency minor units, pre-quantity, pre-tax). Null for a free trial or no
1000
+ * trial.
1001
+ */
1002
+ trial_amount?: number | null;
983
1003
  }
984
1004
 
985
1005
  export namespace SubscriptionListResponse {
@@ -1272,6 +1292,11 @@ export interface SubscriptionListParams extends DefaultPageNumberPaginationParam
1272
1292
  */
1273
1293
  brand_id?: string;
1274
1294
 
1295
+ /**
1296
+ * Filter by cancel_at_next_billing_date (subscriptions scheduled for cancellation)
1297
+ */
1298
+ cancel_at_next_billing_date?: boolean;
1299
+
1275
1300
  /**
1276
1301
  * Get events after this created time
1277
1302
  */
@@ -37,6 +37,7 @@ export type WebhookEventType =
37
37
  | 'subscription.expired'
38
38
  | 'subscription.plan_changed'
39
39
  | 'subscription.updated'
40
+ | 'subscription.update_payment_method'
40
41
  | 'license_key.created'
41
42
  | 'payout.not_initiated'
42
43
  | 'payout.on_hold'
@@ -43,6 +43,7 @@ export {
43
43
  type SubscriptionOnHoldWebhookEvent,
44
44
  type SubscriptionPlanChangedWebhookEvent,
45
45
  type SubscriptionRenewedWebhookEvent,
46
+ type SubscriptionUpdatePaymentMethodWebhookEvent,
46
47
  type SubscriptionUpdatedWebhookEvent,
47
48
  type UnsafeUnwrapWebhookEvent,
48
49
  type UnwrapWebhookEvent,
@@ -1111,6 +1111,28 @@ export interface SubscriptionRenewedWebhookEvent {
1111
1111
  type: 'subscription.renewed';
1112
1112
  }
1113
1113
 
1114
+ export interface SubscriptionUpdatePaymentMethodWebhookEvent {
1115
+ /**
1116
+ * The business identifier
1117
+ */
1118
+ business_id: string;
1119
+
1120
+ /**
1121
+ * Response struct representing subscription details
1122
+ */
1123
+ data: SubscriptionsAPI.Subscription;
1124
+
1125
+ /**
1126
+ * The timestamp of when the event occurred
1127
+ */
1128
+ timestamp: string;
1129
+
1130
+ /**
1131
+ * The event type
1132
+ */
1133
+ type: 'subscription.update_payment_method';
1134
+ }
1135
+
1114
1136
  export interface SubscriptionUpdatedWebhookEvent {
1115
1137
  /**
1116
1138
  * The business identifier
@@ -2059,6 +2081,28 @@ export interface SubscriptionRenewedWebhookEvent {
2059
2081
  type: 'subscription.renewed';
2060
2082
  }
2061
2083
 
2084
+ export interface SubscriptionUpdatePaymentMethodWebhookEvent {
2085
+ /**
2086
+ * The business identifier
2087
+ */
2088
+ business_id: string;
2089
+
2090
+ /**
2091
+ * Response struct representing subscription details
2092
+ */
2093
+ data: SubscriptionsAPI.Subscription;
2094
+
2095
+ /**
2096
+ * The timestamp of when the event occurred
2097
+ */
2098
+ timestamp: string;
2099
+
2100
+ /**
2101
+ * The event type
2102
+ */
2103
+ type: 'subscription.update_payment_method';
2104
+ }
2105
+
2062
2106
  export interface SubscriptionUpdatedWebhookEvent {
2063
2107
  /**
2064
2108
  * The business identifier
@@ -2120,6 +2164,7 @@ export type UnsafeUnwrapWebhookEvent =
2120
2164
  | SubscriptionOnHoldWebhookEvent
2121
2165
  | SubscriptionPlanChangedWebhookEvent
2122
2166
  | SubscriptionRenewedWebhookEvent
2167
+ | SubscriptionUpdatePaymentMethodWebhookEvent
2123
2168
  | SubscriptionUpdatedWebhookEvent;
2124
2169
 
2125
2170
  export type UnwrapWebhookEvent =
@@ -2161,6 +2206,7 @@ export type UnwrapWebhookEvent =
2161
2206
  | SubscriptionOnHoldWebhookEvent
2162
2207
  | SubscriptionPlanChangedWebhookEvent
2163
2208
  | SubscriptionRenewedWebhookEvent
2209
+ | SubscriptionUpdatePaymentMethodWebhookEvent
2164
2210
  | SubscriptionUpdatedWebhookEvent;
2165
2211
 
2166
2212
  export interface WebhookListParams extends CursorPagePaginationParams {}
@@ -2283,6 +2329,7 @@ export declare namespace Webhooks {
2283
2329
  type SubscriptionOnHoldWebhookEvent as SubscriptionOnHoldWebhookEvent,
2284
2330
  type SubscriptionPlanChangedWebhookEvent as SubscriptionPlanChangedWebhookEvent,
2285
2331
  type SubscriptionRenewedWebhookEvent as SubscriptionRenewedWebhookEvent,
2332
+ type SubscriptionUpdatePaymentMethodWebhookEvent as SubscriptionUpdatePaymentMethodWebhookEvent,
2286
2333
  type SubscriptionUpdatedWebhookEvent as SubscriptionUpdatedWebhookEvent,
2287
2334
  type UnsafeUnwrapWebhookEvent as UnsafeUnwrapWebhookEvent,
2288
2335
  type UnwrapWebhookEvent as UnwrapWebhookEvent,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '2.42.1'; // x-release-please-version
1
+ export const VERSION = '2.43.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.42.1";
1
+ export declare const VERSION = "2.43.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.42.1";
1
+ export declare const VERSION = "2.43.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.42.1'; // x-release-please-version
4
+ exports.VERSION = '2.43.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.42.1'; // x-release-please-version
1
+ export const VERSION = '2.43.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map