stripe 16.13.0-beta.1 → 17.0.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 (220) hide show
  1. package/CHANGELOG.md +154 -849
  2. package/README.md +4 -3
  3. package/VERSION +1 -1
  4. package/cjs/Error.js +31 -4
  5. package/cjs/RequestSender.js +114 -74
  6. package/cjs/StripeResource.js +8 -3
  7. package/cjs/apiVersion.js +2 -3
  8. package/cjs/autoPagination.js +51 -7
  9. package/cjs/crypto/CryptoProvider.js +6 -0
  10. package/cjs/crypto/NodeCryptoProvider.js +7 -0
  11. package/cjs/crypto/SubtleCryptoProvider.js +4 -0
  12. package/cjs/resources/{Capital/FinancingSummary.js → Billing/CreditBalanceSummary.js} +3 -3
  13. package/cjs/resources/{FinancialConnections/Institutions.js → Billing/CreditBalanceTransactions.js} +4 -4
  14. package/cjs/resources/Billing/CreditGrants.js +30 -0
  15. package/cjs/resources/FinancialConnections/Accounts.js +0 -5
  16. package/cjs/resources/Invoices.js +0 -17
  17. package/cjs/resources/PaymentIntents.js +0 -4
  18. package/cjs/resources/Quotes.js +0 -32
  19. package/cjs/resources/SubscriptionSchedules.js +0 -4
  20. package/cjs/resources/Terminal/Readers.js +0 -12
  21. package/cjs/resources/V2/Billing/MeterEventAdjustments.js +12 -0
  22. package/cjs/resources/V2/Billing/MeterEventSession.js +12 -0
  23. package/cjs/resources/V2/Billing/MeterEventStream.js +13 -0
  24. package/cjs/resources/V2/Billing/MeterEvents.js +9 -0
  25. package/cjs/resources/V2/Billing.js +18 -0
  26. package/cjs/resources/V2/Core/Events.js +14 -0
  27. package/cjs/resources/V2/Core.js +12 -0
  28. package/cjs/resources/V2.js +14 -0
  29. package/cjs/resources.js +18 -42
  30. package/cjs/stripe.core.js +20 -8
  31. package/cjs/utils.js +41 -10
  32. package/esm/Error.js +27 -2
  33. package/esm/RequestSender.js +115 -75
  34. package/esm/StripeResource.js +9 -4
  35. package/esm/apiVersion.js +1 -2
  36. package/esm/autoPagination.js +52 -8
  37. package/esm/crypto/CryptoProvider.js +6 -0
  38. package/esm/crypto/NodeCryptoProvider.js +7 -0
  39. package/esm/crypto/SubtleCryptoProvider.js +4 -0
  40. package/esm/resources/{Capital/FinancingSummary.js → Billing/CreditBalanceSummary.js} +2 -2
  41. package/esm/resources/{FinancialConnections/Institutions.js → Billing/CreditBalanceTransactions.js} +3 -3
  42. package/esm/resources/Billing/CreditGrants.js +27 -0
  43. package/esm/resources/FinancialConnections/Accounts.js +0 -5
  44. package/esm/resources/Invoices.js +0 -17
  45. package/esm/resources/PaymentIntents.js +0 -4
  46. package/esm/resources/Quotes.js +0 -32
  47. package/esm/resources/SubscriptionSchedules.js +0 -4
  48. package/esm/resources/Terminal/Readers.js +0 -12
  49. package/esm/resources/V2/Billing/MeterEventAdjustments.js +9 -0
  50. package/esm/resources/V2/Billing/MeterEventSession.js +9 -0
  51. package/esm/resources/V2/Billing/MeterEventStream.js +10 -0
  52. package/esm/resources/V2/Billing/MeterEvents.js +6 -0
  53. package/esm/resources/V2/Billing.js +15 -0
  54. package/esm/resources/V2/Core/Events.js +11 -0
  55. package/esm/resources/V2/Core.js +9 -0
  56. package/esm/resources/V2.js +11 -0
  57. package/esm/resources.js +7 -29
  58. package/esm/stripe.core.js +21 -9
  59. package/esm/utils.js +38 -9
  60. package/package.json +1 -1
  61. package/types/AccountLinksResource.d.ts +1 -5
  62. package/types/AccountSessions.d.ts +0 -45
  63. package/types/AccountSessionsResource.d.ts +0 -288
  64. package/types/Accounts.d.ts +1 -113
  65. package/types/AccountsResource.d.ts +0 -270
  66. package/types/Billing/Alerts.d.ts +17 -13
  67. package/types/Billing/AlertsResource.d.ts +18 -21
  68. package/types/Billing/CreditBalanceSummary.d.ts +94 -0
  69. package/types/Billing/CreditBalanceSummaryResource.d.ts +64 -0
  70. package/types/Billing/CreditBalanceTransactions.d.ts +159 -0
  71. package/types/Billing/CreditBalanceTransactionsResource.d.ts +54 -0
  72. package/types/Billing/CreditGrants.d.ts +124 -0
  73. package/types/Billing/CreditGrantsResource.d.ts +219 -0
  74. package/types/BillingPortal/ConfigurationsResource.d.ts +2 -2
  75. package/types/Capabilities.d.ts +1 -1
  76. package/types/Charges.d.ts +0 -71
  77. package/types/ChargesResource.d.ts +0 -1294
  78. package/types/Checkout/Sessions.d.ts +4 -296
  79. package/types/Checkout/SessionsResource.d.ts +6 -352
  80. package/types/ConfirmationTokens.d.ts +0 -67
  81. package/types/Coupons.d.ts +1 -1
  82. package/types/CouponsResource.d.ts +1 -1
  83. package/types/CreditNoteLineItems.d.ts +30 -0
  84. package/types/CreditNotes.d.ts +27 -18
  85. package/types/CreditNotesResource.d.ts +0 -51
  86. package/types/Customers.d.ts +2 -3
  87. package/types/CustomersResource.d.ts +0 -3
  88. package/types/Disputes.d.ts +0 -152
  89. package/types/DisputesResource.d.ts +0 -120
  90. package/types/Errors.d.ts +32 -2
  91. package/types/EventTypes.d.ts +2 -545
  92. package/types/Events.d.ts +0 -90
  93. package/types/FinancialConnections/Accounts.d.ts +1 -29
  94. package/types/FinancialConnections/AccountsResource.d.ts +3 -35
  95. package/types/FinancialConnections/Sessions.d.ts +1 -49
  96. package/types/FinancialConnections/SessionsResource.d.ts +1 -38
  97. package/types/InvoiceItems.d.ts +0 -5
  98. package/types/InvoiceItemsResource.d.ts +0 -98
  99. package/types/InvoiceLineItems.d.ts +34 -20
  100. package/types/Invoices.d.ts +30 -108
  101. package/types/InvoicesResource.d.ts +1835 -5493
  102. package/types/Issuing/CardholdersResource.d.ts +1 -2
  103. package/types/Issuing/Transactions.d.ts +0 -2
  104. package/types/Issuing/TransactionsResource.d.ts +0 -5
  105. package/types/LineItems.d.ts +0 -7
  106. package/types/Mandates.d.ts +0 -77
  107. package/types/PaymentIntents.d.ts +1 -503
  108. package/types/PaymentIntentsResource.d.ts +3464 -7064
  109. package/types/PaymentLinks.d.ts +0 -3
  110. package/types/PaymentLinksResource.d.ts +0 -6
  111. package/types/PaymentMethodConfigurations.d.ts +0 -36
  112. package/types/PaymentMethodConfigurationsResource.d.ts +0 -50
  113. package/types/PaymentMethods.d.ts +0 -67
  114. package/types/PaymentMethodsResource.d.ts +0 -88
  115. package/types/Prices.d.ts +0 -22
  116. package/types/PricesResource.d.ts +0 -22
  117. package/types/Products.d.ts +0 -39
  118. package/types/ProductsResource.d.ts +28 -37
  119. package/types/PromotionCodes.d.ts +1 -1
  120. package/types/PromotionCodesResource.d.ts +3 -1
  121. package/types/Quotes.d.ts +1 -596
  122. package/types/QuotesResource.d.ts +199 -2531
  123. package/types/SetupAttempts.d.ts +0 -10
  124. package/types/SetupIntents.d.ts +1 -111
  125. package/types/SetupIntentsResource.d.ts +3 -522
  126. package/types/Sources.d.ts +0 -23
  127. package/types/SubscriptionItems.d.ts +0 -21
  128. package/types/SubscriptionItemsResource.d.ts +0 -109
  129. package/types/SubscriptionSchedules.d.ts +0 -200
  130. package/types/SubscriptionSchedulesResource.d.ts +13 -1231
  131. package/types/Subscriptions.d.ts +1 -82
  132. package/types/SubscriptionsResource.d.ts +5 -350
  133. package/types/Tax/Settings.d.ts +1 -1
  134. package/types/Terminal/Readers.d.ts +0 -278
  135. package/types/Terminal/ReadersResource.d.ts +13 -212
  136. package/types/TestHelpers/ConfirmationTokensResource.d.ts +0 -63
  137. package/types/TestHelpers/Treasury/ReceivedCreditsResource.d.ts +0 -26
  138. package/types/TestHelpers/Treasury/ReceivedDebitsResource.d.ts +0 -26
  139. package/types/ThinEvent.d.ts +36 -0
  140. package/types/Treasury/FinancialAccounts.d.ts +0 -5
  141. package/types/Treasury/FinancialAccountsResource.d.ts +0 -10
  142. package/types/Treasury/OutboundTransfers.d.ts +0 -26
  143. package/types/Treasury/OutboundTransfersResource.d.ts +0 -26
  144. package/types/Treasury/ReceivedCredits.d.ts +5 -27
  145. package/types/Treasury/ReceivedDebits.d.ts +0 -31
  146. package/types/V2/Billing/MeterEventAdjustments.d.ts +65 -0
  147. package/types/V2/Billing/MeterEventAdjustmentsResource.d.ts +47 -0
  148. package/types/V2/Billing/MeterEventSessionResource.d.ts +26 -0
  149. package/types/V2/Billing/MeterEventSessions.d.ts +45 -0
  150. package/types/V2/Billing/MeterEventStreamResource.d.ts +62 -0
  151. package/types/V2/Billing/MeterEvents.d.ts +54 -0
  152. package/types/V2/Billing/MeterEventsResource.d.ts +52 -0
  153. package/types/V2/BillingResource.d.ts +14 -0
  154. package/types/V2/Core/EventsResource.d.ts +57 -0
  155. package/types/V2/CoreResource.d.ts +11 -0
  156. package/types/V2/EventTypes.d.ts +214 -0
  157. package/types/V2/Events.d.ts +75 -0
  158. package/types/V2Resource.d.ts +10 -0
  159. package/types/WebhookEndpointsResource.d.ts +2 -65
  160. package/types/index.d.ts +67 -52
  161. package/types/lib.d.ts +1 -6
  162. package/types/test/typescriptTest.ts +3 -3
  163. package/cjs/resources/AccountNotices.js +0 -21
  164. package/cjs/resources/Capital/FinancingOffers.js +0 -21
  165. package/cjs/resources/Capital/FinancingTransactions.js +0 -17
  166. package/cjs/resources/GiftCards/Cards.js +0 -23
  167. package/cjs/resources/GiftCards/Transactions.js +0 -33
  168. package/cjs/resources/Issuing/CreditUnderwritingRecords.js +0 -33
  169. package/cjs/resources/Issuing/DisputeSettlementDetails.js +0 -17
  170. package/cjs/resources/Margins.js +0 -22
  171. package/cjs/resources/Orders.js +0 -24
  172. package/cjs/resources/Tax/Associations.js +0 -9
  173. package/cjs/resources/Tax/Forms.js +0 -20
  174. package/cjs/resources/Terminal/ReaderCollectedData.js +0 -12
  175. package/esm/resources/AccountNotices.js +0 -18
  176. package/esm/resources/Capital/FinancingOffers.js +0 -18
  177. package/esm/resources/Capital/FinancingTransactions.js +0 -14
  178. package/esm/resources/GiftCards/Cards.js +0 -20
  179. package/esm/resources/GiftCards/Transactions.js +0 -30
  180. package/esm/resources/Issuing/CreditUnderwritingRecords.js +0 -30
  181. package/esm/resources/Issuing/DisputeSettlementDetails.js +0 -14
  182. package/esm/resources/Margins.js +0 -19
  183. package/esm/resources/Orders.js +0 -21
  184. package/esm/resources/Tax/Associations.js +0 -6
  185. package/esm/resources/Tax/Forms.js +0 -17
  186. package/esm/resources/Terminal/ReaderCollectedData.js +0 -9
  187. package/types/AccountNotices.d.ts +0 -113
  188. package/types/AccountNoticesResource.d.ts +0 -98
  189. package/types/Billing/MeterErrorReports.d.ts +0 -106
  190. package/types/Capital/FinancingOffers.d.ts +0 -188
  191. package/types/Capital/FinancingOffersResource.d.ts +0 -97
  192. package/types/Capital/FinancingSummary.d.ts +0 -106
  193. package/types/Capital/FinancingSummaryResource.d.ts +0 -27
  194. package/types/Capital/FinancingTransactions.d.ts +0 -135
  195. package/types/Capital/FinancingTransactionsResource.d.ts +0 -68
  196. package/types/FinancialConnections/AccountInferredBalances.d.ts +0 -38
  197. package/types/FinancialConnections/Institutions.d.ts +0 -93
  198. package/types/FinancialConnections/InstitutionsResource.d.ts +0 -47
  199. package/types/GiftCards/Cards.d.ts +0 -118
  200. package/types/GiftCards/CardsResource.d.ts +0 -159
  201. package/types/GiftCards/Transactions.d.ts +0 -129
  202. package/types/GiftCards/TransactionsResource.d.ts +0 -201
  203. package/types/InvoicePayments.d.ts +0 -138
  204. package/types/Issuing/CreditUnderwritingRecords.d.ts +0 -451
  205. package/types/Issuing/CreditUnderwritingRecordsResource.d.ts +0 -1032
  206. package/types/Issuing/DisputeSettlementDetails.d.ts +0 -73
  207. package/types/Issuing/DisputeSettlementDetailsResource.d.ts +0 -52
  208. package/types/Issuing/Settlements.d.ts +0 -103
  209. package/types/MarginsResource.d.ts +0 -114
  210. package/types/Orders.d.ts +0 -1084
  211. package/types/OrdersResource.d.ts +0 -2765
  212. package/types/QuoteLines.d.ts +0 -634
  213. package/types/QuotePreviewInvoices.d.ts +0 -1548
  214. package/types/QuotePreviewSubscriptionSchedules.d.ts +0 -814
  215. package/types/Tax/Associations.d.ts +0 -126
  216. package/types/Tax/AssociationsResource.d.ts +0 -29
  217. package/types/Tax/Forms.d.ts +0 -133
  218. package/types/Tax/FormsResource.d.ts +0 -90
  219. package/types/Terminal/ReaderCollectedData.d.ts +0 -51
  220. package/types/Terminal/ReaderCollectedDataResource.d.ts +0 -29
