Repository navigation
feat(vault): iOS host for the native card fields - #105
Open
Pradeep-kumar1202 wants to merge 5 commits into
Open
Pradeep-kumar1202 wants to merge 5 commits into
Pradeep-kumar1202 wants to merge 5 commits into
Conversation
Pradeep-kumar1202
force-pushed
the
feat/vault-native-ios
branch
from
November 25, 2026 11:00
6031930 to
e7a1493
Compare
Pradeep-kumar1202
force-pushed
the
feat/vault-native-android
branch
from
November 25, 2026 12:05
c2ffeff to
6e60c44
Compare
Pradeep-kumar1202
force-pushed
the
feat/vault-native-ios
branch
from
November 25, 2026 12:05
e7a1493 to
c08bd19
Compare
Pradeep-kumar1202
force-pushed
the
feat/vault-native-android
branch
from
November 30, 2026 04:55
6e60c44 to
223bca7
Compare
Pradeep-kumar1202
force-pushed
the
feat/vault-native-ios
branch
2 times, most recently
from
December 2, 2026 04:58
107a0dc to
381455e
Compare
Pradeep-kumar1202
added a commit
that referenced
this pull request
Dec 2, 2026
… command can see the old ones The form room applied a settings update from native in a passive effect, which runs a moment after the render commits. A tokenize command handled in that moment saw the previous settings, and so the previous session, as current. The update now runs in a layout effect, while the render commits; from then on form.tokenize() (#79's createDetachedCardForm) waits for the Host to draw the new settings, so the command uses the new session. Not covered here: a command that native code sends before the props update has reached the engine at all. Keeping that order is the native hosts' part (#104, #105).
Pradeep-kumar1202
added a commit
that referenced
this pull request
Dec 3, 2026
… command can see the old ones The form room applied a settings update from native in a passive effect, which runs a moment after the render commits. A tokenize command handled in that moment saw the previous settings, and so the previous session, as current. The update now runs in a layout effect, while the render commits; from then on form.tokenize() (#79's createDetachedCardForm) waits for the Host to draw the new settings, so the command uses the new session. Not covered here: a command that native code sends before the props update has reached the engine at all. Keeping that order is the native hosts' part (#104, #105).
Pradeep-kumar1202
force-pushed
the
feat/vault-native-android
branch
from
December 3, 2026 05:51
8f28874 to
5bc745b
Compare
Pradeep-kumar1202
force-pushed
the
feat/vault-native-ios
branch
from
December 3, 2026 05:52
381455e to
c216959
Compare
Pradeep-kumar1202
added a commit
that referenced
this pull request
Dec 3, 2026
… command can see the old ones The form room applied a settings update from native in a passive effect, which runs a moment after the render commits. A tokenize command handled in that moment saw the previous settings, and so the previous session, as current. The update now runs in a layout effect, while the render commits; from then on form.tokenize() (#79's createDetachedCardForm) waits for the Host to draw the new settings, so the command uses the new session. Not covered here: a command that native code sends before the props update has reached the engine at all. Keeping that order is the native hosts' part (#104, #105).
Pradeep-kumar1202
force-pushed
the
feat/vault-native-android
branch
from
December 3, 2026 06:34
5bc745b to
79c5305
Compare
The iOS twin of the Android host: a second React Native factory that runs the vault's own bundle, a form class, the two modules and the field view, in Objective-C++. The field view takes the blur and focus commands the merchant's React Native sends a focused text input. The podspec compiles a stand-in with no engine and no bundle when React Native is below 0.82 or pod install runs with HYPERSWITCH_VAULT_NATIVE_FIELDS=0, and nothing on the old architecture.
…the app, and a delivered tokenize is an unknown outcome RCTReactNativeFactory assumes it is the app's only factory. Creating the vault's raised an uncaught NSException when the app's own factory used a non-Stable release level (Expo exposes it as reactNativeReleaseLevel), and it replaced the app's third-party Fabric component provider and default colour space for the whole process. The vault's factory now uses the app's release level (Info.plist ReactNativeReleaseLevel, as Expo writes it; Stable otherwise), puts the component provider and the colour space back right after it is made, and catches any Objective-C or C++ exception while it is made. A failure is remembered and never retried; the form then fails before it mounts and the fields fall back to plain JavaScript. As on Android, a command that reached the bundle and then timed out, or whose form closed or failed, is refused with "delivered": true, which the merchant's side reports as unknown_outcome.
…nd the stub links on React Native 0.76 HyperswitchVaultHosted is registered for every engine in the app on iOS (codegen's modulesProvider), so code in the merchant's engine could deliver a VAULT_FORM_ERROR to a form root by its tag and push the form to the plain fields. The module now ignores emits from any instance but the one the vault's engine attached. The stub gains HyperswitchVaultFieldViewCls, which React Native 0.76's generated component provider links against by name.
The iOS side of "native card fields only" (the JavaScript is in the commit before this stack's iOS commits). The podspec no longer reads HYPERSWITCH_VAULT_NATIVE_FIELDS; a `pod install` that still sets it is told it is ignored. An app without the new architecture or below React Native 0.82 still builds with the stand-in, and `pod install` now warns that the card fields are not available in it, and why: at run time the card form reports unsupported_configuration and draws no field. The comments that said the forms fall back to plain fields now say what happens instead.
… settings on save - An app on community JavaScriptCore (USE_THIRD_PARTY_JSC=1) gets the stand-in, and pod install says why: React Native's default delegate raises in createJSRuntimeFactory there, which would end the app at the first card field. As a second line of defence, creating the vault engine's root is caught (Objective-C and C++ exceptions), remembered and never retried, and the form reports that it did not start (unsupported_configuration). - A save carries the settings it was accepted with. One queued while the form starts whose settings changed before it could run is refused, unsent (tokenization_failed, try again), as on Android.
Pradeep-kumar1202
force-pushed
the
feat/vault-native-ios
branch
from
December 3, 2026 06:34
c216959 to
8e6bf87
Compare
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.
What
The iOS host for the vault's native card fields: the twin of the Android host in #104.
On iOS too, in a rebuilt app on the new architecture and a tested React Native version (0.82 to 0.88), each card field is a native view whose content runs in the vault's own JavaScript engine. No JavaScript changes here: the choosers, the native form and the native field from #104 are shared.
createDetachedCardForm: one card across separate React rootsEach is based on the one before it. Merge order: #79, #103, #104, #105, then the release pull request (README, release notes, version 2.0.0). Labelled
DO NOT MERGEuntil the stack is ready.How it works
Everything is Objective-C++ in
ios/Source/; there is no Swift, so the pod needs no bridging.HyperswitchVaultEngineRCTReactNativeFactorywith its own delegate, the recipe hyperswitch-sdk-ios already uses for its own second engine. The delegate points it athyperswitch-vault-fields.bundleinside the app (never a development server) and creates the hosted module itself, so the engine knows which instance carries its commandsHyperswitchVaultFormdelivered, which the merchant's side reports asunknown_outcomeHyperswitchVaultFormsModuleHyperswitchVaultHostedModuleHyperswitchVaultFieldViewprepareForRecycle, because React Native reuses native views, and takes theblur/focuscommands the merchant's React Native sends a focused text inputA second factory must not disturb the app.
RCTReactNativeFactoryassumes it is the app's only one: creating another raises if the app's own factory chose a different release level, and it takes over the process-wide third-party component provider and default colour space. So the vault's factory is created with the app's release level (theInfo.plistkeyReactNativeReleaseLevel, which Expo writes;Stableotherwise); the app's component provider and colour space are put back right after; and any Objective-C or C++ exception while creating it is caught, remembered and never retried. The form then fails before it mounts, and the fields render the plain way.Differences from Android: there is no package list (the second host is given what the app links, through
RCTAppDependencyProvider), and a root's tag exists as soon as the root is created. Owners are still matched by tag when an event arrives.Builds without the engine (the podspec decides)
ios/Sourceand the bundle.ios/Stub, the three classes doing nothing, with the module reportingbundled: false. They must exist: React Native's generated code names them for every new-architecture app, and a missing view class would crash the app at start.ios/Empty, one empty file.Files
ios/Source/(12 files),ios/Stub/,ios/Empty/,react-native-hyperswitch-vault.podspecpackage.json(codegenConfig.ios,files),src/specs/HyperswitchVaultFieldViewNativeComponent.ts(iOS no longer excluded)Impact on existing merchants
pod installand a rebuild on a supported app: the native path on iOS, with the same API.Testing
The results below were run before 2 Dec, with the plain fallback and the opt-out switch. Since then the iOS change is the podspec and comments only; the podspec's syntax is checked, a
pod installand device re-run are pending.On a simulator. iPhone 17, iOS 26.5, the same app and the same flows as on Android. On this code, React Native 0.86, release builds:
clear(),reset(),focus()HYPERSWITCH_VAULT_NATIVE_FIELDS=0bundled: false, plain fields, tokenizesUpdating props for Surface, nosdkAuthorization(React Native's other log lines are there)Every React Native version, on this code (the whole stack, both platforms, release builds, one row at a time): 35 of 35 rows pass.
Device logs after the flows: no
Updating props for Surfaceline and nosdkAuthorizationin any of the 80 Android captures, nor on iOS 0.86 and 0.88 (read right after their runs).Not tested
use_frameworks!; the co-badged network picker; VoiceOver; rotation (the test app is portrait-only).Tested since the review (26 and 30 Nov): in the test app (React Native 0.86.3), the form's first
onChangebefore typing, accessibility labels,onReady, the cardholder name field, background and back (the card is kept and tokenizes), memory with one form open (+60 MB) and the time to draw the fields (+0.1 s). The merchant's demo app (S2SDemo, React Native 0.87.1, Debug, its own code unchanged): a saved card's CVC and a new card with the name on it, typed into the native fields (the view tree shows the CVC input inside the vault's own surface); both payments succeeded, and the system log held no card number,sdkAuthorizationor client secret.Not in this PR
HyperswitchVaultFormon the native path.Note for the reviewer
RCT_USE_PREBUILT_RNCORE=0 pod install) it links. An app with that combination fails the same way without the vault.HYPERSWITCH_VAULT_NATIVE_FIELDSwas removed on 2 Dec, with the plain fallback.On iOS the hosted module is also registered in the merchant's engineFixed (014a46e): it is still in Codegen's app-wide list, but only the instance in the vault's own engine carries events; one in any other engine ignores them.014a46e): the stub now hasHyperswitchVaultFieldViewCls, which React Native 0.76's generated code references. Not yet built in a 0.76 app; the README's floor is 0.79.