orb-billing 4.53.0 → 4.55.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 (43) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/core.d.ts.map +1 -1
  3. package/core.js +12 -6
  4. package/core.js.map +1 -1
  5. package/core.mjs +12 -6
  6. package/core.mjs.map +1 -1
  7. package/package.json +1 -1
  8. package/resources/customers/credits/ledger.d.ts +2 -2
  9. package/resources/customers/credits/ledger.d.ts.map +1 -1
  10. package/resources/events/backfills.d.ts +30 -0
  11. package/resources/events/backfills.d.ts.map +1 -1
  12. package/resources/events/backfills.js.map +1 -1
  13. package/resources/events/backfills.mjs.map +1 -1
  14. package/resources/invoice-line-items.d.ts +175 -2
  15. package/resources/invoice-line-items.d.ts.map +1 -1
  16. package/resources/invoices.d.ts +350 -4
  17. package/resources/invoices.d.ts.map +1 -1
  18. package/resources/invoices.js.map +1 -1
  19. package/resources/invoices.mjs.map +1 -1
  20. package/resources/plans/plans.d.ts +213 -25
  21. package/resources/plans/plans.d.ts.map +1 -1
  22. package/resources/plans/plans.js.map +1 -1
  23. package/resources/plans/plans.mjs.map +1 -1
  24. package/resources/prices/prices.d.ts +530 -61
  25. package/resources/prices/prices.d.ts.map +1 -1
  26. package/resources/prices/prices.js.map +1 -1
  27. package/resources/prices/prices.mjs.map +1 -1
  28. package/resources/subscriptions.d.ts +453 -269
  29. package/resources/subscriptions.d.ts.map +1 -1
  30. package/resources/subscriptions.js.map +1 -1
  31. package/resources/subscriptions.mjs.map +1 -1
  32. package/src/core.ts +14 -6
  33. package/src/resources/customers/credits/ledger.ts +2 -2
  34. package/src/resources/events/backfills.ts +35 -0
  35. package/src/resources/invoice-line-items.ts +221 -2
  36. package/src/resources/invoices.ts +442 -4
  37. package/src/resources/plans/plans.ts +259 -31
  38. package/src/resources/prices/prices.ts +752 -88
  39. package/src/resources/subscriptions.ts +569 -345
  40. package/src/version.ts +1 -1
  41. package/version.d.ts +1 -1
  42. package/version.js +1 -1
  43. package/version.mjs +1 -1
