stripe 16.13.0-beta.1 → 17.1.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 (221) hide show
  1. package/CHANGELOG.md +139 -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 +29 -20
  100. package/types/Invoices.d.ts +25 -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 -53
  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/Margins.d.ts +0 -56
  210. package/types/MarginsResource.d.ts +0 -114
  211. package/types/Orders.d.ts +0 -1084
  212. package/types/OrdersResource.d.ts +0 -2765
  213. package/types/QuoteLines.d.ts +0 -634
  214. package/types/QuotePreviewInvoices.d.ts +0 -1548
  215. package/types/QuotePreviewSubscriptionSchedules.d.ts +0 -814
  216. package/types/Tax/Associations.d.ts +0 -126
  217. package/types/Tax/AssociationsResource.d.ts +0 -29
  218. package/types/Tax/Forms.d.ts +0 -133
  219. package/types/Tax/FormsResource.d.ts +0 -90
  220. package/types/Terminal/ReaderCollectedData.d.ts +0 -51
  221. package/types/Terminal/ReaderCollectedDataResource.d.ts +0 -29
@@ -16,11 +16,6 @@ export const Quotes = StripeResource.extend({
16
16
  method: 'POST',
17
17
  fullPath: '/v1/quotes/{quote}/finalize',
18
18
  }),
19
- listPreviewInvoiceLines: stripeMethod({
20
- method: 'GET',
21
- fullPath: '/v1/quotes/{quote}/preview_invoices/{preview_invoice}/lines',
22
- methodType: 'list',
23
- }),
24
19
  listComputedUpfrontLineItems: stripeMethod({
25
20
  method: 'GET',
26
21
  fullPath: '/v1/quotes/{quote}/computed_upfront_line_items',
@@ -31,37 +26,10 @@ export const Quotes = StripeResource.extend({
31
26
  fullPath: '/v1/quotes/{quote}/line_items',
32
27
  methodType: 'list',
33
28
  }),
34
- listLines: stripeMethod({
35
- method: 'GET',
36
- fullPath: '/v1/quotes/{quote}/lines',
37
- methodType: 'list',
38
- }),
39
- listPreviewInvoices: stripeMethod({
40
- method: 'GET',
41
- fullPath: '/v1/quotes/{quote}/preview_invoices',
42
- methodType: 'list',
43
- }),
44
- listPreviewSubscriptionSchedules: stripeMethod({
45
- method: 'GET',
46
- fullPath: '/v1/quotes/{quote}/preview_subscription_schedules',
47
- methodType: 'list',
48
- }),
49
- markDraft: stripeMethod({
50
- method: 'POST',
51
- fullPath: '/v1/quotes/{quote}/mark_draft',
52
- }),
53
- markStale: stripeMethod({
54
- method: 'POST',
55
- fullPath: '/v1/quotes/{quote}/mark_stale',
56
- }),
57
29
  pdf: stripeMethod({
58
30
  method: 'GET',
59
31
  fullPath: '/v1/quotes/{quote}/pdf',
60
32
  host: 'files.stripe.com',
61
33
  streaming: true,
62
34
  }),
63
- reestimate: stripeMethod({
64
- method: 'POST',
65
- fullPath: '/v1/quotes/{quote}/reestimate',
66
- }),
67
35
  });
@@ -19,10 +19,6 @@ export const SubscriptionSchedules = StripeResource.extend({
19
19
  fullPath: '/v1/subscription_schedules',
20
20
  methodType: 'list',
21
21
  }),
