@stripe/stripe-js 10.0.0-rc.3 → 10.0.0-rc.4

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.
package/dist/index.js CHANGED
@@ -18,42 +18,6 @@ function _typeof(obj) {
18
18
  return _typeof(obj);
19
19
  }
20
20
 
21
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
22
- try {
23
- var info = gen[key](arg);
24
- var value = info.value;
25
- } catch (error) {
26
- reject(error);
27
- return;
28
- }
29
-
30
- if (info.done) {
31
- resolve(value);
32
- } else {
33
- Promise.resolve(value).then(_next, _throw);
34
- }
35
- }
36
-
37
- function _asyncToGenerator(fn) {
38
- return function () {
39
- var self = this,
40
- args = arguments;
41
- return new Promise(function (resolve, reject) {
42
- var gen = fn.apply(self, args);
43
-
44
- function _next(value) {
45
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
46
- }
47
-
48
- function _throw(err) {
49
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
50
- }
51
-
52
- _next(undefined);
53
- });
54
- };
55
- }
56
-
57
21
  var RELEASE_TRAIN = 'endive';
58
22
 
59
23
  var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion(version) {
@@ -107,7 +71,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
107
71
 
108
72
  stripe._registerWrapper({
109
73
  name: 'stripe-js',
110
- version: "10.0.0-rc.3",
74
+ version: "10.0.0-rc.4",
111
75
  startTime: startTime
112
76
  });
113
77
  };
@@ -188,29 +152,12 @@ var loadScript = function loadScript(params) {
188
152
  });
189
153
  };
190
154
 
191
- var retryableLoad = /*#__PURE__*/function () {
192
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
193
- return regeneratorRuntime.wrap(function _callee$(_context) {
194
- while (1) {
195
- switch (_context.prev = _context.next) {
196
- case 0:
197
- return _context.abrupt("return", load()["catch"](function (error) {
198
- stripePromise$1 = null;
199
- return Promise.reject(error);
200
- }));
201
-
202
- case 1:
203
- case "end":
204
- return _context.stop();
205
- }
206
- }
207
- }, _callee);
208
- }));
209
-
210
- return function retryableLoad() {
211
- return _ref.apply(this, arguments);
212
- };
213
- }(); // Resets stripePromise on error
155
+ var retryableLoad = function retryableLoad() {
156
+ return load()["catch"](function (error) {
157
+ stripePromise$1 = null;
158
+ return Promise.reject(error);
159
+ });
160
+ }; // Resets stripePromise on error
214
161
 
215
162
 
216
163
  return retryableLoad()["catch"](function () {
@@ -234,7 +181,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
234
181
  var expectedVersion = RELEASE_TRAIN;
235
182
 
236
183
  if (isTestKey && version !== expectedVersion) {
237
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("10.0.0-rc.3", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
184
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("10.0.0-rc.4", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
238
185
  }
239
186
 
240
187
  var stripe = maybeStripe.apply(undefined, args);
package/dist/index.mjs CHANGED
@@ -14,42 +14,6 @@ function _typeof(obj) {
14
14
  return _typeof(obj);
15
15
  }
16
16
 
17
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
18
- try {
19
- var info = gen[key](arg);
20
- var value = info.value;
21
- } catch (error) {
22
- reject(error);
23
- return;
24
- }
25
-
26
- if (info.done) {
27
- resolve(value);
28
- } else {
29
- Promise.resolve(value).then(_next, _throw);
30
- }
31
- }
32
-
33
- function _asyncToGenerator(fn) {
34
- return function () {
35
- var self = this,
36
- args = arguments;
37
- return new Promise(function (resolve, reject) {
38
- var gen = fn.apply(self, args);
39
-
40
- function _next(value) {
41
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
42
- }
43
-
44
- function _throw(err) {
45
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
46
- }
47
-
48
- _next(undefined);
49
- });
50
- };
51
- }
52
-
53
17
  var RELEASE_TRAIN = 'endive';
54
18
 
55
19
  var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion(version) {
@@ -103,7 +67,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
103
67
 
104
68
  stripe._registerWrapper({
105
69
  name: 'stripe-js',
106
- version: "10.0.0-rc.3",
70
+ version: "10.0.0-rc.4",
107
71
  startTime: startTime
108
72
  });
109
73
  };
@@ -184,29 +148,12 @@ var loadScript = function loadScript(params) {
184
148
  });
185
149
  };
186
150
 
187
- var retryableLoad = /*#__PURE__*/function () {
188
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
189
- return regeneratorRuntime.wrap(function _callee$(_context) {
190
- while (1) {
191
- switch (_context.prev = _context.next) {
192
- case 0:
193
- return _context.abrupt("return", load()["catch"](function (error) {
194
- stripePromise$1 = null;
195
- return Promise.reject(error);
196
- }));
197
-
198
- case 1:
199
- case "end":
200
- return _context.stop();
201
- }
202
- }
203
- }, _callee);
204
- }));
205
-
206
- return function retryableLoad() {
207
- return _ref.apply(this, arguments);
208
- };
209
- }(); // Resets stripePromise on error
151
+ var retryableLoad = function retryableLoad() {
152
+ return load()["catch"](function (error) {
153
+ stripePromise$1 = null;
154
+ return Promise.reject(error);
155
+ });
156
+ }; // Resets stripePromise on error
210
157
 