@@ -0,0 +1,64 @@
1
+ // File generated from our OpenAPI spec
2
+
3
+ declare module 'stripe' {
4
+ namespace Stripe {
5
+ namespace Billing {
6
+ interface CreditBalanceSummaryRetrieveParams {
7
+ /**
8
+ * The customer for which to fetch credit balance summary.
9
+ */
10
+ customer: string;
11
+
12
+ /**
13
+ * The filter criteria for the credit balance summary.
14
+ */
15
+ filter: CreditBalanceSummaryRetrieveParams.Filter;
16
+
17
+ /**
18
+ * Specifies which fields in the response should be expanded.
19
+ */
20
+ expand?: Array<string>;
21
+ }
22
+
23
+ namespace CreditBalanceSummaryRetrieveParams {
24
+ interface Filter {
25
+ /**
26
+ * The credit applicability scope for which to fetch balance summary.
27
+ */
28
+ applicability_scope?: Filter.ApplicabilityScope;
29
+
30
+ /**
31
+ * The credit grant for which to fetch balance summary.
32
+ */
33
+ credit_grant?: string;
34
+
35
+ /**
36
+ * Specify the type of this filter.
37
+ */
38
+ type: Filter.Type;
39
+ }
40
+
41
+ namespace Filter {
42
+ interface ApplicabilityScope {
43
+ /**
44
+ * The price type to which credit grants can apply to. We currently only support `metered` price type.
45
+ */
46
+ price_type: 'metered';
47
+ }
48
+
49
+ type Type = 'applicability_scope' | 'credit_grant';
50
+ }
51
+ }
52
+
53
+ class CreditBalanceSummaryResource {
54
+ /**
55
+ * Retrieves the credit balance summary for a customer
56
+ */
57
+ retrieve(
58
+ params: CreditBalanceSummaryRetrieveParams,
59
+ options?: RequestOptions
60
+ ): Promise<Stripe.Response<Stripe.Billing.CreditBalanceSummary>>;
61
+ }
62
+ }
63
+ }
64
+ }
@@ -0,0 +1,159 @@
1
+ // File generated from our OpenAPI spec
2
+
3
+ declare module 'stripe' {
4
+ namespace Stripe {
5
+ namespace Billing {
6
+ /**
7
+ * A credit balance transaction is a resource representing a transaction (either a credit or a debit) against an existing credit grant.
8
+ */
9
+ interface CreditBalanceTransaction {
10
+ /**
11
+ * Unique identifier for the object.
12
+ */
13
+ id: string;
14
+
15
+ /**
16
+ * String representing the object's type. Objects of the same type share the same value.
17
+ */
18
+ object: 'billing.credit_balance_transaction';
19
+
20
+ /**
21
+ * Time at which the object was created. Measured in seconds since the Unix epoch.
22
+ */
23
+ created: number;
24
+
25
+ /**
26
+ * Credit details for this balance transaction. Only present if type is `credit`.
27
+ */
28
+ credit: CreditBalanceTransaction.Credit | null;
29
+
30
+ /**
31
+ * The credit grant associated with this balance transaction.
32
+ */
33
+ credit_grant: string | Stripe.Billing.CreditGrant;
34
+
35
+ /**
36
+ * Debit details for this balance transaction. Only present if type is `debit`.
37
+ */
38
+ debit: CreditBalanceTransaction.Debit | null;
39
+
40
+ /**
41
+ * The effective time of this balance transaction.
42
+ */
43
+ effective_at: number;
44
+
45
+ /**
46
+ * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
47
+ */
48
+ livemode: boolean;
49
+
50
+ /**
51
+ * ID of the test clock this credit balance transaction belongs to.
52
+ */
53
+ test_clock: string | Stripe.TestHelpers.TestClock | null;
54
+
55
+ /**
56
+ * The type of balance transaction (credit or debit).
57
+ */
58
+ type: CreditBalanceTransaction.Type | null;
59
+ }
60
+
61
+ namespace CreditBalanceTransaction {
62
+ interface Credit {
63
+ amount: Credit.Amount;
64
+
65
+ /**
66
+ * The type of credit transaction.
67
+ */
68
+ type: 'credits_granted';
69
+ }
70
+
71
+ namespace Credit {
72
+ interface Amount {
73
+ /**
74
+ * The monetary amount.
75
+ */
76
+ monetary: Amount.Monetary | null;
77
+
78
+ /**
79
+ * The type of this amount. We currently only support `monetary` credits.
80
+ */
81
+ type: 'monetary';
82
+ }
83
+
84
+ namespace Amount {
85
+ interface Monetary {
86
+ /**
87
+ * Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
88
+ */
89
+ currency: string;
90
+
91
+ /**
92
+ * A positive integer representing the amount.
93
+ */
94
+ value: number;
95
+ }
96
+ }
97
+ }
98
+
99
+ interface Debit {
100
+ amount: Debit.Amount;
101
+
102
+ /**
103
+ * Details of how the credits were applied to an invoice. Only present if `type` is `credits_applied`.
104
+ */
105
+ credits_applied: Debit.CreditsApplied | null;
106
+
107
+ /**
108
+ * The type of debit transaction.
109
+ */
110
+ type: Debit.Type;
111
+ }
112
+
113
+ namespace Debit {
114
+ interface Amount {
115
+ /**
116
+ * The monetary amount.
117
+ */
118
+ monetary: Amount.Monetary | null;
119
+
120
+ /**
121
+ * The type of this amount. We currently only support `monetary` credits.
122
+ */
123
+ type: 'monetary';
124
+ }
125
+
126
+ namespace Amount {
127
+ interface Monetary {
128
+ /**
129
+ * Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
130
+ */
131
+ currency: string;
132
+
133
+ /**
134
+ * A positive integer representing the amount.
135
+ */
136
+ value: number;
137
+ }
138
+ }
139
+
140
+ interface CreditsApplied {
141
+ /**
142
+ * The invoice to which the credits were applied.
143
+ */
144
+ invoice: string | Stripe.Invoice;
145
+
146
+ /**
147
+ * The invoice line item to which the credits were applied.
148
+ */
149
+ invoice_line_item: string;
150
+ }
151
+
152
+ type Type = 'credits_applied' | 'credits_expired' | 'credits_voided';
153
+ }
154
+
155
+ type Type = 'credit' | 'debit';
156
+ }
157
+ }
158
+ }
159
+ }
@@ -0,0 +1,54 @@
1
+ // File generated from our OpenAPI spec
2
+
3
+ declare module 'stripe' {
4
+ namespace Stripe {
5
+ namespace Billing {
6
+ interface CreditBalanceTransactionRetrieveParams {
7
+ /**
8
+ * Specifies which fields in the response should be expanded.
9
+ */
10
+ expand?: Array<string>;
11
+ }
12
+
13
+ interface CreditBalanceTransactionListParams extends PaginationParams {
14
+ /**
15
+ * The customer for which to fetch credit balance transactions.
16
+ */
17
+ customer: string;
18
+
19
+ /**
20
+ * The credit grant for which to fetch credit balance transactions.
21
+ */
22
+ credit_grant?: string;
23
+
24
+ /**
25
+ * Specifies which fields in the response should be expanded.
26
+ */
27
+ expand?: Array<string>;
28
+ }
29
+
30
+ class CreditBalanceTransactionsResource {
31
+ /**
32
+ * Retrieves a credit balance transaction
33
+ */
34
+ retrieve(
35
+ id: string,
36
+ params?: CreditBalanceTransactionRetrieveParams,
37
+ options?: RequestOptions
38
+ ): Promise<Stripe.Response<Stripe.Billing.CreditBalanceTransaction>>;
39
+ retrieve(
40
+ id: string,
41
+ options?: RequestOptions
42
+ ): Promise<Stripe.Response<Stripe.Billing.CreditBalanceTransaction>>;
43
+
44
+ /**
45
+ * Retrieve a list of credit balance transactions
46
+ */
47
+ list(
48
+ params: CreditBalanceTransactionListParams,
49
+ options?: RequestOptions
50
+ ): ApiListPromise<Stripe.Billing.CreditBalanceTransaction>;
51
+ }
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,124 @@
1
+ // File generated from our OpenAPI spec
2
+
3
+ declare module 'stripe' {
4
+ namespace Stripe {
5
+ namespace Billing {
6
+ /**
7
+ * A credit grant is a resource that records a grant of some credit to a customer.
8
+ */
9
+ interface CreditGrant {
10
+ /**
11
+ * Unique identifier for the object.
12
+ */
13
+ id: string;
14
+
15
+ /**
16
+ * String representing the object's type. Objects of the same type share the same value.
17
+ */
18
+ object: 'billing.credit_grant';
19
+
20
+ amount: CreditGrant.Amount;
21
+
22
+ applicability_config: CreditGrant.ApplicabilityConfig;
23
+
24
+ /**
25
+ * The category of this credit grant.
26
+ */
27
+ category: CreditGrant.Category;
28
+
29
+ /**
30
+ * Time at which the object was created. Measured in seconds since the Unix epoch.
31
+ */
32
+ created: number;
33
+
34
+ /**
35
+ * Id of the customer to whom the credit was granted.
36
+ */
37
+ customer: string | Stripe.Customer | Stripe.DeletedCustomer;
38
+
39
+ /**
40
+ * The time when the credit becomes effective i.e when it is eligible to be used.
41
+ */
42
+ effective_at: number | null;
43
+
44
+ /**
45
+ * The time when the credit will expire. If not present, the credit will never expire.
46
+ */
47
+ expires_at: number | null;
48
+
49
+ /**
50
+ * Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
51
+ */
52
+ livemode: boolean;
53
+
54
+ /**
55
+ * Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
56
+ */
57
+ metadata: Stripe.Metadata;
58
+
59
+ /**
60
+ * A descriptive name shown in dashboard and on invoices.
61
+ */
62
+ name: string | null;
63
+
64
+ /**
65
+ * ID of the test clock this credit grant belongs to.
66
+ */
67
+ test_clock: string | Stripe.TestHelpers.TestClock | null;
68
+
69
+ /**
70
+ * Time at which the object was last updated. Measured in seconds since the Unix epoch.
71
+ */
72
+ updated: number;
73
+
74
+ /**
75
+ * The time when this credit grant was voided. If not present, the credit grant hasn't been voided.
76
+ */
77
+ voided_at: number | null;
78
+ }
79
+
80
+ namespace CreditGrant {
81
+ interface Amount {
82
+ /**
83
+ * The monetary amount.
84
+ */
85
+ monetary: Amount.Monetary | null;
86
+
87
+ /**
88
+ * The type of this amount. We currently only support `monetary` credits.
89
+ */
90
+ type: 'monetary';
91
+ }
92
+
93
+ namespace Amount {
94
+ interface Monetary {
95
+ /**
96
+ * Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
97
+ */
98
+ currency: string;
99
+
100
+ /**
101
+ * A positive integer representing the amount.
102
+ */
103
+ value: number;
104
+ }
105
+ }
106
+
107
+ interface ApplicabilityConfig {
108
+ scope: ApplicabilityConfig.Scope;
109
+ }
110
+
111
+ namespace ApplicabilityConfig {
112
+ interface Scope {
113
+ /**
114
+ * The price type to which credit grants can apply to. We currently only support `metered` price type.
115
+ */
116
+ price_type: 'metered';
117
+ }
118
+ }
119
+
120
+ type Category = 'paid' | 'promotional';
121
+ }
122
+ }
123
+ }
124
+ }
@@ -0,0 +1,219 @@
1
+ // File generated from our OpenAPI spec
2
+
3
+ declare module 'stripe' {
4
+ namespace Stripe {
5
+ namespace Billing {
6
+ interface CreditGrantCreateParams {
7
+ /**
8
+ * Amount of this credit grant.
9
+ */
10
+ amount: CreditGrantCreateParams.Amount;
11
+
12
+ /**
13
+ * Configuration specifying what this credit grant applies to.
14
+ */
15
+ applicability_config: CreditGrantCreateParams.ApplicabilityConfig;
16
+
17
+ /**
18
+ * The category of this credit grant.
19
+ */
20
+ category: CreditGrantCreateParams.Category;
21
+
22
+ /**
23
+ * Id of the customer to whom the credit should be granted.
24
+ */
25
+ customer: string;
26
+
27
+ /**
28
+ * The time when the credit becomes effective i.e when it is eligible to be used. Defaults to the current timestamp if not specified.
29
+ */
30
+ effective_at?: number;
31
+
32
+ /**
33
+ * Specifies which fields in the response should be expanded.
34
+ */
35
+ expand?: Array<string>;
36
+
37
+ /**
38
+ * The time when the credit will expire. If not specified, the credit will never expire.
39
+ */
40
+ expires_at?: number;
41
+
42
+ /**
43
+ * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object (ex: cost basis) in a structured format.
44
+ */
45
+ metadata?: Stripe.MetadataParam;
46
+
47
+ /**
48
+ * A descriptive name shown in dashboard and on invoices.
49
+ */
50
+ name?: string;
51
+ }
52
+
53
+ namespace CreditGrantCreateParams {
54
+ interface Amount {
55
+ /**
56
+ * The monetary amount.
57
+ */
58
+ monetary?: Amount.Monetary;
59
+
60
+ /**
61
+ * Specify the type of this amount. We currently only support `monetary` credits.
62
+ */
63
+ type: 'monetary';
64
+ }
65
+
66
+ namespace Amount {
67
+ interface Monetary {
68
+ /**
69
+ * Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the `value` parameter.
70
+ */
71
+ currency: string;
72
+
73
+ /**
74
+ * A positive integer representing the amount of the credit grant.
75
+ */
76
+ value: number;
77
+ }
78
+ }
79
+
80
+ interface ApplicabilityConfig {
81
+ /**
82
+ * Specify the scope of this applicability config.
83
+ */
84
+ scope: ApplicabilityConfig.Scope;
85
+ }
86
+
87
+ namespace ApplicabilityConfig {
88
+ interface Scope {
89
+ /**
90
+ * The price type to which credit grants can apply to. We currently only support `metered` price type.
91
+ */
92
+ price_type: 'metered';
93
+ }
94
+ }
95
+
96
+ type Category = 'paid' | 'promotional';
97
+ }
98
+
99
+ interface CreditGrantRetrieveParams {
100
+ /**
101
+ * Specifies which fields in the response should be expanded.
102
+ */
103
+ expand?: Array<string>;
104
+ }
105
+
106
+ interface CreditGrantUpdateParams {
107
+ /**
108
+ * Specifies which fields in the response should be expanded.
109
+ */
110
+ expand?: Array<string>;
111
+
112
+ /**
113
+ * The time when the credit created by this credit grant will expire. If set to empty, the credit will never expire.
114
+ */
115
+ expires_at?: Stripe.Emptyable<number>;
116
+
117
+ /**
118
+ * Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object (ex: cost basis) in a structured format.
119
+ */
120
+ metadata?: Stripe.MetadataParam;
121
+ }
122
+
123
+ interface CreditGrantListParams extends PaginationParams {
124
+ /**
125
+ * Only return credit grants for this customer.
126
+ */
127
+ customer?: string;
128
+
129
+ /**
130
+ * Specifies which fields in the response should be expanded.
131
+ */
132
+ expand?: Array<string>;
133
+ }
134
+
135
+ interface CreditGrantExpireParams {
136
+ /**
137
+ * Specifies which fields in the response should be expanded.
138
+ */
139
+ expand?: Array<string>;
140
+ }
141
+
142
+ interface CreditGrantVoidGrantParams {
143
+ /**
144
+ * Specifies which fields in the response should be expanded.
145
+ */
146
+ expand?: Array<string>;
147
+ }
148
+
149
+ class CreditGrantsResource {
150
+ /**
151
+ * Creates a credit grant
152
+ */
153
+ create(
154
+ params: CreditGrantCreateParams,
155
+ options?: RequestOptions
156
+ ): Promise<Stripe.Response<Stripe.Billing.CreditGrant>>;
157
+
158
+ /**
159
+ * Retrieves a credit grant
160
+ */
161
+ retrieve(
162
+ id: string,
163
+ params?: CreditGrantRetrieveParams,
164
+ options?: RequestOptions
165
+ ): Promise<Stripe.Response<Stripe.Billing.CreditGrant>>;
166
+ retrieve(
167
+ id: string,
168
+ options?: RequestOptions
169
+ ): Promise<Stripe.Response<Stripe.Billing.CreditGrant>>;
170
+
171
+ /**
172
+ * Updates a credit grant
173
+ */
174
+ update(
175
+ id: string,
176
+ params?: CreditGrantUpdateParams,
177
+ options?: RequestOptions
178
+ ): Promise<Stripe.Response<Stripe.Billing.CreditGrant>>;
179
+
180
+ /**
181
+ * Retrieve a list of credit grants
182
+ */
183
+ list(
184
+ params?: CreditGrantListParams,
185
+ options?: RequestOptions
186
+ ): ApiListPromise<Stripe.Billing.CreditGrant>;
187
+ list(
188
+ options?: RequestOptions
189
+ ): ApiListPromise<Stripe.Billing.CreditGrant>;
190
+
191
+ /**
192
+ * Expires a credit grant
193
+ */
194
+ expire(
195
+ id: string,
196
+ params?: CreditGrantExpireParams,
197
+ options?: RequestOptions
198
+ ): Promise<Stripe.Response<Stripe.Billing.CreditGrant>>;
199
+ expire(
200
+ id: string,
201
+ options?: RequestOptions
202
+ ): Promise<Stripe.Response<Stripe.Billing.CreditGrant>>;
203
+
204
+ /**
205
+ * Voids a credit grant
206
+ */
207
+ voidGrant(
208
+ id: string,
209
+ params?: CreditGrantVoidGrantParams,
210
+ options?: RequestOptions
211
+ ): Promise<Stripe.Response<Stripe.Billing.CreditGrant>>;
212
+ voidGrant(
213
+ id: string,
214
+ options?: RequestOptions
215
+ ): Promise<Stripe.Response<Stripe.Billing.CreditGrant>>;
216
+ }
217
+ }
218
+ }
219
+ }
@@ -178,7 +178,7 @@ declare module 'stripe' {
178
178
  /**
179
179
  * The types of subscription updates that are supported. When empty, subscriptions are not updateable.
180
180
  */
181
- default_allowed_updates: Stripe.Emptyable<
181
+ default_allowed_updates?: Stripe.Emptyable<
182
182
  Array<SubscriptionUpdate.DefaultAllowedUpdate>
183
183
  >;
184
184
 
@@ -190,7 +190,7 @@ declare module 'stripe' {
190
190
  /**
191
191
  * The list of up to 10 products that support subscription updates.
192
192
  */
193
- products: Stripe.Emptyable<Array<SubscriptionUpdate.Product>>;
193
+ products?: Stripe.Emptyable<Array<SubscriptionUpdate.Product>>;
194
194
 
195
195
  /**
196
196
  * Determines how to handle prorations resulting from subscription updates. Valid values are `none`, `create_prorations`, and `always_invoice`.
@@ -38,7 +38,7 @@ declare module 'stripe' {
38
38
  requirements?: Capability.Requirements;
39
39
 
40
40
  /**
41
- * The status of the capability. Can be `active`, `inactive`, `pending`, or `unrequested`.
41
+ * The status of the capability.
42
42
  */
43
43
  status: Capability.Status;
44
44
  }