diff --git a/src/Payments/ApplePay.res b/src/Payments/ApplePay.res index 17b17518b..8bcfa300a 100644 --- a/src/Payments/ApplePay.res +++ b/src/Payments/ApplePay.res @@ -54,7 +54,7 @@ let make = ( let isGuestCustomer = UtilityHooks.useIsGuestCustomer() - let processPayment = bodyArr => { + let processPayment = (bodyArr, isThirdPartyFlow) => { let requestBody = PaymentUtils.appendedCustomerAcceptance( ~isGuestCustomer, ~paymentType=list.payment_type, @@ -69,6 +69,7 @@ let make = ( publishableKey, }, ~handleUserError=true, + ~isThirdPartyFlow, (), ) } else { @@ -86,6 +87,7 @@ let make = ( publishableKey, }, ~handleUserError=true, + ~isThirdPartyFlow, (), ) } @@ -264,14 +266,14 @@ let make = ( if isDelayedSessionToken { setShowApplePayLoader(_ => true) let bodyDict = PaymentBody.applePayThirdPartySdkBody(~connectors) - processPayment(bodyDict) + processPayment(bodyDict, true) } else { let message = [("applePayButtonClicked", true->JSON.Encode.bool)] Utils.handlePostMessage(message) } } else { let bodyDict = PaymentBody.applePayRedirectBody(~connectors) - processPayment(bodyDict) + processPayment(bodyDict, false) } } else { setApplePayClicked(_ => false) @@ -295,7 +297,7 @@ let make = ( let token = dict->Dict.get("applePayProcessPayment")->Option.getOr(Dict.make()->JSON.Encode.object) let bodyDict = PaymentBody.applePayBody(~token, ~connectors) - processPayment(bodyDict) + processPayment(bodyDict, false) } else if dict->Dict.get("showApplePayButton")->Option.isSome { setApplePayClicked(_ => false) if !isWallet { diff --git a/src/Payments/GPay.res b/src/Payments/GPay.res index 950563161..83b361856 100644 --- a/src/Payments/GPay.res +++ b/src/Payments/GPay.res @@ -66,7 +66,7 @@ let make = ( ->Option.getOr(false) }, [thirdPartySessionObj]) - let processPayment = (body: array<(string, JSON.t)>) => { + let processPayment = (body: array<(string, JSON.t)>, isThirdPartyFlow) => { intent( ~bodyArr=body, ~confirmParam={ @@ -74,6 +74,7 @@ let make = ( publishableKey, }, ~handleUserError=true, + ~isThirdPartyFlow, (), ) } @@ -103,7 +104,7 @@ let make = ( ->mergeTwoFlattenedJsonDicts(requiredFieldsBody) ->getArrayOfTupleFromDict } - processPayment(body) + processPayment(body, false) } if dict->Dict.get("gpayError")->Option.isSome { Utils.handlePostMessage([("fullscreen", false->JSON.Encode.bool)]) @@ -157,7 +158,7 @@ let make = ( ("iframeId", iframeId->JSON.Encode.string), ]) let bodyDict = PaymentBody.gPayThirdPartySdkBody(~connectors) - processPayment(bodyDict) + processPayment(bodyDict, true) } else { handlePostMessage([ ("fullscreen", true->JSON.Encode.bool), @@ -168,7 +169,7 @@ let make = ( } } else { let bodyDict = PaymentBody.gpayRedirectBody(~connectors) - processPayment(bodyDict) + processPayment(bodyDict, false) } } resolve() diff --git a/src/Utilities/PaymentHelpers.res b/src/Utilities/PaymentHelpers.res index 73bf1b756..343ffc71e 100644 --- a/src/Utilities/PaymentHelpers.res +++ b/src/Utilities/PaymentHelpers.res @@ -908,6 +908,7 @@ let usePaymentIntent = (optLogger, paymentType) => { ~bodyArr: array<(string, JSON.t)>, ~confirmParam: ConfirmType.confirmParams, ~iframeId=keys.iframeId, + ~isThirdPartyFlow=false, (), ) => { switch keys.clientSecret { @@ -925,7 +926,7 @@ let usePaymentIntent = (optLogger, paymentType) => { ]) let endpoint = ApiEndpoint.getApiEndPoint( ~publishableKey=confirmParam.publishableKey, - ~isConfirmCall=true, + ~isConfirmCall=!isThirdPartyFlow, (), ) let uri = `${endpoint}/payments/${paymentIntentID}/confirm`