211
158
 
212
159
  return retryableLoad()["catch"](function () {
@@ -230,7 +177,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
230
177
  var expectedVersion = RELEASE_TRAIN;
231
178
 
232
179
  if (isTestKey && version !== expectedVersion) {
233
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("10.0.0-rc.3", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
180
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("10.0.0-rc.4", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
234
181
  }
235
182
 
236
183
  var stripe = maybeStripe.apply(undefined, args);
package/dist/pure.js CHANGED
@@ -18,42 +18,6 @@ function _typeof(obj) {
18
18
  return _typeof(obj);
19
19
  }
20
20
 
21
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
22
- try {
23
- var info = gen[key](arg);
24
- var value = info.value;
25
- } catch (error) {
26
- reject(error);
27
- return;
28
- }
29
-
30
- if (info.done) {
31
- resolve(value);
32
- } else {
33
- Promise.resolve(value).then(_next, _throw);
34
- }
35
- }
36
-
37
- function _asyncToGenerator(fn) {
38
- return function () {
39
- var self = this,
40
- args = arguments;
41
- return new Promise(function (resolve, reject) {
42
- var gen = fn.apply(self, args);
43
-
44
- function _next(value) {
45
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
46
- }
47
-
48
- function _throw(err) {
49
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
50
- }
51
-
52
- _next(undefined);
53
- });
54
- };
55
- }
56
-
57
21
  var RELEASE_TRAIN = 'endive';
58
22
 
59
23
  var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion(version) {
@@ -107,7 +71,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
107
71
 
108
72
  stripe._registerWrapper({
109
73
  name: 'stripe-js',
110
- version: "10.0.0-rc.3",
74
+ version: "10.0.0-rc.4",
111
75
  startTime: startTime
112
76
  });
113
77
  };
@@ -188,29 +152,12 @@ var loadScript = function loadScript(params) {
188
152
  });
189
153
  };
190
154
 
191
- var retryableLoad = /*#__PURE__*/function () {
192
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
193
- return regeneratorRuntime.wrap(function _callee$(_context) {
194
- while (1) {
195
- switch (_context.prev = _context.next) {
196
- case 0:
197
- return _context.abrupt("return", load()["catch"](function (error) {
198
- stripePromise = null;
199
- return Promise.reject(error);
200
- }));
201
-
202
- case 1:
203
- case "end":
204
- return _context.stop();
205
- }
206
- }
207
- }, _callee);
208
- }));
209
-
210
- return function retryableLoad() {
211
- return _ref.apply(this, arguments);
212
- };
213
- }(); // Resets stripePromise on error
155
+ var retryableLoad = function retryableLoad() {
156
+ return load()["catch"](function (error) {
157
+ stripePromise = null;
158
+ return Promise.reject(error);
159
+ });
160
+ }; // Resets stripePromise on error
214
161
 