22
- amend: stripeMethod({
23
- method: 'POST',
24
- fullPath: '/v1/subscription_schedules/{schedule}/amend',
25
- }),
26
22
  cancel: stripeMethod({
27
23
  method: 'POST',
28
24
  fullPath: '/v1/subscription_schedules/{schedule}/cancel',
@@ -24,18 +24,6 @@ export const Readers = StripeResource.extend({
24
24
  method: 'POST',
25
25
  fullPath: '/v1/terminal/readers/{reader}/cancel_action',
26
26
  }),
27
- collectInputs: stripeMethod({
28
- method: 'POST',
29
- fullPath: '/v1/terminal/readers/{reader}/collect_inputs',
30
- }),
31
- collectPaymentMethod: stripeMethod({
32
- method: 'POST',
33
- fullPath: '/v1/terminal/readers/{reader}/collect_payment_method',
34
- }),
35
- confirmPaymentIntent: stripeMethod({
36
- method: 'POST',
37
- fullPath: '/v1/terminal/readers/{reader}/confirm_payment_intent',
38
- }),
39
27
  processPaymentIntent: stripeMethod({
40
28
  method: 'POST',
41
29
  fullPath: '/v1/terminal/readers/{reader}/process_payment_intent',
@@ -0,0 +1,9 @@
1
+ // File generated from our OpenAPI spec
2
+ import { StripeResource } from '../../../StripeResource.js';
3
+ const stripeMethod = StripeResource.method;
4
+ export const MeterEventAdjustments = StripeResource.extend({
5
+ create: stripeMethod({
6
+ method: 'POST',
7
+ fullPath: '/v2/billing/meter_event_adjustments',
8
+ }),
9
+ });
@@ -0,0 +1,9 @@
1
+ // File generated from our OpenAPI spec
2
+ import { StripeResource } from '../../../StripeResource.js';
3
+ const stripeMethod = StripeResource.method;
4
+ export const MeterEventSession = StripeResource.extend({
5
+ create: stripeMethod({
6
+ method: 'POST',
7
+ fullPath: '/v2/billing/meter_event_session',
8
+ }),
9
+ });
@@ -0,0 +1,10 @@
1
+ // File generated from our OpenAPI spec
2
+ import { StripeResource } from '../../../StripeResource.js';
3
+ const stripeMethod = StripeResource.method;
4
+ export const MeterEventStream = StripeResource.extend({
5
+ create: stripeMethod({
6
+ method: 'POST',
7
+ fullPath: '/v2/billing/meter_event_stream',
8
+ host: 'meter-events.stripe.com',
9
+ }),
10
+ });
@@ -0,0 +1,6 @@
1
+ // File generated from our OpenAPI spec
2
+ import { StripeResource } from '../../../StripeResource.js';
3
+ const stripeMethod = StripeResource.method;
4
+ export const MeterEvents = StripeResource.extend({
5
+ create: stripeMethod({ method: 'POST', fullPath: '/v2/billing/meter_events' }),
6
+ });
@@ -0,0 +1,15 @@
1
+ // File generated from our OpenAPI spec
2
+ import { StripeResource } from '../../StripeResource.js';
3
+ import { MeterEventSession } from './Billing/MeterEventSession.js';
4
+ import { MeterEventAdjustments } from './Billing/MeterEventAdjustments.js';
5
+ import { MeterEventStream } from './Billing/MeterEventStream.js';
6
+ import { MeterEvents } from './Billing/MeterEvents.js';
7
+ export const Billing = StripeResource.extend({
8
+ constructor: function (...args) {
9
+ StripeResource.apply(this, args);
10
+ this.meterEventSession = new MeterEventSession(...args);
11
+ this.meterEventAdjustments = new MeterEventAdjustments(...args);
12
+ this.meterEventStream = new MeterEventStream(...args);
13
+ this.meterEvents = new MeterEvents(...args);
14
+ },
15
+ });
@@ -0,0 +1,11 @@
1
+ // File generated from our OpenAPI spec
2
+ import { StripeResource } from '../../../StripeResource.js';
3
+ const stripeMethod = StripeResource.method;
4
+ export const Events = StripeResource.extend({
5
+ retrieve: stripeMethod({ method: 'GET', fullPath: '/v2/core/events/{id}' }),
6
+ list: stripeMethod({
7
+ method: 'GET',
8
+ fullPath: '/v2/core/events',
9
+ methodType: 'list',
10
+ }),
11
+ });
@@ -0,0 +1,9 @@
1
+ // File generated from our OpenAPI spec
2
+ import { StripeResource } from '../../StripeResource.js';
3
+ import { Events } from './Core/Events.js';
4
+ export const Core = StripeResource.extend({
5
+ constructor: function (...args) {
6
+ StripeResource.apply(this, args);
7
+ this.events = new Events(...args);
8
+ },
9
+ });
@@ -0,0 +1,11 @@
1
+ // File generated from our OpenAPI spec
2
+ import { StripeResource } from '../StripeResource.js';
3
+ import { Billing } from './V2/Billing.js';
4
+ import { Core } from './V2/Core.js';
5
+ export const V2 = StripeResource.extend({
6
+ constructor: function (...args) {
7
+ StripeResource.apply(this, args);
8
+ this.billing = new Billing(...args);
9
+ this.core = new Core(...args);
10
+ },
11
+ });
package/esm/resources.js CHANGED
@@ -3,34 +3,28 @@ import { resourceNamespace } from './ResourceNamespace.js';
3
3
  import { Accounts as FinancialConnectionsAccounts } from './resources/FinancialConnections/Accounts.js';
4
4
  import { ActiveEntitlements as EntitlementsActiveEntitlements } from './resources/Entitlements/ActiveEntitlements.js';
5
5
  import { Alerts as BillingAlerts } from './resources/Billing/Alerts.js';
6
- import { Associations as TaxAssociations } from './resources/Tax/Associations.js';
7
6
  import { Authorizations as TestHelpersIssuingAuthorizations } from './resources/TestHelpers/Issuing/Authorizations.js';
8
7
  import { Authorizations as IssuingAuthorizations } from './resources/Issuing/Authorizations.js';
9
8
  import { Calculations as TaxCalculations } from './resources/Tax/Calculations.js';
10
9
  import { Cardholders as IssuingCardholders } from './resources/Issuing/Cardholders.js';
11
10
  import { Cards as TestHelpersIssuingCards } from './resources/TestHelpers/Issuing/Cards.js';
12
- import { Cards as GiftCardsCards } from './resources/GiftCards/Cards.js';
13
11
  import { Cards as IssuingCards } from './resources/Issuing/Cards.js';
14
12
  import { Configurations as BillingPortalConfigurations } from './resources/BillingPortal/Configurations.js';
15
13
  import { Configurations as TerminalConfigurations } from './resources/Terminal/Configurations.js';
16
14
  import { ConfirmationTokens as TestHelpersConfirmationTokens } from './resources/TestHelpers/ConfirmationTokens.js';
17
15
  import { ConnectionTokens as TerminalConnectionTokens } from './resources/Terminal/ConnectionTokens.js';
16
+ import { CreditBalanceSummary as BillingCreditBalanceSummary } from './resources/Billing/CreditBalanceSummary.js';
17
+ import { CreditBalanceTransactions as BillingCreditBalanceTransactions } from './resources/Billing/CreditBalanceTransactions.js';
18
+ import { CreditGrants as BillingCreditGrants } from './resources/Billing/CreditGrants.js';
18
19
  import { CreditReversals as TreasuryCreditReversals } from './resources/Treasury/CreditReversals.js';
19
- import { CreditUnderwritingRecords as IssuingCreditUnderwritingRecords } from './resources/Issuing/CreditUnderwritingRecords.js';
20
20
  import { Customers as TestHelpersCustomers } from './resources/TestHelpers/Customers.js';
21
21
  import { DebitReversals as TreasuryDebitReversals } from './resources/Treasury/DebitReversals.js';
22
- import { DisputeSettlementDetails as IssuingDisputeSettlementDetails } from './resources/Issuing/DisputeSettlementDetails.js';
23
22
  import { Disputes as IssuingDisputes } from './resources/Issuing/Disputes.js';
24
23
  import { EarlyFraudWarnings as RadarEarlyFraudWarnings } from './resources/Radar/EarlyFraudWarnings.js';
25
24
  import { Features as EntitlementsFeatures } from './resources/Entitlements/Features.js';
26
25
  import { FinancialAccounts as TreasuryFinancialAccounts } from './resources/Treasury/FinancialAccounts.js';
27
- import { FinancingOffers as CapitalFinancingOffers } from './resources/Capital/FinancingOffers.js';
28
- import { FinancingSummary as CapitalFinancingSummary } from './resources/Capital/FinancingSummary.js';
29
- import { FinancingTransactions as CapitalFinancingTransactions } from './resources/Capital/FinancingTransactions.js';
30
- import { Forms as TaxForms } from './resources/Tax/Forms.js';
31
26
  import { InboundTransfers as TestHelpersTreasuryInboundTransfers } from './resources/TestHelpers/Treasury/InboundTransfers.js';
32
27
  import { InboundTransfers as TreasuryInboundTransfers } from './resources/Treasury/InboundTransfers.js';
33
- import { Institutions as FinancialConnectionsInstitutions } from './resources/FinancialConnections/Institutions.js';
34
28
  import { Locations as TerminalLocations } from './resources/Terminal/Locations.js';
35
29
  import { MeterEventAdjustments as BillingMeterEventAdjustments } from './resources/Billing/MeterEventAdjustments.js';
36
30
  import { MeterEvents as BillingMeterEvents } from './resources/Billing/MeterEvents.js';
@@ -44,7 +38,6 @@ import { PersonalizationDesigns as TestHelpersIssuingPersonalizationDesigns } fr
44
38
  import { PersonalizationDesigns as IssuingPersonalizationDesigns } from './resources/Issuing/PersonalizationDesigns.js';
45
39
  import { PhysicalBundles as IssuingPhysicalBundles } from './resources/Issuing/PhysicalBundles.js';
46
40
  import { Products as ClimateProducts } from './resources/Climate/Products.js';
47
- import { ReaderCollectedData as TerminalReaderCollectedData } from './resources/Terminal/ReaderCollectedData.js';
48
41
  import { Readers as TestHelpersTerminalReaders } from './resources/TestHelpers/Terminal/Readers.js';
49
42
  import { Readers as TerminalReaders } from './resources/Terminal/Readers.js';
50
43
  import { ReceivedCredits as TestHelpersTreasuryReceivedCredits } from './resources/TestHelpers/Treasury/ReceivedCredits.js';
@@ -68,7 +61,6 @@ import { Tokens as IssuingTokens } from './resources/Issuing/Tokens.js';
68
61
  import { TransactionEntries as TreasuryTransactionEntries } from './resources/Treasury/TransactionEntries.js';
69
62
  import { Transactions as TestHelpersIssuingTransactions } from './resources/TestHelpers/Issuing/Transactions.js';
70
63
  import { Transactions as FinancialConnectionsTransactions } from './resources/FinancialConnections/Transactions.js';
71
- import { Transactions as GiftCardsTransactions } from './resources/GiftCards/Transactions.js';
72
64
  import { Transactions as IssuingTransactions } from './resources/Issuing/Transactions.js';
73
65
  import { Transactions as TaxTransactions } from './resources/Tax/Transactions.js';
74
66
  import { Transactions as TreasuryTransactions } from './resources/Treasury/Transactions.js';
@@ -78,7 +70,6 @@ import { VerificationReports as IdentityVerificationReports } from './resources/
78
70
  import { VerificationSessions as IdentityVerificationSessions } from './resources/Identity/VerificationSessions.js';
79
71
  export { Accounts as Account } from './resources/Accounts.js';
80
72
  export { AccountLinks } from './resources/AccountLinks.js';
81
- export { AccountNotices } from './resources/AccountNotices.js';
82
73
  export { AccountSessions } from './resources/AccountSessions.js';
83
74
  export { Accounts } from './resources/Accounts.js';
84
75
  export { ApplePayDomains } from './resources/ApplePayDomains.js';
@@ -102,9 +93,7 @@ export { InvoiceItems } from './resources/InvoiceItems.js';
102
93
  export { InvoiceRenderingTemplates } from './resources/InvoiceRenderingTemplates.js';
103
94
  export { Invoices } from './resources/Invoices.js';
104
95
  export { Mandates } from './resources/Mandates.js';
105
- export { Margins } from './resources/Margins.js';
106
96
  export { OAuth } from './resources/OAuth.js';
107
- export { Orders } from './resources/Orders.js';
108
97
  export { PaymentIntents } from './resources/PaymentIntents.js';
109
98
  export { PaymentLinks } from './resources/PaymentLinks.js';
110
99
  export { PaymentMethodConfigurations } from './resources/PaymentMethodConfigurations.js';
@@ -131,10 +120,14 @@ export { TaxRates } from './resources/TaxRates.js';
131
120
  export { Tokens } from './resources/Tokens.js';
132
121
  export { Topups } from './resources/Topups.js';
133
122
  export { Transfers } from './resources/Transfers.js';
123
+ export { V2 } from './resources/V2.js';
134
124
  export { WebhookEndpoints } from './resources/WebhookEndpoints.js';
135
125
  export const Apps = resourceNamespace('apps', { Secrets: AppsSecrets });
136
126
  export const Billing = resourceNamespace('billing', {
137
127
  Alerts: BillingAlerts,
128
+ CreditBalanceSummary: BillingCreditBalanceSummary,
129
+ CreditBalanceTransactions: BillingCreditBalanceTransactions,
130
+ CreditGrants: BillingCreditGrants,
138
131
  MeterEventAdjustments: BillingMeterEventAdjustments,
139
132
  MeterEvents: BillingMeterEvents,
140
133
  Meters: BillingMeters,
@@ -143,11 +136,6 @@ export const BillingPortal = resourceNamespace('billingPortal', {
143
136
  Configurations: BillingPortalConfigurations,
144
137
  Sessions: BillingPortalSessions,
145
138
  });
146
- export const Capital = resourceNamespace('capital', {
147
- FinancingOffers: CapitalFinancingOffers,
148
- FinancingSummary: CapitalFinancingSummary,
149
- FinancingTransactions: CapitalFinancingTransactions,
150
- });
151
139
  export const Checkout = resourceNamespace('checkout', {
152
140
  Sessions: CheckoutSessions,
153
141
  });
@@ -162,17 +150,12 @@ export const Entitlements = resourceNamespace('entitlements', {
162
150
  });
163
151
  export const FinancialConnections = resourceNamespace('financialConnections', {
164
152
  Accounts: FinancialConnectionsAccounts,
165
- Institutions: FinancialConnectionsInstitutions,
166
153
  Sessions: FinancialConnectionsSessions,
167
154
  Transactions: FinancialConnectionsTransactions,
168
155
  });
169
156
  export const Forwarding = resourceNamespace('forwarding', {
170
157
  Requests: ForwardingRequests,
171
158
  });
172
- export const GiftCards = resourceNamespace('giftCards', {
173
- Cards: GiftCardsCards,
174
- Transactions: GiftCardsTransactions,
175
- });
176
159
  export const Identity = resourceNamespace('identity', {
177
160
  VerificationReports: IdentityVerificationReports,
178
161
  VerificationSessions: IdentityVerificationSessions,
@@ -181,8 +164,6 @@ export const Issuing = resourceNamespace('issuing', {
181
164
  Authorizations: IssuingAuthorizations,
182
165
  Cardholders: IssuingCardholders,
183
166
  Cards: IssuingCards,
184
- CreditUnderwritingRecords: IssuingCreditUnderwritingRecords,
185
- DisputeSettlementDetails: IssuingDisputeSettlementDetails,
186
167
  Disputes: IssuingDisputes,
187
168
  PersonalizationDesigns: IssuingPersonalizationDesigns,
188
169
  PhysicalBundles: IssuingPhysicalBundles,
@@ -202,9 +183,7 @@ export const Sigma = resourceNamespace('sigma', {
202
183
  ScheduledQueryRuns: SigmaScheduledQueryRuns,
203
184
  });
204
185
  export const Tax = resourceNamespace('tax', {
205
- Associations: TaxAssociations,
206
186
  Calculations: TaxCalculations,
207
- Forms: TaxForms,
208
187
  Registrations: TaxRegistrations,
209
188
  Settings: TaxSettings,
210
189
  Transactions: TaxTransactions,
@@ -213,7 +192,6 @@ export const Terminal = resourceNamespace('terminal', {
213
192
  Configurations: TerminalConfigurations,
214
193
  ConnectionTokens: TerminalConnectionTokens,
215
194
  Locations: TerminalLocations,
216
- ReaderCollectedData: TerminalReaderCollectedData,
217
195
  Readers: TerminalReaders,
218
196
  });
219
197
  export const TestHelpers = resourceNamespace('testHelpers', {
@@ -6,16 +6,17 @@ import { ApiVersion } from './apiVersion.js';
6
6
  import { CryptoProvider } from './crypto/CryptoProvider.js';
7
7
  import { HttpClient, HttpClientResponse } from './net/HttpClient.js';
8
8
  import * as resources from './resources.js';
9
- import { determineProcessUserAgentProperties, pascalToCamelCase, validateInteger, } from './utils.js';
9
+ import { createApiKeyAuthenticator, determineProcessUserAgentProperties, pascalToCamelCase, validateInteger, } from './utils.js';
10
10
  const DEFAULT_HOST = 'api.stripe.com';
11
11
  const DEFAULT_PORT = '443';
12
12
  const DEFAULT_BASE_PATH = '/v1/';
13
13
  const DEFAULT_API_VERSION = ApiVersion;
14
14
  const DEFAULT_TIMEOUT = 80000;
15
- const MAX_NETWORK_RETRY_DELAY_SEC = 2;
15
+ const MAX_NETWORK_RETRY_DELAY_SEC = 5;
16
16
  const INITIAL_NETWORK_RETRY_DELAY_SEC = 0.5;
17
17
  const APP_INFO_PROPERTIES = ['name', 'version', 'url', 'partner_id'];
18
18
  const ALLOWED_CONFIG_PROPERTIES = [
19
+ 'authenticator',
19
20
  'apiVersion',
20
21
  'typescript',
21
22
  'maxNetworkRetries',
@@ -28,10 +29,11 @@ const ALLOWED_CONFIG_PROPERTIES = [
28
29
  'telemetry',
29
30
  'appInfo',
30
31
  'stripeAccount',
32
+ 'stripeContext',
31
33
  ];
32
34
  const defaultRequestSenderFactory = (stripe) => new RequestSender(stripe, StripeResource.MAX_BUFFERED_REQUEST_METRICS);
33
35
  export function createStripe(platformFunctions, requestSender = defaultRequestSenderFactory) {
34
- Stripe.PACKAGE_VERSION = '16.13.0-beta.1';
36
+ Stripe.PACKAGE_VERSION = '17.1.0';
35
37
  Stripe.USER_AGENT = Object.assign({ bindings_version: Stripe.PACKAGE_VERSION, lang: 'node', publisher: 'stripe', uname: null, typescript: false }, determineProcessUserAgentProperties());
36
38
  Stripe.StripeResource = StripeResource;
37
39
  Stripe.resources = resources;
@@ -66,14 +68,13 @@ export function createStripe(platformFunctions, requestSender = defaultRequestSe
66
68
  this.off = this._emitter.removeListener.bind(this._emitter);
67
69
  const agent = props.httpAgent || null;
68
70
  this._api = {
69
- auth: null,
70
71
  host: props.host || DEFAULT_HOST,
71
72
  port: props.port || DEFAULT_PORT,
72
73
  protocol: props.protocol || 'https',
73
74
  basePath: DEFAULT_BASE_PATH,
74
75
  version: props.apiVersion || DEFAULT_API_VERSION,
75
76
  timeout: validateInteger('timeout', props.timeout, DEFAULT_TIMEOUT),
76
- maxNetworkRetries: validateInteger('maxNetworkRetries', props.maxNetworkRetries, 1),
77
+ maxNetworkRetries: validateInteger('maxNetworkRetries', props.maxNetworkRetries, 2),
77
78
  agent: agent,
78
79
  httpClient: props.httpClient ||
79
80
  (agent
@@ -81,6 +82,7 @@ export function createStripe(platformFunctions, requestSender = defaultRequestSe
81
82
  : this._platformFunctions.createDefaultHttpClient()),
82
83
  dev: false,
83
84
  stripeAccount: props.stripeAccount || null,
85
+ stripeContext: props.stripeContext || null,
84
86
  };
85
87
  const typescript = props.typescript || false;
86
88
  if (typescript !== Stripe.USER_AGENT.typescript) {
@@ -94,7 +96,7 @@ export function createStripe(platformFunctions, requestSender = defaultRequestSe
94
96
  this._setAppInfo(props.appInfo);
95
97
  }
96
98
  this._prepResources();
97
- this._setApiKey(key);
99
+ this._setAuthenticator(key, props.authenticator);
98
100
  this.errors = _Error;
99
101
  // Once Stripe.webhooks looses the factory function signature in a future release
100
102
  // then this should become this.webhooks = Stripe.webhooks
@@ -153,10 +155,16 @@ export function createStripe(platformFunctions, requestSender = defaultRequestSe
153
155
  /**
154
156
  * @private
155
157
  */
156
- _setApiKey(key) {
157
- if (key) {
158
- this._setApiField('auth', `Bearer ${key}`);
158
+ _setAuthenticator(key, authenticator) {
159
+ if (key && authenticator) {
160
+ throw new Error("Can't specify both apiKey and authenticator");
159
161
  }
162
+ if (!key && !authenticator) {
163
+ throw new Error('Neither apiKey nor config.authenticator provided');
164
+ }
165
+ this._authenticator = key
166
+ ? createApiKeyAuthenticator(key)
167
+ : authenticator;
160
168
  },
161
169
  /**
162
170
  * @private
@@ -355,6 +363,10 @@ export function createStripe(platformFunctions, requestSender = defaultRequestSe
355
363
  }
356
364
  return config;
357
365
  },
366
+ parseThinEvent(payload, header, secret, tolerance, cryptoProvider, receivedAt) {
367
+ // parses and validates the event payload all in one go
368
+ return this.webhooks.constructEvent(payload, header, secret, tolerance, cryptoProvider, receivedAt);
369
+ },
358
370
  };
359
371
  return Stripe;
360
372
  }
package/esm/utils.js CHANGED
@@ -7,7 +7,8 @@ const OPTIONS_KEYS = [
7
7
  'maxNetworkRetries',
8
8
  'timeout',
9
9
  'host',
10
- 'apiMode',
10
+ 'authenticator',
11
+ 'stripeContext',
11
12
  'additionalHeaders',
12
13
  ];
13
14
  export function isOptionsHash(o) {
@@ -19,10 +20,11 @@ export function isOptionsHash(o) {
19
20
  * Stringifies an Object, accommodating nested objects
20
21
  * (forming the conventional key 'parent[child]=value')
21
22
  */
22
- export function queryStringifyRequestData(data) {
23
+ export function queryStringifyRequestData(data, apiMode) {
23
24
  return (qs
24
25
  .stringify(data, {
25
26
  serializeDate: (d) => Math.floor(d.getTime() / 1000).toString(),
27
+ arrayFormat: apiMode == 'v2' ? 'repeat' : 'indices',
26
28
  })
27
29
  // Don't use strict form encoding by changing the square bracket control
28
30
  // characters back to their literals. This is fine by the server, and
@@ -89,7 +91,6 @@ export function getDataFromArgs(args) {
89
91
  */
90
92
  export function getOptionsFromArgs(args) {
91
93
  const opts = {
92
- auth: null,
93
94
  host: null,
94
95
  headers: {},
95
96
  settings: {},
@@ -97,7 +98,7 @@ export function getOptionsFromArgs(args) {
97
98
  if (args.length > 0) {
98
99
  const arg = args[args.length - 1];
99
100
  if (typeof arg === 'string') {
100
- opts.auth = args.pop();
101
+ opts.authenticator = createApiKeyAuthenticator(args.pop());
101
102
  }
102
103
  else if (isOptionsHash(arg)) {
103
104
  const params = Object.assign({}, args.pop());
@@ -106,7 +107,7 @@ export function getOptionsFromArgs(args) {
106
107
  emitWarning(`Invalid options found (${extraKeys.join(', ')}); ignoring.`);
107
108
  }
108
109
  if (params.apiKey) {
109
- opts.auth = params.apiKey;
110
+ opts.authenticator = createApiKeyAuthenticator(params.apiKey);
110
111
  }
111
112
  if (params.idempotencyKey) {
112
113
  opts.headers['Idempotency-Key'] = params.idempotencyKey;
@@ -114,6 +115,12 @@ export function getOptionsFromArgs(args) {
114
115
  if (params.stripeAccount) {
115
116
  opts.headers['Stripe-Account'] = params.stripeAccount;
116
117
  }
118
+ if (params.stripeContext) {
119
+ if (opts.headers['Stripe-Account']) {
120
+ throw new Error("Can't specify both stripeAccount and stripeContext.");
121
+ }
122
+ opts.headers['Stripe-Context'] = params.stripeContext;
123
+ }
117
124
  if (params.apiVersion) {
118
125
  opts.headers['Stripe-Version'] = params.apiVersion;
119
126
  }
@@ -126,11 +133,15 @@ export function getOptionsFromArgs(args) {
126
133
  if (params.host) {
127
134
  opts.host = params.host;
128
135
  }
129
- if (params.apiMode) {
130
- if (params.apiMode !== 'standard' && params.apiMode !== 'preview') {
131
- throw new Error(`Invalid apiMode: ${params.apiMode}. Must be one of 'standard' or 'preview'`);
136
+ if (params.authenticator) {
137
+ if (params.apiKey) {
138
+ throw new Error("Can't specify both apiKey and authenticator.");
139
+ }
140
+ if (typeof params.authenticator !== 'function') {
141
+ throw new Error('The authenticator must be a function ' +
142
+ 'receiving a request as the first parameter.');
132
143
  }
133
- opts.apiMode = params.apiMode;
144
+ opts.authenticator = params.authenticator;
134
145
  }
135
146
  if (params.additionalHeaders) {
136
147
  opts.headers = params.additionalHeaders;
@@ -281,6 +292,15 @@ export function determineProcessUserAgentProperties() {
281
292
  platform: process.platform,
282
293
  };
283
294
  }
295
+ export function createApiKeyAuthenticator(apiKey) {
296
+ const authenticator = (request) => {
297
+ request.headers.Authorization = 'Bearer ' + apiKey;
298
+ return Promise.resolve();
299
+ };
300
+ // For testing
301
+ authenticator._apiKey = apiKey;
302
+ return authenticator;
303
+ }
284
304
  /**
285
305
  * Joins an array of Uint8Arrays into a single Uint8Array
286
306
  */
@@ -309,3 +329,12 @@ function dateTimeReplacer(key, value) {
309
329
  export function jsonStringifyRequestData(data) {
310
330
  return JSON.stringify(data, dateTimeReplacer);
311
331
  }
332
+ /**
333
+ * Inspects the given path to determine if the endpoint is for v1 or v2 API
334
+ */
335
+ export function getAPIMode(path) {
336
+ if (!path) {
337
+ return 'v1';
338
+ }
339
+ return path.startsWith('/v2') ? 'v2' : 'v1';
340
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stripe",
3
- "version": "16.13.0-beta.1",
3
+ "version": "17.1.0",
4
4
  "description": "Stripe API wrapper",
5
5
  "keywords": [
6
6
  "stripe",
@@ -60,11 +60,7 @@ declare module 'stripe' {
60
60
  type FutureRequirements = 'include' | 'omit';
61
61
  }
62
62
 
63
- type Type =
64
- | 'account_onboarding'
65
- | 'account_update'
66
- | 'capital_financing_offer'
67
- | 'capital_financing_reporting';
63
+ type Type = 'account_onboarding' | 'account_update';
68
64
  }
69
65
 
70
66
  class AccountLinksResource {
@@ -52,12 +52,6 @@ declare module 'stripe' {
52
52
 
53
53
  balances: Components.Balances;
54
54
 
55
- capital_financing?: Components.CapitalFinancing | null;
56
-
57
- capital_financing_application?: Components.CapitalFinancingApplication | null;
58
-
59
- capital_financing_promotion?: Components.CapitalFinancingPromotion | null;
60
-
61
55
  documents: Components.Documents;
62
56
 
63
57
  notification_banner: Components.NotificationBanner;
@@ -145,45 +139,6 @@ declare module 'stripe' {
145
139
  }
146
140
  }
147
141
 
148
- interface CapitalFinancing {
149
- /**
150
- * Whether the embedded component is enabled.
151
- */
152
- enabled: boolean;
153
-
154
- features: CapitalFinancing.Features;
155
- }
156
-
157
- namespace CapitalFinancing {
158
- interface Features {}
159
- }
160
-
161
- interface CapitalFinancingApplication {
162
- /**
163
- * Whether the embedded component is enabled.
164
- */
165
- enabled: boolean;
166
-
167
- features: CapitalFinancingApplication.Features;
168
- }
169
-
170
- namespace CapitalFinancingApplication {
171
- interface Features {}
172
- }
173
-
174
- interface CapitalFinancingPromotion {
175
- /**
176
- * Whether the embedded component is enabled.
177
- */
178
- enabled: boolean;
179
-
180
- features: CapitalFinancingPromotion.Features;
181
- }
182
-
183
- namespace CapitalFinancingPromotion {
184
- interface Features {}
185
- }
186
-
187
142
  interface Documents {
188
143
  /**
189
144
  * Whether the embedded component is enabled.