@@ -847,10 +847,33 @@ export namespace Invoice {
847
847
  id: string;
848
848
 
849
849
  /**
850
- * The final amount after any discounts or minimums.
850
+ * The line amount after any adjustments and before overage conversion, credits and
851
+ * partial invoicing.
852
+ */
853
+ adjusted_subtotal: string;
854
+
855
+ /**
856
+ * All adjustments (ie. maximums, minimums, discounts) applied to the line item.
857
+ */
858
+ adjustments: Array<
859
+ | LineItem.MonetaryUsageDiscountAdjustment
860
+ | LineItem.MonetaryAmountDiscountAdjustment
861
+ | LineItem.MonetaryPercentageDiscountAdjustment
862
+ | LineItem.MonetaryMinimumAdjustment
863
+ | LineItem.MonetaryMaximumAdjustment
864
+ >;
865
+
866
+ /**
867
+ * The final amount for a line item after all adjustments and pre paid credits have
868
+ * been applied.
851
869
  */
852
870
  amount: string;
853
871
 
872
+ /**
873
+ * The number of prepaid credits applied.
874
+ */
875
+ credits_applied: string;
876
+
854
877
  discount: Shared.Discount | null;
855
878
 
856
879
  /**
@@ -865,12 +888,24 @@ export namespace Invoice {
865
888
  */
866
889
  grouping: string | null;
867
890
 
891
+ /**
892
+ * @deprecated This field is deprecated in favor of `adjustments`.
893
+ */
868
894
  maximum: LineItem.Maximum | null;
869
895
 
896
+ /**
897
+ * @deprecated This field is deprecated in favor of `adjustments`.
898
+ */
870
899
  maximum_amount: string | null;
871
900
 
901
+ /**
902
+ * @deprecated This field is deprecated in favor of `adjustments`.
903
+ */
872
904
  minimum: LineItem.Minimum | null;
873
905
 
906
+ /**
907
+ * @deprecated This field is deprecated in favor of `adjustments`.
908
+ */
874
909
  minimum_amount: string | null;
875
910
 
876
911
  /**
@@ -878,6 +913,11 @@ export namespace Invoice {
878
913
  */
879
914
  name: string;
880
915
 
916
+ /**
917
+ * Any amount applied from a partial invoice
918
+ */
919
+ partially_invoiced_amount: string;
920
+
881
921
  /**
882
922
  * The Price resource represents a price that can be billed on a subscription,
883
923
  * resulting in a charge on an invoice in the form of an invoice line item. Prices
@@ -892,6 +932,9 @@ export namespace Invoice {
892
932
  */
893
933
  price: PricesAPI.Price | null;
894
934
 
935
+ /**
936
+ * Either the fixed fee quantity or the usage during the service period.
937
+ */
895
938
  quantity: number;
896
939
 
897
940
  /**
@@ -906,7 +949,7 @@ export namespace Invoice {
906
949
  sub_line_items: Array<LineItem.MatrixSubLineItem | LineItem.TierSubLineItem | LineItem.OtherSubLineItem>;
907
950
 
908
951
  /**
909
- * The line amount before any line item-specific discounts or minimums.
952
+ * The line amount before before any adjustments.
910
953
  */
911
954
  subtotal: string;
912
955
 
@@ -918,6 +961,179 @@ export namespace Invoice {
918
961
  }
919
962
 
920
963
  export namespace LineItem {
964
+ export interface MonetaryUsageDiscountAdjustment {
965
+ id: string;
966
+
967
+ adjustment_type: 'usage_discount';
968
+
969
+ /**
970
+ * The value applied by an adjustment.
971
+ */
972
+ amount: string;
973
+
974
+ /**
975
+ * The price IDs that this adjustment applies to.
976
+ */
977
+ applies_to_price_ids: Array<string>;
978
+
979
+ /**
980
+ * True for adjustments that apply to an entire invocice, false for adjustments
981
+ * that apply to only one price.
982
+ */
983
+ is_invoice_level: boolean;
984
+
985
+ /**
986
+ * The reason for the adjustment.
987
+ */
988
+ reason: string | null;
989
+
990
+ /**
991
+ * The number of usage units by which to discount the price this adjustment applies
992
+ * to in a given billing period.
993
+ */
994
+ usage_discount: number;
995
+ }
996
+
997
+ export interface MonetaryAmountDiscountAdjustment {
998
+ id: string;
999
+
1000
+ adjustment_type: 'amount_discount';
1001
+
1002
+ /**
1003
+ * The value applied by an adjustment.
1004
+ */
1005
+ amount: string;
1006
+
1007
+ /**
1008
+ * The amount by which to discount the prices this adjustment applies to in a given
1009
+ * billing period.
1010
+ */
1011
+ amount_discount: string;
1012
+
1013
+ /**
1014
+ * The price IDs that this adjustment applies to.
1015
+ */
1016
+ applies_to_price_ids: Array<string>;
1017
+
1018
+ /**
1019
+ * True for adjustments that apply to an entire invocice, false for adjustments
1020
+ * that apply to only one price.
1021
+ */
1022
+ is_invoice_level: boolean;
1023
+
1024
+ /**
1025
+ * The reason for the adjustment.
1026
+ */
1027
+ reason: string | null;
1028
+ }
1029
+
1030
+ export interface MonetaryPercentageDiscountAdjustment {
1031
+ id: string;
1032
+
1033
+ adjustment_type: 'percentage_discount';
1034
+
1035
+ /**
1036
+ * The value applied by an adjustment.
1037
+ */
1038
+ amount: string;
1039
+
1040
+ /**
1041
+ * The price IDs that this adjustment applies to.
1042
+ */
1043
+ applies_to_price_ids: Array<string>;
1044
+
1045
+ /**
1046
+ * True for adjustments that apply to an entire invocice, false for adjustments
1047
+ * that apply to only one price.
1048
+ */
1049
+ is_invoice_level: boolean;
1050
+
1051
+ /**
1052
+ * The percentage (as a value between 0 and 1) by which to discount the price
1053
+ * intervals this adjustment applies to in a given billing period.
1054
+ */
1055
+ percentage_discount: number;
1056
+
1057
+ /**
1058
+ * The reason for the adjustment.
1059
+ */
1060
+ reason: string | null;
1061
+ }
1062
+
1063
+ export interface MonetaryMinimumAdjustment {
1064
+ id: string;
1065
+
1066
+ adjustment_type: 'minimum';
1067
+
1068
+ /**
1069
+ * The value applied by an adjustment.
1070
+ */
1071
+ amount: string;
1072
+
1073
+ /**
1074
+ * The price IDs that this adjustment applies to.
1075
+ */
1076
+ applies_to_price_ids: Array<string>;
1077
+
1078
+ /**
1079
+ * True for adjustments that apply to an entire invocice, false for adjustments
1080
+ * that apply to only one price.
1081
+ */
1082
+ is_invoice_level: boolean;
1083
+
1084
+ /**
1085
+ * The item ID that revenue from this minimum will be attributed to.
1086
+ */
1087
+ item_id: string;
1088
+
1089
+ /**
1090
+ * The minimum amount to charge in a given billing period for the prices this
1091
+ * adjustment applies to.
1092
+ */
1093
+ minimum_amount: string;
1094
+
1095
+ /**
1096
+ * The reason for the adjustment.
1097
+ */
1098
+ reason: string | null;
1099
+ }
1100
+
1101
+ export interface MonetaryMaximumAdjustment {
1102
+ id: string;
1103
+
1104
+ adjustment_type: 'maximum';
1105
+
1106
+ /**
1107
+ * The value applied by an adjustment.
1108
+ */
1109
+ amount: string;
1110
+
1111
+ /**
1112
+ * The price IDs that this adjustment applies to.
1113
+ */
1114
+ applies_to_price_ids: Array<string>;
1115
+
1116
+ /**
1117
+ * True for adjustments that apply to an entire invocice, false for adjustments
1118
+ * that apply to only one price.
1119
+ */
1120
+ is_invoice_level: boolean;
1121
+
1122
+ /**
1123
+ * The maximum amount to charge in a given billing period for the prices this
1124
+ * adjustment applies to.
1125
+ */
1126
+ maximum_amount: string;
1127
+
1128
+ /**
1129
+ * The reason for the adjustment.
1130
+ */
1131
+ reason: string | null;
1132
+ }
1133
+
1134
+ /**
1135
+ * @deprecated This field is deprecated in favor of `adjustments`.
1136
+ */
921
1137
  export interface Maximum {
922
1138
  /**
923
1139
  * List of price_ids that this maximum amount applies to. For plan/plan phase
@@ -931,6 +1147,9 @@ export namespace Invoice {
931
1147
  maximum_amount: string;
932
1148
  }
933
1149
 
1150
+ /**
1151
+ * @deprecated This field is deprecated in favor of `adjustments`.
1152
+ */
934
1153
  export interface Minimum {
935
1154
  /**
936
1155
  * List of price_ids that this minimum amount applies to. For plan/plan phase
@@ -1838,10 +2057,33 @@ export namespace InvoiceFetchUpcomingResponse {
1838
2057
  id: string;
1839
2058
 
1840
2059
  /**
1841
- * The final amount after any discounts or minimums.
2060
+ * The line amount after any adjustments and before overage conversion, credits and
2061
+ * partial invoicing.
2062
+ */
2063
+ adjusted_subtotal: string;
2064
+
2065
+ /**
2066
+ * All adjustments (ie. maximums, minimums, discounts) applied to the line item.
2067
+ */
2068
+ adjustments: Array<
2069
+ | LineItem.MonetaryUsageDiscountAdjustment
2070
+ | LineItem.MonetaryAmountDiscountAdjustment
2071
+ | LineItem.MonetaryPercentageDiscountAdjustment
2072
+ | LineItem.MonetaryMinimumAdjustment
2073
+ | LineItem.MonetaryMaximumAdjustment
2074
+ >;
2075
+
2076
+ /**
2077
+ * The final amount for a line item after all adjustments and pre paid credits have
2078
+ * been applied.
1842
2079
  */
1843
2080
  amount: string;
1844
2081
 
2082
+ /**
2083
+ * The number of prepaid credits applied.
2084
+ */
2085
+ credits_applied: string;
2086
+
1845
2087
  discount: Shared.Discount | null;
1846
2088
 
1847
2089
  /**
@@ -1856,12 +2098,24 @@ export namespace InvoiceFetchUpcomingResponse {
1856
2098
  */
1857
2099
  grouping: string | null;
1858
2100
 
2101
+ /**
2102
+ * @deprecated This field is deprecated in favor of `adjustments`.
2103
+ */
1859
2104
  maximum: LineItem.Maximum | null;
1860
2105
 
2106
+ /**
2107
+ * @deprecated This field is deprecated in favor of `adjustments`.
2108
+ */
1861
2109
  maximum_amount: string | null;
1862
2110
 
2111
+ /**
2112
+ * @deprecated This field is deprecated in favor of `adjustments`.
2113
+ */
1863
2114
  minimum: LineItem.Minimum | null;
1864
2115
 
2116
+ /**
2117
+ * @deprecated This field is deprecated in favor of `adjustments`.
2118
+ */
1865
2119
  minimum_amount: string | null;
1866
2120
 
1867
2121
  /**
@@ -1869,6 +2123,11 @@ export namespace InvoiceFetchUpcomingResponse {
1869
2123
  */
1870
2124
  name: string;
1871
2125
 
2126
+ /**
2127
+ * Any amount applied from a partial invoice
2128
+ */
2129
+ partially_invoiced_amount: string;
2130
+
1872
2131
  /**
1873
2132
  * The Price resource represents a price that can be billed on a subscription,
1874
2133
  * resulting in a charge on an invoice in the form of an invoice line item. Prices
@@ -1883,6 +2142,9 @@ export namespace InvoiceFetchUpcomingResponse {
1883
2142
  */
1884
2143
  price: PricesAPI.Price | null;
1885
2144
 
2145
+ /**
2146
+ * Either the fixed fee quantity or the usage during the service period.
2147
+ */
1886
2148
  quantity: number;
1887
2149
 
1888
2150
  /**
@@ -1897,7 +2159,7 @@ export namespace InvoiceFetchUpcomingResponse {
1897
2159
  sub_line_items: Array<LineItem.MatrixSubLineItem | LineItem.TierSubLineItem | LineItem.OtherSubLineItem>;
1898
2160
 
1899
2161
  /**
1900
- * The line amount before any line item-specific discounts or minimums.
2162
+ * The line amount before before any adjustments.
1901
2163
  */
1902
2164
  subtotal: string;
1903
2165
 
@@ -1909,6 +2171,179 @@ export namespace InvoiceFetchUpcomingResponse {
1909
2171
  }
1910
2172
 
1911
2173
  export namespace LineItem {
2174
+ export interface MonetaryUsageDiscountAdjustment {
2175
+ id: string;
2176
+
2177
+ adjustment_type: 'usage_discount';
2178
+
2179
+ /**
2180
+ * The value applied by an adjustment.
2181
+ */
2182
+ amount: string;
2183
+
2184
+ /**
2185
+ * The price IDs that this adjustment applies to.
2186
+ */
2187
+ applies_to_price_ids: Array<string>;
2188
+
2189
+ /**
2190
+ * True for adjustments that apply to an entire invocice, false for adjustments
2191
+ * that apply to only one price.
2192
+ */
2193
+ is_invoice_level: boolean;
2194
+
2195
+ /**
2196
+ * The reason for the adjustment.
2197
+ */
2198
+ reason: string | null;
2199
+
2200
+ /**
2201
+ * The number of usage units by which to discount the price this adjustment applies
2202
+ * to in a given billing period.
2203
+ */
2204
+ usage_discount: number;
2205
+ }
2206
+
2207
+ export interface MonetaryAmountDiscountAdjustment {
2208
+ id: string;
2209
+
2210
+ adjustment_type: 'amount_discount';
2211
+
2212
+ /**
2213
+ * The value applied by an adjustment.
2214
+ */
2215
+ amount: string;
2216
+
2217
+ /**
2218
+ * The amount by which to discount the prices this adjustment applies to in a given
2219
+ * billing period.
2220
+ */
2221
+ amount_discount: string;
2222
+
2223
+ /**
2224
+ * The price IDs that this adjustment applies to.
2225
+ */
2226
+ applies_to_price_ids: Array<string>;
2227
+
2228
+ /**
2229
+ * True for adjustments that apply to an entire invocice, false for adjustments
2230
+ * that apply to only one price.
2231
+ */
2232
+ is_invoice_level: boolean;
2233
+
2234
+ /**
2235
+ * The reason for the adjustment.
2236
+ */
2237
+ reason: string | null;
2238
+ }
2239
+
2240
+ export interface MonetaryPercentageDiscountAdjustment {
2241
+ id: string;
2242
+
2243
+ adjustment_type: 'percentage_discount';
2244
+
2245
+ /**
2246
+ * The value applied by an adjustment.
2247
+ */
2248
+ amount: string;
2249
+
2250
+ /**
2251
+ * The price IDs that this adjustment applies to.
2252
+ */
2253
+ applies_to_price_ids: Array<string>;
2254
+
2255
+ /**
2256
+ * True for adjustments that apply to an entire invocice, false for adjustments
2257
+ * that apply to only one price.
2258
+ */
2259
+ is_invoice_level: boolean;
2260
+
2261
+ /**
2262
+ * The percentage (as a value between 0 and 1) by which to discount the price
2263
+ * intervals this adjustment applies to in a given billing period.
2264
+ */
2265
+ percentage_discount: number;
2266
+
2267
+ /**
2268
+ * The reason for the adjustment.
2269
+ */
2270
+ reason: string | null;
2271
+ }
2272
+
2273
+ export interface MonetaryMinimumAdjustment {
2274
+ id: string;
2275
+
2276
+ adjustment_type: 'minimum';
2277
+
2278
+ /**
2279
+ * The value applied by an adjustment.
2280
+ */
2281
+ amount: string;
2282
+
2283
+ /**
2284
+ * The price IDs that this adjustment applies to.
2285
+ */
2286
+ applies_to_price_ids: Array<string>;
2287
+
2288
+ /**
2289
+ * True for adjustments that apply to an entire invocice, false for adjustments
2290
+ * that apply to only one price.
2291
+ */
2292
+ is_invoice_level: boolean;
2293
+
2294
+ /**
2295
+ * The item ID that revenue from this minimum will be attributed to.
2296
+ */
2297
+ item_id: string;
2298
+
2299
+ /**
2300
+ * The minimum amount to charge in a given billing period for the prices this
2301
+ * adjustment applies to.
2302
+ */
2303
+ minimum_amount: string;
2304
+
2305
+ /**
2306
+ * The reason for the adjustment.
2307
+ */
2308
+ reason: string | null;
2309
+ }
2310
+
2311
+ export interface MonetaryMaximumAdjustment {
2312
+ id: string;
2313
+
2314
+ adjustment_type: 'maximum';
2315
+
2316
+ /**
2317
+ * The value applied by an adjustment.
2318
+ */
2319
+ amount: string;
2320
+
2321
+ /**
2322
+ * The price IDs that this adjustment applies to.
2323
+ */
2324
+ applies_to_price_ids: Array<string>;
2325
+
2326
+ /**
2327
+ * True for adjustments that apply to an entire invocice, false for adjustments
2328
+ * that apply to only one price.
2329
+ */
2330
+ is_invoice_level: boolean;
2331
+
2332
+ /**
2333
+ * The maximum amount to charge in a given billing period for the prices this
2334
+ * adjustment applies to.
2335
+ */
2336
+ maximum_amount: string;
2337
+
2338
+ /**
2339
+ * The reason for the adjustment.
2340
+ */
2341
+ reason: string | null;
2342
+ }
2343
+
2344
+ /**
2345
+ * @deprecated This field is deprecated in favor of `adjustments`.
2346
+ */
1912
2347
  export interface Maximum {
1913
2348
  /**
1914
2349
  * List of price_ids that this maximum amount applies to. For plan/plan phase
@@ -1922,6 +2357,9 @@ export namespace InvoiceFetchUpcomingResponse {
1922
2357
  maximum_amount: string;
1923
2358
  }
1924
2359
 
2360
+ /**
2361
+ * @deprecated This field is deprecated in favor of `adjustments`.
2362
+ */
1925
2363
  export interface Minimum {
1926
2364
  /**
1927
2365
  * List of price_ids that this minimum amount applies to. For plan/plan phase