215
162
 
216
163
  return retryableLoad()["catch"](function () {
@@ -234,7 +181,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
234
181
  var expectedVersion = RELEASE_TRAIN;
235
182
 
236
183
  if (isTestKey && version !== expectedVersion) {
237
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("10.0.0-rc.3", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
184
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("10.0.0-rc.4", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
238
185
  }
239
186
 
240
187
  var stripe = maybeStripe.apply(undefined, args);
package/dist/pure.mjs CHANGED
@@ -14,42 +14,6 @@ function _typeof(obj) {
14
14
  return _typeof(obj);
15
15
  }
16
16
 
17
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
18
- try {
19
- var info = gen[key](arg);
20
- var value = info.value;
21
- } catch (error) {
22
- reject(error);
23
- return;
24
- }
25
-
26
- if (info.done) {
27
- resolve(value);
28
- } else {
29
- Promise.resolve(value).then(_next, _throw);
30
- }
31
- }
32
-
33
- function _asyncToGenerator(fn) {
34
- return function () {
35
- var self = this,
36
- args = arguments;
37
- return new Promise(function (resolve, reject) {
38
- var gen = fn.apply(self, args);
39
-
40
- function _next(value) {
41
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
42
- }
43
-
44
- function _throw(err) {
45
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
46
- }
47
-
48
- _next(undefined);
49
- });
50
- };
51
- }
52
-
53
17
  var RELEASE_TRAIN = 'endive';
54
18
 
55
19
  var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion(version) {
@@ -103,7 +67,7 @@ var registerWrapper = function registerWrapper(stripe, startTime) {
103
67
 
104
68
  stripe._registerWrapper({
105
69
  name: 'stripe-js',
106
- version: "10.0.0-rc.3",
70
+ version: "10.0.0-rc.4",
107
71
  startTime: startTime
108
72
  });
109
73
  };
@@ -184,29 +148,12 @@ var loadScript = function loadScript(params) {
184
148
  });
185
149
  };
186
150
 
187
- var retryableLoad = /*#__PURE__*/function () {
188
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
189
- return regeneratorRuntime.wrap(function _callee$(_context) {
190
- while (1) {
191
- switch (_context.prev = _context.next) {
192
- case 0:
193
- return _context.abrupt("return", load()["catch"](function (error) {
194
- stripePromise = null;
195
- return Promise.reject(error);
196
- }));
197
-
198
- case 1:
199
- case "end":
200
- return _context.stop();
201
- }
202
- }
203
- }, _callee);
204
- }));
205
-
206
- return function retryableLoad() {
207
- return _ref.apply(this, arguments);
208
- };
209
- }(); // Resets stripePromise on error
151
+ var retryableLoad = function retryableLoad() {
152
+ return load()["catch"](function (error) {
153
+ stripePromise = null;
154
+ return Promise.reject(error);
155
+ });
156
+ }; // Resets stripePromise on error
210
157
 
211
158
 
