@flopay/react 1.2.6 → 1.2.7

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.cjs CHANGED
@@ -4446,11 +4446,13 @@ async function processSavedPaymentForMode({
4446
4446
  billingApiUrl,
4447
4447
  sessionId,
4448
4448
  session,
4449
+ nonce,
4449
4450
  tokenizedData,
4450
4451
  returnUrl
4451
4452
  }) {
4452
4453
  const baseUrl = billingApiUrl.replace(/\/+$/, "");
4453
4454
  const resolvedSessionId = sessionId ?? session.id;
4455
+ const resolvedNonce = nonce ?? session.clientSecret;
4454
4456
  const customerId = session.customer?.id ?? session.accountData?.userId ?? "";
4455
4457
  const customerEmail = session.customer?.email ?? session.accountData?.email ?? "";
4456
4458
  const firstName = session.customer?.firstName ?? session.accountData?.firstName ?? "";
@@ -4460,7 +4462,7 @@ async function processSavedPaymentForMode({
4460
4462
  const api = new import_js3.PaymentAPI(baseUrl);
4461
4463
  const response = await retryOnceOnFetchFailure(() => api.processPayment(customerId, {
4462
4464
  sessionId: resolvedSessionId,
4463
- nonce: session.clientSecret,
4465
+ nonce: resolvedNonce,
4464
4466
  tokenizedData,
4465
4467
  accountData: {
4466
4468
  userId: customerId,
@@ -4503,7 +4505,7 @@ async function processSavedPaymentForMode({
4503
4505
  const recoveredRedirect = await recover3DSRedirectResult({
4504
4506
  billingApiUrl: baseUrl,
4505
4507
  sessionId: resolvedSessionId,
4506
- nonce: session.clientSecret,
4508
+ nonce: resolvedNonce,
4507
4509
  responseJson: json
4508
4510
  });
4509
4511
  if (recoveredRedirect) {
@@ -6681,6 +6683,7 @@ function resolveCreateSessionDraft(props) {
6681
6683
  }
6682
6684
  function FloPayAutomaticPaymentButton({
6683
6685
  sessionId,
6686
+ nonce,
6684
6687
  createSession,
6685
6688
  // Deprecated — accepted for back-compat and silently ignored. Backend
6686
6689
  // resolves the customer's latest payment method server-side.
@@ -6812,6 +6815,7 @@ function FloPayAutomaticPaymentButton({
6812
6815
  if (!session) {
6813
6816
  throw new import_shared11.FloPayError("No session data returned", "api_error");
6814
6817
  }
6818
+ const effectiveNonce = session.clientSecret || nonce;
6815
6819
  if (session.status === "complete") {
6816
6820
  await showSuccess({
6817
6821
  result: { status: "succeeded" },
@@ -6867,7 +6871,8 @@ function FloPayAutomaticPaymentButton({
6867
6871
  const result = await processSavedPaymentForMode({
6868
6872
  billingApiUrl: resolvedBillingUrl,
6869
6873
  sessionId: resolvedSessionId ?? session.id,
6870
- session
6874
+ session,
6875
+ nonce: effectiveNonce
6871
6876
  });
6872
6877
  if (result.type !== "success") {
6873
6878
  throw checkoutProcessErrorToFloPayError(
@@ -6894,11 +6899,13 @@ function FloPayAutomaticPaymentButton({
6894
6899
  if (shouldShowFallbackCheckout(floPayErr, fallbackSessionId) && fallbackSessionId && isMountedRef.current) {
6895
6900
  setFallbackSession({
6896
6901
  sessionId: fallbackSessionId,
6897
- errorMessage: floPayErr.message
6902
+ errorMessage: floPayErr.message,
6903
+ nonce: effectiveNonce || void 0
6898
6904
  });
6899
6905
  }
6900
6906
  }
6901
6907
  }, [
6908
+ nonce,
6902
6909
  resolvedBillingUrl,
6903
6910
  showError,
6904
6911
  showSuccess
@@ -6939,7 +6946,7 @@ function FloPayAutomaticPaymentButton({
6939
6946
  try {
6940
6947
  const api = new import_js7.PaymentAPI(resolvedBillingUrl);
6941
6948
  if (sessionId) {
6942
- const result = await api.getUnifiedCheckoutSession(sessionId);
6949
+ const result = await api.getUnifiedCheckoutSession(sessionId, nonce);
6943
6950
  await processResolvedSession(result, sessionId);
6944
6951
  return;
6945
6952
  }
@@ -6978,6 +6985,7 @@ function FloPayAutomaticPaymentButton({
6978
6985
  createSessionDraft,
6979
6986
  disabled,
6980
6987
  isProcessing,
6988
+ nonce,
6981
6989
  processResolvedSession,
6982
6990
  resolvedBillingUrl,
6983
6991
  sessionId,
@@ -7112,6 +7120,7 @@ function FloPayAutomaticPaymentButton({
7112
7120
  FloPayCheckout,
7113
7121
  {
7114
7122
  sessionId: fallbackSession.sessionId,
7123
+ nonce: fallbackSession.nonce,
7115
7124
  checkoutMode: "full",
7116
7125
  billingApiUrl: resolvedBillingUrl,
7117
7126
  locale,