fix: sdk authorization dependency across all the flows#1576
Merged
Conversation
AbhishekChorotiya
approved these changes
May 19, 2026
ArushKapoorJuspay
approved these changes
May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
#1575
After an
updateIntentflow completes, the SDK returns a newsdkAuthorization. All subsequent confirm calls must use this updated token. Inside the iframe,usePaymentIntentreadssdkAuthorizationfrom the Recoilkeysatom at render time and closes over it in the returnedintentfunction. Each payment method component memoizes itssubmitCallbackviaReact.useCallback— ifsdkAuthorizationis not in the dependency array, the callback captures a staleintentwith the old token even after the Recoil atom is updated.Root cause:
sdkAuthorizationwas missing from theuseCallbackdependency array in all payment methodsubmitCallbackhooks. This caused the confirm API call to be made with the pre-updateIntentauthorization token, resulting in an auth failure.Fix: Added
sdkAuthorization(from thekeysRecoil atom) to theuseCallbackdependency array in all affected payment method components. For components that did not already destructuresdkAuthorizationfromkeys, the destructuring was updated accordingly.How did you test it?
Tested manually using the Hyperswitch React Demo App:
elements.updateIntent(...)thenhyper.confirmPayment(...)sdkAuthorization, resulting in an auth errorsdkAuthorizationreturned byupdateIntent, payment proceeded successfullyAlso verified the same flow with Trustly (no required fields) and other bank redirect / bank debit / bank transfer payment methods continued to work correctly.
Screen.Recording.2026-05-19.at.10.47.06.PM.mov
Checklist
npm run re:build