stripe 11.10.0 → 11.11.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 (40) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +1 -1
  3. package/VERSION +1 -1
  4. package/lib/Webhooks.js +30 -8
  5. package/lib/resources/Accounts.js +34 -34
  6. package/lib/resources/ApplicationFees.js +5 -5
  7. package/lib/resources/CreditNotes.js +5 -5
  8. package/lib/resources/Customers.js +53 -53
  9. package/lib/resources/Invoices.js +5 -5
  10. package/lib/resources/Terminal/Readers.js +4 -0
  11. package/lib/resources/Transfers.js +5 -5
  12. package/lib/stripe.common.js +3 -2
  13. package/package.json +1 -1
  14. package/types/Accounts.d.ts +6 -4
  15. package/types/AccountsResource.d.ts +300 -274
  16. package/types/ApplicationFeesResource.d.ts +23 -18
  17. package/types/BillingPortal/Configurations.d.ts +1 -0
  18. package/types/BillingPortal/ConfigurationsResource.d.ts +2 -0
  19. package/types/BillingPortal/Sessions.d.ts +1 -1
  20. package/types/BillingPortal/SessionsResource.d.ts +1 -1
  21. package/types/Checkout/Sessions.d.ts +98 -4
  22. package/types/Checkout/SessionsResource.d.ts +69 -0
  23. package/types/CreditNotesResource.d.ts +20 -20
  24. package/types/CustomersResource.d.ts +339 -323
  25. package/types/InvoiceItems.d.ts +10 -6
  26. package/types/InvoiceLineItems.d.ts +1 -1
  27. package/types/Invoices.d.ts +1 -1
  28. package/types/InvoicesResource.d.ts +22 -22
  29. package/types/PaymentLinks.d.ts +66 -0
  30. package/types/PaymentLinksResource.d.ts +140 -0
  31. package/types/Refunds.d.ts +1 -1
  32. package/types/Reporting/ReportRuns.d.ts +2 -2
  33. package/types/SubscriptionItemsResource.d.ts +2 -2
  34. package/types/SubscriptionSchedulesResource.d.ts +2 -2
  35. package/types/Subscriptions.d.ts +2 -2
  36. package/types/SubscriptionsResource.d.ts +2 -2
  37. package/types/Terminal/Readers.d.ts +52 -0
  38. package/types/Terminal/ReadersResource.d.ts +50 -0
  39. package/types/TestHelpers/Terminal/ReadersResource.d.ts +15 -1
  40. package/types/TransfersResource.d.ts +23 -18
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 11.11.0 - 2023-02-16
4
+ * [#1681](https://github.com/stripe/stripe-node/pull/1681) API Updates
5
+ * Add support for `refund_payment` method on resource `Terminal.Reader`
6
+ * Add support for new value `name` on enums `BillingPortal.Configuration.features.customer_update.allowed_updates[]`, `BillingPortalConfigurationCreateParams.features.customer_update.allowed_updates[]`, and `BillingPortalConfigurationUpdateParams.features.customer_update.allowed_updates[]`
7
+ * Add support for `custom_fields` on `Checkout.Session`, `CheckoutSessionCreateParams`, `PaymentLinkCreateParams`, `PaymentLinkUpdateParams`, and `PaymentLink`
8
+ * Change `Subscription.trial_settings.end_behavior` and `Subscription.trial_settings` to be required
9
+ * Add support for `interac_present` on `TerminalReaderPresentPaymentMethodParams.testHelpers`
10
+ * Change type of `TerminalReaderPresentPaymentMethodParams.testHelpers.type` from `literal('card_present')` to `enum('card_present'|'interac_present')`
11
+ * Add support for `refund_payment` on `Terminal.Reader.action`
12
+ * Add support for new value `refund_payment` on enum `Terminal.Reader.action.type`
13
+ * [#1683](https://github.com/stripe/stripe-node/pull/1683) Add NextJS webhook sample
14
+ * [#1685](https://github.com/stripe/stripe-node/pull/1685) Add more webhook parsing checks
15
+ * [#1684](https://github.com/stripe/stripe-node/pull/1684) Add infrastructure for mocked tests
16
+
3
17
  ## 11.10.0 - 2023-02-09
4
18
  * [#1679](https://github.com/stripe/stripe-node/pull/1679) Enable library to work in worker environments without extra configuration.
5
19
 
package/README.md CHANGED
@@ -331,7 +331,7 @@ Stripe can optionally sign the webhook events it sends to your endpoint, allowin
331
331
 
332
332
  Please note that you must pass the _raw_ request body, exactly as received from Stripe, to the `constructEvent()` function; this will not work with a parsed (i.e., JSON) request body.
333
333
 
334
- You can find an example of how to use this with [Express](https://expressjs.com/) in the [`examples/webhook-signing`](examples/webhook-signing) folder, but here's what it looks like:
334
+ You can find an example of how to use this with various JavaScript frameworks in [`examples/webhook-signing`](examples/webhook-signing) folder, but here's what it looks like:
335
335
 
336
336
  ```js
337
337
  const event = stripe.webhooks.constructEvent(
package/VERSION CHANGED
@@ -1 +1 @@
1
- 11.10.0
1
+ 11.11.0
package/lib/Webhooks.js CHANGED
@@ -54,23 +54,30 @@ function createWebhooks(platformFunctions) {
54
54
  const signature = {
55
55
  EXPECTED_SCHEME: 'v1',
56
56
  verifyHeader(encodedPayload, encodedHeader, secret, tolerance, cryptoProvider) {
57
- const { decodedHeader: header, decodedPayload: payload, details, } = parseEventDetails(encodedPayload, encodedHeader, this.EXPECTED_SCHEME);
57
+ const { decodedHeader: header, decodedPayload: payload, details, suspectPayloadType, } = parseEventDetails(encodedPayload, encodedHeader, this.EXPECTED_SCHEME);
58
58
  cryptoProvider = cryptoProvider || getCryptoProvider();
59
59
  const expectedSignature = cryptoProvider.computeHMACSignature(makeHMACContent(payload, details), secret);
60
- validateComputedSignature(payload, header, details, expectedSignature, tolerance);
60
+ validateComputedSignature(payload, header, details, expectedSignature, tolerance, suspectPayloadType);
61
61
  return true;
62
62
  },
63
63
  async verifyHeaderAsync(encodedPayload, encodedHeader, secret, tolerance, cryptoProvider) {
64
- const { decodedHeader: header, decodedPayload: payload, details, } = parseEventDetails(encodedPayload, encodedHeader, this.EXPECTED_SCHEME);
64
+ const { decodedHeader: header, decodedPayload: payload, details, suspectPayloadType, } = parseEventDetails(encodedPayload, encodedHeader, this.EXPECTED_SCHEME);
65
65
  cryptoProvider = cryptoProvider || getCryptoProvider();
66
66
  const expectedSignature = await cryptoProvider.computeHMACSignatureAsync(makeHMACContent(payload, details), secret);
67
- return validateComputedSignature(payload, header, details, expectedSignature, tolerance);
67
+ return validateComputedSignature(payload, header, details, expectedSignature, tolerance, suspectPayloadType);
68
68
  },
69
69
  };
70
70
  function makeHMACContent(payload, details) {
71
71
  return `${details.timestamp}.${payload}`;
72
72
  }
73
73
  function parseEventDetails(encodedPayload, encodedHeader, expectedScheme) {
74
+ if (!encodedPayload) {
75
+ throw new StripeSignatureVerificationError(encodedHeader, encodedPayload, {
76
+ message: 'No webhook payload was provided.',
77
+ });
78
+ }
79
+ const suspectPayloadType = typeof encodedPayload != 'string' &&
80
+ !(encodedPayload instanceof Uint8Array);
74
81
  const textDecoder = new TextDecoder('utf8');
75
82
  const decodedPayload = encodedPayload instanceof Uint8Array
76
83
  ? textDecoder.decode(encodedPayload)
@@ -82,6 +89,11 @@ function createWebhooks(platformFunctions) {
82
89
  if (Array.isArray(encodedHeader)) {
83
90
  throw new Error('Unexpected: An array was passed as a header, which should not be possible for the stripe-signature header.');
84
91
  }
92
+ if (encodedHeader == null || encodedHeader == '') {
93
+ throw new StripeSignatureVerificationError(encodedHeader, encodedPayload, {
94
+ message: 'No stripe-signature header value was provided.',
95
+ });
96
+ }
85
97
  const decodedHeader = encodedHeader instanceof Uint8Array
86
98
  ? textDecoder.decode(encodedHeader)
87
99
  : encodedHeader;
@@ -100,16 +112,26 @@ function createWebhooks(platformFunctions) {
100
112
  decodedPayload,
101
113
  decodedHeader,
102
114
  details,
115
+ suspectPayloadType,
103
116
  };
104
117
  }
105
- function validateComputedSignature(payload, header, details, expectedSignature, tolerance) {
118
+ function validateComputedSignature(payload, header, details, expectedSignature, tolerance, suspectPayloadType) {
106
119
  const signatureFound = !!details.signatures.filter(platformFunctions.secureCompare.bind(platformFunctions, expectedSignature)).length;
107
120
  if (!signatureFound) {
108
- // @ts-ignore
121
+ if (suspectPayloadType) {
122
+ throw new StripeSignatureVerificationError(header, payload, {
123
+ message: 'Webhook payload must be provided as a string or a Buffer (https://nodejs.org/api/buffer.html) instance representing the _raw_ request body.' +
124
+ 'Payload was provided as a parsed JavaScript object instead. \n' +
125
+ 'Signature verification is impossible without access to the original signed material. \n' +
126
+ 'Learn more about webhook signing and explore webhook integration examples for various frameworks at ' +
127
+ 'https://github.com/stripe/stripe-node#webhook-signing',
128
+ });
129
+ }
109
130
  throw new StripeSignatureVerificationError(header, payload, {
110
131
  message: 'No signatures found matching the expected signature for payload.' +
111
- ' Are you passing the raw request body you received from Stripe?' +
112
- ' https://github.com/stripe/stripe-node#webhook-signing',
132
+ ' Are you passing the raw request body you received from Stripe? \n' +
133
+ 'Learn more about webhook signing and explore webhook integration examples for various frameworks at ' +
134
+ 'https://github.com/stripe/stripe-node#webhook-signing',
113
135
  });
114
136
  }
115
137
  const timestampAge = Math.floor(Date.now() / 1000) - details.timestamp;
@@ -41,67 +41,67 @@ module.exports = StripeResource.extend({
41
41
  method: 'DELETE',
42
42
  fullPath: '/v1/accounts/{account}',
43
43
  }),
44
- reject: stripeMethod({
44
+ createExternalAccount: stripeMethod({
45
45
  method: 'POST',
46
- fullPath: '/v1/accounts/{account}/reject',
46
+ fullPath: '/v1/accounts/{account}/external_accounts',
47
47
  }),
48
- retrieveCapability: stripeMethod({
49
- method: 'GET',
50
- fullPath: '/v1/accounts/{account}/capabilities/{capability}',
48
+ createLoginLink: stripeMethod({
49
+ method: 'POST',
50
+ fullPath: '/v1/accounts/{account}/login_links',
51
51
  }),
52
- updateCapability: stripeMethod({
52
+ createPerson: stripeMethod({
53
53
  method: 'POST',
54
- fullPath: '/v1/accounts/{account}/capabilities/{capability}',
54
+ fullPath: '/v1/accounts/{account}/persons',
55
+ }),
56
+ deleteExternalAccount: stripeMethod({
57
+ method: 'DELETE',
58
+ fullPath: '/v1/accounts/{account}/external_accounts/{id}',
59
+ }),
60
+ deletePerson: stripeMethod({
61
+ method: 'DELETE',
62
+ fullPath: '/v1/accounts/{account}/persons/{person}',
55
63
  }),
56
64
  listCapabilities: stripeMethod({
57
65
  method: 'GET',
58
66
  fullPath: '/v1/accounts/{account}/capabilities',
59
67
  methodType: 'list',
60
68
  }),
61
- createExternalAccount: stripeMethod({
62
- method: 'POST',
69
+ listExternalAccounts: stripeMethod({
70
+ method: 'GET',
63
71
  fullPath: '/v1/accounts/{account}/external_accounts',
72
+ methodType: 'list',
64
73
  }),
65
- retrieveExternalAccount: stripeMethod({
74
+ listPersons: stripeMethod({
66
75
  method: 'GET',
67
- fullPath: '/v1/accounts/{account}/external_accounts/{id}',
76
+ fullPath: '/v1/accounts/{account}/persons',
77
+ methodType: 'list',
68
78
  }),
69
- updateExternalAccount: stripeMethod({
79
+ reject: stripeMethod({
70
80
  method: 'POST',
71
- fullPath: '/v1/accounts/{account}/external_accounts/{id}',
81
+ fullPath: '/v1/accounts/{account}/reject',
72
82
  }),
73
- listExternalAccounts: stripeMethod({
83
+ retrieveCapability: stripeMethod({
74
84
  method: 'GET',
75
- fullPath: '/v1/accounts/{account}/external_accounts',
76
- methodType: 'list',
85
+ fullPath: '/v1/accounts/{account}/capabilities/{capability}',
77
86
  }),
78
- deleteExternalAccount: stripeMethod({
79
- method: 'DELETE',
87
+ retrieveExternalAccount: stripeMethod({
88
+ method: 'GET',
80
89
  fullPath: '/v1/accounts/{account}/external_accounts/{id}',
81
90
  }),
82
- createLoginLink: stripeMethod({
83
- method: 'POST',
84
- fullPath: '/v1/accounts/{account}/login_links',
85
- }),
86
- createPerson: stripeMethod({
87
- method: 'POST',
88
- fullPath: '/v1/accounts/{account}/persons',
89
- }),
90
91
  retrievePerson: stripeMethod({
91
92
  method: 'GET',
92
93
  fullPath: '/v1/accounts/{account}/persons/{person}',
93
94
  }),
94
- updatePerson: stripeMethod({
95
+ updateCapability: stripeMethod({
95
96
  method: 'POST',
96
- fullPath: '/v1/accounts/{account}/persons/{person}',
97
+ fullPath: '/v1/accounts/{account}/capabilities/{capability}',
97
98
  }),
98
- listPersons: stripeMethod({
99
- method: 'GET',
100
- fullPath: '/v1/accounts/{account}/persons',
101
- methodType: 'list',
99
+ updateExternalAccount: stripeMethod({
100
+ method: 'POST',
101
+ fullPath: '/v1/accounts/{account}/external_accounts/{id}',
102
102
  }),
103
- deletePerson: stripeMethod({
104
- method: 'DELETE',
103
+ updatePerson: stripeMethod({
104
+ method: 'POST',
105
105
  fullPath: '/v1/accounts/{account}/persons/{person}',
106
106
  }),
107
107
  });
@@ -16,6 +16,11 @@ module.exports = StripeResource.extend({
16
16
  method: 'POST',
17
17
  fullPath: '/v1/application_fees/{id}/refunds',
18
18
  }),
19
+ listRefunds: stripeMethod({
20
+ method: 'GET',
21
+ fullPath: '/v1/application_fees/{id}/refunds',
22
+ methodType: 'list',
23
+ }),
19
24
  retrieveRefund: stripeMethod({
20
25
  method: 'GET',
21
26
  fullPath: '/v1/application_fees/{fee}/refunds/{id}',
@@ -24,9 +29,4 @@ module.exports = StripeResource.extend({
24
29
  method: 'POST',
25
30
  fullPath: '/v1/application_fees/{fee}/refunds/{id}',
26
31
  }),
27
- listRefunds: stripeMethod({
28
- method: 'GET',
29
- fullPath: '/v1/application_fees/{id}/refunds',
30
- methodType: 'list',
31
- }),
32
32
  });
@@ -20,6 +20,11 @@ module.exports = StripeResource.extend({
20
20
  fullPath: '/v1/credit_notes',
21
21
  methodType: 'list',
22
22
  }),
23
+ listLineItems: stripeMethod({
24
+ method: 'GET',
25
+ fullPath: '/v1/credit_notes/{credit_note}/lines',
26
+ methodType: 'list',
27
+ }),
23
28
  listPreviewLineItems: stripeMethod({
24
29
  method: 'GET',
25
30
  fullPath: '/v1/credit_notes/preview/lines',
@@ -33,9 +38,4 @@ module.exports = StripeResource.extend({
33
38
  method: 'POST',
34
39
  fullPath: '/v1/credit_notes/{id}/void',
35
40
  }),
36
- listLineItems: stripeMethod({
37
- method: 'GET',
38
- fullPath: '/v1/credit_notes/{credit_note}/lines',
39
- methodType: 'list',
40
- }),
41
41
  });
@@ -28,98 +28,98 @@ module.exports = StripeResource.extend({
28
28
  method: 'POST',
29
29
  fullPath: '/v1/customers/{customer}/funding_instructions',
30
30
  }),
31
+ createBalanceTransaction: stripeMethod({
32
+ method: 'POST',
33
+ fullPath: '/v1/customers/{customer}/balance_transactions',
34
+ }),
35
+ createSource: stripeMethod({
36
+ method: 'POST',
37
+ fullPath: '/v1/customers/{customer}/sources',
38
+ }),
39
+ createTaxId: stripeMethod({
40
+ method: 'POST',
41
+ fullPath: '/v1/customers/{customer}/tax_ids',
42
+ }),
31
43
  deleteDiscount: stripeMethod({
32
44
  method: 'DELETE',
33
45
  fullPath: '/v1/customers/{customer}/discount',
34
46
  }),
47
+ deleteSource: stripeMethod({
48
+ method: 'DELETE',
49
+ fullPath: '/v1/customers/{customer}/sources/{id}',
50
+ }),
51
+ deleteTaxId: stripeMethod({
52
+ method: 'DELETE',
53
+ fullPath: '/v1/customers/{customer}/tax_ids/{id}',
54
+ }),
35
55
  listPaymentMethods: stripeMethod({
36
56
  method: 'GET',
37
57
  fullPath: '/v1/customers/{customer}/payment_methods',
38
58
  methodType: 'list',
39
59
  }),
40
- retrievePaymentMethod: stripeMethod({
60
+ listBalanceTransactions: stripeMethod({
41
61
  method: 'GET',
42
- fullPath: '/v1/customers/{customer}/payment_methods/{payment_method}',
62
+ fullPath: '/v1/customers/{customer}/balance_transactions',
63
+ methodType: 'list',
43
64
  }),
44
- search: stripeMethod({
65
+ listCashBalanceTransactions: stripeMethod({
45
66
  method: 'GET',
46
- fullPath: '/v1/customers/search',
47
- methodType: 'search',
67
+ fullPath: '/v1/customers/{customer}/cash_balance_transactions',
68
+ methodType: 'list',
48
69
  }),
49
- retrieveCashBalance: stripeMethod({
70
+ listSources: stripeMethod({
50
71
  method: 'GET',
51
- fullPath: '/v1/customers/{customer}/cash_balance',
72
+ fullPath: '/v1/customers/{customer}/sources',
73
+ methodType: 'list',
52
74
  }),
53
- updateCashBalance: stripeMethod({
54
- method: 'POST',
55
- fullPath: '/v1/customers/{customer}/cash_balance',
75
+ listTaxIds: stripeMethod({
76
+ method: 'GET',
77
+ fullPath: '/v1/customers/{customer}/tax_ids',
78
+ methodType: 'list',
56
79
  }),
57
- createBalanceTransaction: stripeMethod({
58
- method: 'POST',
59
- fullPath: '/v1/customers/{customer}/balance_transactions',
80
+ retrievePaymentMethod: stripeMethod({
81
+ method: 'GET',
82
+ fullPath: '/v1/customers/{customer}/payment_methods/{payment_method}',
60
83
  }),
61
84
  retrieveBalanceTransaction: stripeMethod({
62
85
  method: 'GET',
63
86
  fullPath: '/v1/customers/{customer}/balance_transactions/{transaction}',
64
87
  }),
65
- updateBalanceTransaction: stripeMethod({
66
- method: 'POST',
67
- fullPath: '/v1/customers/{customer}/balance_transactions/{transaction}',
68
- }),
69
- listBalanceTransactions: stripeMethod({
88
+ retrieveCashBalance: stripeMethod({
70
89
  method: 'GET',
71
- fullPath: '/v1/customers/{customer}/balance_transactions',
72
- methodType: 'list',
90
+ fullPath: '/v1/customers/{customer}/cash_balance',
73
91
  }),
74
92
  retrieveCashBalanceTransaction: stripeMethod({
75
93
  method: 'GET',
76
94
  fullPath: '/v1/customers/{customer}/cash_balance_transactions/{transaction}',
77
95
  }),
78
- listCashBalanceTransactions: stripeMethod({
96
+ retrieveSource: stripeMethod({
79
97
  method: 'GET',
80
- fullPath: '/v1/customers/{customer}/cash_balance_transactions',
81
- methodType: 'list',
98
+ fullPath: '/v1/customers/{customer}/sources/{id}',
82
99
  }),
83
- createSource: stripeMethod({
84
- method: 'POST',
85
- fullPath: '/v1/customers/{customer}/sources',
100
+ retrieveTaxId: stripeMethod({
101
+ method: 'GET',
102
+ fullPath: '/v1/customers/{customer}/tax_ids/{id}',
86
103
  }),
87
- retrieveSource: stripeMethod({
104
+ search: stripeMethod({
88
105
  method: 'GET',
89
- fullPath: '/v1/customers/{customer}/sources/{id}',
106
+ fullPath: '/v1/customers/search',
107
+ methodType: 'search',
90
108
  }),
91
- updateSource: stripeMethod({
109
+ updateBalanceTransaction: stripeMethod({
92
110
  method: 'POST',
93
- fullPath: '/v1/customers/{customer}/sources/{id}',
111
+ fullPath: '/v1/customers/{customer}/balance_transactions/{transaction}',
94
112
  }),
95
- listSources: stripeMethod({
96
- method: 'GET',
97
- fullPath: '/v1/customers/{customer}/sources',
98
- methodType: 'list',
113
+ updateCashBalance: stripeMethod({
114
+ method: 'POST',
115
+ fullPath: '/v1/customers/{customer}/cash_balance',
99
116
  }),
100
- deleteSource: stripeMethod({
101
- method: 'DELETE',
117
+ updateSource: stripeMethod({
118
+ method: 'POST',
102
119
  fullPath: '/v1/customers/{customer}/sources/{id}',
103
120
  }),
104
121
  verifySource: stripeMethod({
105
122
  method: 'POST',
106
123
  fullPath: '/v1/customers/{customer}/sources/{id}/verify',
107
124
  }),
108
- createTaxId: stripeMethod({
109
- method: 'POST',
110
- fullPath: '/v1/customers/{customer}/tax_ids',
111
- }),
112
- retrieveTaxId: stripeMethod({
113
- method: 'GET',
114
- fullPath: '/v1/customers/{customer}/tax_ids/{id}',
115
- }),
116
- listTaxIds: stripeMethod({
117
- method: 'GET',
118
- fullPath: '/v1/customers/{customer}/tax_ids',
119
- methodType: 'list',
120
- }),
121
- deleteTaxId: stripeMethod({
122
- method: 'DELETE',
123
- fullPath: '/v1/customers/{customer}/tax_ids/{id}',
124
- }),
125
125
  });
@@ -28,6 +28,11 @@ module.exports = StripeResource.extend({
28
28
  method: 'POST',
29
29
  fullPath: '/v1/invoices/{invoice}/finalize',
30
30
  }),
31
+ listLineItems: stripeMethod({
32
+ method: 'GET',
33
+ fullPath: '/v1/invoices/{invoice}/lines',
34
+ methodType: 'list',
35
+ }),
31
36
  listUpcomingLines: stripeMethod({
32
37
  method: 'GET',
33
38
  fullPath: '/v1/invoices/upcoming/lines',
@@ -58,9 +63,4 @@ module.exports = StripeResource.extend({
58
63
  method: 'POST',
59
64
  fullPath: '/v1/invoices/{invoice}/void',
60
65
  }),
61
- listLineItems: stripeMethod({
62
- method: 'GET',
63
- fullPath: '/v1/invoices/{invoice}/lines',
64
- methodType: 'list',
65
- }),
66
66
  });
@@ -36,6 +36,10 @@ module.exports = StripeResource.extend({
36
36
  method: 'POST',
37
37
  fullPath: '/v1/terminal/readers/{reader}/process_setup_intent',
38
38
  }),
39
+ refundPayment: stripeMethod({
40
+ method: 'POST',
41
+ fullPath: '/v1/terminal/readers/{reader}/refund_payment',
42
+ }),
39
43
  setReaderDisplay: stripeMethod({
40
44
  method: 'POST',
41
45
  fullPath: '/v1/terminal/readers/{reader}/set_reader_display',
@@ -24,6 +24,11 @@ module.exports = StripeResource.extend({
24
24
  method: 'POST',
25
25
  fullPath: '/v1/transfers/{id}/reversals',
26
26
  }),
27
+ listReversals: stripeMethod({
28
+ method: 'GET',
29
+ fullPath: '/v1/transfers/{id}/reversals',
30
+ methodType: 'list',
31
+ }),
27
32
  retrieveReversal: stripeMethod({
28
33
  method: 'GET',
29
34
  fullPath: '/v1/transfers/{transfer}/reversals/{id}',
@@ -32,9 +37,4 @@ module.exports = StripeResource.extend({
32
37
  method: 'POST',
33
38
  fullPath: '/v1/transfers/{transfer}/reversals/{id}',
34
39
  }),
35
- listReversals: stripeMethod({
36
- method: 'GET',
37
- fullPath: '/v1/transfers/{id}/reversals',
38
- methodType: 'list',
39
- }),
40
40
  });
@@ -30,7 +30,8 @@ const RequestSender = require("./RequestSender");
30
30
  const HttpClient = require("./net/HttpClient");
31
31
  const CryptoProvider = require("./crypto/CryptoProvider");
32
32
  const createWebhooks = require("./Webhooks");
33
- function createStripe(platformFunctions) {
33
+ const defaultRequestSenderFactory = (stripe) => new RequestSender(stripe, StripeResource.MAX_BUFFERED_REQUEST_METRICS);
34
+ function createStripe(platformFunctions, requestSender = defaultRequestSenderFactory) {
34
35
  Stripe.PACKAGE_VERSION = require('../package.json').version;
35
36
  Stripe.USER_AGENT = Object.assign({ bindings_version: Stripe.PACKAGE_VERSION, lang: 'node', publisher: 'stripe', uname: null, typescript: false }, determineProcessUserAgentProperties());
36
37
  Stripe.StripeResource = StripeResource;
@@ -94,7 +95,7 @@ function createStripe(platformFunctions) {
94
95
  this.webhooks = createWebhooks(platformFunctions);
95
96
  this._prevRequestMetrics = [];
96
97
  this._enableTelemetry = props.telemetry !== false;
97
- this._requestSender = new RequestSender(this, Stripe.StripeResource.MAX_BUFFERED_REQUEST_METRICS);
98
+ this._requestSender = requestSender(this);
98
99
  // Expose StripeResource on the instance too
99
100
  // @ts-ignore
100
101
  this.StripeResource = Stripe.StripeResource;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stripe",
3
- "version": "11.10.0",
3
+ "version": "11.11.0",
4
4
  "description": "Stripe API wrapper",
5
5
  "keywords": [
6
6
  "stripe",
@@ -4,11 +4,13 @@ declare module 'stripe' {
4
4
  namespace Stripe {
5
5
  /**
6
6
  * This is an object representing a Stripe account. You can retrieve it to see
7
- * properties on the account like its current e-mail address or if the account is
8
- * enabled yet to make live charges.
7
+ * properties on the account like its current requirements or if the account is
8
+ * enabled to make live charges or receive payouts.
9
9
  *
10
- * Some properties, marked below, are available only to platforms that want to
11
- * [create and manage Express or Custom accounts](https://stripe.com/docs/connect/accounts).
10
+ * For Custom accounts, the properties below are always returned. For other accounts, some properties are returned until that
11
+ * account has started to go through Connect Onboarding. Once you create an [Account Link](https://stripe.com/docs/api/account_links)
12
+ * for a Standard or Express account, some parameters are no longer returned. These are marked as **Custom Only** or **Custom and Express**
13
+ * below. Learn about the differences [between accounts](https://stripe.com/docs/connect/accounts).
12
14
  */
13
15
  interface Account {
14
16
  /**