@paystack/inline-js 2.26.0-dev.4 → 2.26.0-dev.5

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/README.md CHANGED
@@ -139,7 +139,7 @@ This method starts a new transaction on the checkout form.
139
139
  | lastName | False | `String` | The last name of the customer |
140
140
  | phone | False | `String` | The phone number of the customer |
141
141
  | customerCode | False | `String` | A valid Paystack customer code. If provided, this overrides all the customer information above |
142
- | channels | False | `Array` | An array of payment channels to use. By default, all options available in PaystackPop.CHANNELS are used. `google_pay` has to be passed alongside `card`. On its own the transaction will not initialize |
142
+ | channels | False | `Array` | An array of payment channels to use. By default, all options available in PaystackPop.CHANNELS are used. `google_pay` has to be passed alongside `card`. On its own the transaction will not initialize. Pass `card` with `apple_pay` too, so customers whose device cannot use the wallet can still pay |
143
143
  | paymentRequest | False | `String` | A valid Paystack payment request id |
144
144
  | paymentPage | False | `String` | A valid Paystack payment page id |
145
145
  | metadata | False | Object | A valid object of extra information that you want to be saved to the transaction. To show this on the dashboard, see [Seeing your metadata on the dashboard](#tip-seeing-your-metadata-on-the-dashboard) |
@@ -467,7 +467,7 @@ async function loadPaymentRequestButtons() {
467
467
  email: 'testuser@paystack.com',
468
468
  amount: 10000,
469
469
  currency: "NGN",
470
- // google_pay needs card alongside it to show
470
+ // pass card alongside the wallets: google_pay needs it, apple_pay falls back to it
471
471
  channels: ["card", "apple_pay", "google_pay"],
472
472
  container: 'payment-request-buttons',
473
473
  loadPaystackCheckoutButton: 'pay-button',
package/dist/inline.js CHANGED
@@ -2031,6 +2031,13 @@ var PaystackPop = (function () {
2031
2031
  return Promise.resolve();
2032
2032
  }
2033
2033
  this.isCharging = true;
2034
+ var notifyMerchant = function notifyMerchant(notify) {
2035
+ try {
2036
+ notify();
2037
+ } catch (error) {
2038
+ logWarning("Google Pay: a merchant callback threw. ".concat(error && error.message || error));
2039
+ }
2040
+ };
2034
2041
  try {
2035
2042
  var analyticsPayload = {
2036
2043
  channel: CHANNELS.GOOGLE_PAY,
@@ -2042,13 +2049,6 @@ var PaystackPop = (function () {
2042
2049
  paymentMethod: paymentMethod
2043
2050
  }));
2044
2051
  var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response));
2045
- var notifyMerchant = function notifyMerchant(notify) {
2046
- try {
2047
- notify();
2048
- } catch (error) {
2049
- logWarning("Google Pay: a merchant callback threw. ".concat(error && error.message || error));
2050
- }
2051
- };
2052
2052
  return client.loadPaymentData(buildPaymentDataRequest(transaction)).then(function (paymentData) {
2053
2053
  toggleGooglePayLoadingState(_this4.paymentRequestContainer, true);
2054
2054
  return chargeGooglePay({
@@ -2119,7 +2119,9 @@ var PaystackPop = (function () {
2119
2119
  });
2120
2120
  } catch (error) {
2121
2121
  this.isCharging = false;
2122
- transaction.onSetupError(error);
2122
+ notifyMerchant(function () {
2123
+ return transaction.onSetupError(error);
2124
+ });
2123
2125
  return Promise.resolve();
2124
2126
  }
2125
2127
  } else {
package/es/inline.js CHANGED
@@ -2028,6 +2028,13 @@ var Inline = /*#__PURE__*/function () {
2028
2028
  return Promise.resolve();
2029
2029
  }
2030
2030
  this.isCharging = true;
2031
+ var notifyMerchant = function notifyMerchant(notify) {
2032
+ try {
2033
+ notify();
2034
+ } catch (error) {
2035
+ logWarning("Google Pay: a merchant callback threw. ".concat(error && error.message || error));
2036
+ }
2037
+ };
2031
2038
  try {
2032
2039
  var analyticsPayload = {
2033
2040
  channel: CHANNELS.GOOGLE_PAY,
@@ -2039,13 +2046,6 @@ var Inline = /*#__PURE__*/function () {
2039
2046
  paymentMethod: paymentMethod
2040
2047
  }));
2041
2048
  var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response));
2042
- var notifyMerchant = function notifyMerchant(notify) {
2043
- try {
2044
- notify();
2045
- } catch (error) {
2046
- logWarning("Google Pay: a merchant callback threw. ".concat(error && error.message || error));
2047
- }
2048
- };
2049
2049
  return client.loadPaymentData(buildPaymentDataRequest(transaction)).then(function (paymentData) {
2050
2050
  toggleGooglePayLoadingState(_this4.paymentRequestContainer, true);
2051
2051
  return chargeGooglePay({
@@ -2116,7 +2116,9 @@ var Inline = /*#__PURE__*/function () {
2116
2116
  });
2117
2117
  } catch (error) {
2118
2118
  this.isCharging = false;
2119
- transaction.onSetupError(error);
2119
+ notifyMerchant(function () {
2120
+ return transaction.onSetupError(error);
2121
+ });
2120
2122
  return Promise.resolve();
2121
2123
  }
2122
2124
  } else {
package/lib/inline.js CHANGED
@@ -2030,6 +2030,13 @@ var Inline = /*#__PURE__*/function () {
2030
2030
  return Promise.resolve();
2031
2031
  }
2032
2032
  this.isCharging = true;
2033
+ var notifyMerchant = function notifyMerchant(notify) {
2034
+ try {
2035
+ notify();
2036
+ } catch (error) {
2037
+ logWarning("Google Pay: a merchant callback threw. ".concat(error && error.message || error));
2038
+ }
2039
+ };
2033
2040
  try {
2034
2041
  var analyticsPayload = {
2035
2042
  channel: CHANNELS.GOOGLE_PAY,
@@ -2041,13 +2048,6 @@ var Inline = /*#__PURE__*/function () {
2041
2048
  paymentMethod: paymentMethod
2042
2049
  }));
2043
2050
  var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response));
2044
- var notifyMerchant = function notifyMerchant(notify) {
2045
- try {
2046
- notify();
2047
- } catch (error) {
2048
- logWarning("Google Pay: a merchant callback threw. ".concat(error && error.message || error));
2049
- }
2050
- };
2051
2051
  return client.loadPaymentData(buildPaymentDataRequest(transaction)).then(function (paymentData) {
2052
2052
  toggleGooglePayLoadingState(_this4.paymentRequestContainer, true);
2053
2053
  return chargeGooglePay({
@@ -2118,7 +2118,9 @@ var Inline = /*#__PURE__*/function () {
2118
2118
  });
2119
2119
  } catch (error) {
2120
2120
  this.isCharging = false;
2121
- transaction.onSetupError(error);
2121
+ notifyMerchant(function () {
2122
+ return transaction.onSetupError(error);
2123
+ });
2122
2124
  return Promise.resolve();
2123
2125
  }
2124
2126
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paystack/inline-js",
3
- "version": "2.26.0-dev.4",
3
+ "version": "2.26.0-dev.5",
4
4
  "description": "Client-side library to load the Paystack checkout form",
5
5
  "packageManager": "pnpm@10.33.4+sha512.1c67b3b359b2d408119ba1ed289f34b8fc3c6873412bec6fd264fbdc82489e510fcbecb9ce9d22dae7f3b76269d8441046014bdca53b9979cd7a561ad631b800",
6
6
  "main": "lib/inline.js",