212
159
  return retryableLoad()["catch"](function () {
@@ -230,7 +177,7 @@ var initStripe = function initStripe(maybeStripe, args, startTime) {
230
177
  var expectedVersion = RELEASE_TRAIN;
231
178
 
232
179
  if (isTestKey && version !== expectedVersion) {
233
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("10.0.0-rc.3", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
180
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("10.0.0-rc.4", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
234
181
  }
235
182
 
236
183
  var stripe = maybeStripe.apply(undefined, args);
@@ -331,6 +331,11 @@ export interface CreatePaymentMethodP24Data extends PaymentMethodCreateParams {
331
331
  };
332
332
  }
333
333
 
334
+ export interface CreatePaymentMethodPayByBankData
335
+ extends PaymentMethodCreateParams {
336
+ type: 'pay_by_bank';
337
+ }
338
+
334
339
  export interface CreatePaymentMethodPayNowData
335
340
  extends PaymentMethodCreateParams {
336
341
  type: 'paynow';
@@ -1232,6 +1237,39 @@ export interface ConfirmP24PaymentData extends PaymentIntentConfirmParams {
1232
1237
  return_url?: string;
1233
1238
  }
1234
1239
 
1240
+ /**
1241
+ * Data to be sent with a `stripe.confirmPayByBankPayment` request.
1242
+ * Refer to the [Payment Intents API](https://stripe.com/docs/api/payment_intents/confirm) for a full list of parameters.
1243
+ */
1244
+ export interface ConfirmPayByBankPaymentData
1245
+ extends PaymentIntentConfirmParams {
1246
+ /**
1247
+ * Either the `id` of an existing [PaymentMethod](https://stripe.com/docs/api/payment_methods), or an object containing data to create a `PaymentMethod` with.
1248
+ * This field is optional if a `PaymentMethod` has already been attached to this `PaymentIntent`.
1249
+ *
1250
+ * @recommended
1251
+ */
1252
+ payment_method?: string | Omit<CreatePaymentMethodPayByBankData, 'type'>;
1253
+
1254
+ /**
1255
+ * The url your customer will be directed to after they complete authentication.
1256
+ *
1257
+ * @recommended
1258
+ */
1259
+ return_url?: string;
1260
+ }
1261
+
1262
+ /**
1263
+ * An options object to control the behavior of `stripe.confirmPayByBankPayment`.
1264
+ */
1265
+ export interface ConfirmPayByBankPaymentOptions {
1266
+ /**
1267
+ * Set this to `false` if you want to manually handle the authorization redirect.
1268
+ * Default is `true`.
1269
+ */
1270
+ handleActions?: boolean;
1271
+ }
1272
+
1235
1273
  /**
1236
1274
  * Data to be sent with a `stripe.confirmPayNowPayment` request.
1237
1275
  * Refer to the [Payment Intents API](https://stripe.com/docs/api/payment_intents/confirm) for a full list of parameters.
@@ -331,6 +331,11 @@ export interface CreatePaymentMethodP24Data extends PaymentMethodCreateParams {
331
331
  };
332
332
  }
333
333
 
334
+ export interface CreatePaymentMethodPayByBankData
335
+ extends PaymentMethodCreateParams {
336
+ type: 'pay_by_bank';
337
+ }
338
+
334
339
  export interface CreatePaymentMethodPayNowData
335
340
  extends PaymentMethodCreateParams {
336
341
  type: 'paynow';
@@ -1232,6 +1237,39 @@ export interface ConfirmP24PaymentData extends PaymentIntentConfirmParams {
1232
1237
  return_url?: string;
1233
1238
  }
1234
1239
 
1240
+ /**
1241
+ * Data to be sent with a `stripe.confirmPayByBankPayment` request.
1242
+ * Refer to the [Payment Intents API](https://stripe.com/docs/api/payment_intents/confirm) for a full list of parameters.
1243
+ */
1244
+ export interface ConfirmPayByBankPaymentData
1245
+ extends PaymentIntentConfirmParams {
1246
+ /**
1247
+ * Either the `id` of an existing [PaymentMethod](https://stripe.com/docs/api/payment_methods), or an object containing data to create a `PaymentMethod` with.
1248
+ * This field is optional if a `PaymentMethod` has already been attached to this `PaymentIntent`.
1249
+ *
1250
+ * @recommended
1251
+ */
1252
+ payment_method?: string | Omit<CreatePaymentMethodPayByBankData, 'type'>;
1253
+
1254
+ /**
1255
+ * The url your customer will be directed to after they complete authentication.
1256
+ *
1257
+ * @recommended
1258
+ */
1259
+ return_url?: string;
1260
+ }
1261
+
1262
+ /**
1263
+ * An options object to control the behavior of `stripe.confirmPayByBankPayment`.
1264
+ */
1265
+ export interface ConfirmPayByBankPaymentOptions {
1266
+ /**
1267
+ * Set this to `false` if you want to manually handle the authorization redirect.
1268
+ * Default is `true`.
1269
+ */
1270
+ handleActions?: boolean;
1271
+ }
1272
+
1235
1273
  /**
1236
1274
  * Data to be sent with a `stripe.confirmPayNowPayment` request.
1237
1275
  * Refer to the [Payment Intents API](https://stripe.com/docs/api/payment_intents/confirm) for a full list of parameters.
@@ -496,6 +496,24 @@ export interface Stripe {
496
496
  options?: paymentIntents.ConfirmP24PaymentOptions
497
497
  ): Promise<PaymentIntentResult>;
498
498
 
499
+ /**
500
+ * Use `stripe.confirmPayByBankPayment` in the [Pay by Bank Payments](https://docs.stripe.com/payments/pay-by-bank) with Payment Methods flow when the customer submits your payment form.
501
+ * When called, it will confirm the `PaymentIntent` with `data` you provide, and it will automatically redirect the customer to authorize the transaction.
502
+ * Once authorization is complete, the customer will be redirected back to your specified `return_url`.
503
+ * Refer to our [integration guide](https://docs.stripe.com/payments/pay-by-bank) for more details.
504
+ *
505
+ * When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](https://stripe.com/docs/api/payment_methods).
506
+ * In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new PaymentMethod for you.
507
+ * If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data.
508
+ *
509
+ * @docs https://stripe.com/docs/js/payment_intents/confirm_pay_by_bank_payment
510
+ */
511
+ confirmPayByBankPayment(
512
+ clientSecret: string,
513
+ data?: paymentIntents.ConfirmPayByBankPaymentData,
514
+ options?: paymentIntents.ConfirmPayByBankPaymentOptions
515
+ ): Promise<PaymentIntentResult>;
516
+
499
517
  /**
500
518
  * Requires beta access:
501
519
  * Contact [Stripe support](https://support.stripe.com/) for more information.
@@ -496,6 +496,24 @@ export interface Stripe {
496
496
  options?: paymentIntents.ConfirmP24PaymentOptions
497
497
  ): Promise<PaymentIntentResult>;
498
498
 
499
+ /**
500
+ * Use `stripe.confirmPayByBankPayment` in the [Pay by Bank Payments](https://docs.stripe.com/payments/pay-by-bank) with Payment Methods flow when the customer submits your payment form.
501
+ * When called, it will confirm the `PaymentIntent` with `data` you provide, and it will automatically redirect the customer to authorize the transaction.
502
+ * Once authorization is complete, the customer will be redirected back to your specified `return_url`.
503
+ * Refer to our [integration guide](https://docs.stripe.com/payments/pay-by-bank) for more details.
504
+ *
505
+ * When you confirm a `PaymentIntent`, it needs to have an attached [PaymentMethod](https://stripe.com/docs/api/payment_methods).
506
+ * In addition to confirming the `PaymentIntent`, this method can automatically create and attach a new PaymentMethod for you.
507
+ * If you have already attached a `PaymentMethod` you can call this method without needing to provide any additional data.
508
+ *
509
+ * @docs https://stripe.com/docs/js/payment_intents/confirm_pay_by_bank_payment
510
+ */
511
+ confirmPayByBankPayment(
512
+ clientSecret: string,
513
+ data?: paymentIntents.ConfirmPayByBankPaymentData,
514
+ options?: paymentIntents.ConfirmPayByBankPaymentOptions
515
+ ): Promise<PaymentIntentResult>;
516
+
499
517
  /**
500
518
  * Requires beta access:
501
519
  * Contact [Stripe support](https://support.stripe.com/) for more information.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stripe/stripe-js",
3
- "version": "10.0.0-rc.3",
3
+ "version": "10.0.0-rc.4",
4
4
  "description": "Stripe.js loading utility",
5
5
  "repository": "github:stripe/stripe-js",
6
6
  "main": "lib/index.js",
package/src/shared.ts CHANGED
@@ -154,7 +154,7 @@ export const loadScript = (
154
154
  }
155
155
  });
156
156
 
157
- const retryableLoad = async () =>
157
+ const retryableLoad = () =>
158
158
  load().catch((error) => {
159
159
  stripePromise = null;
160
160
  return Promise.reject(error);