feat: added react wrapper for payment methods management#8
Merged
ArushKapoorJuspay merged 5 commits intomainfrom Jan 14, 2026
Merged
feat: added react wrapper for payment methods management#8ArushKapoorJuspay merged 5 commits intomainfrom
ArushKapoorJuspay merged 5 commits intomainfrom
Conversation
aritro2002
reviewed
Jan 12, 2026
aritro2002
reviewed
Jan 13, 2026
|
|
||
| module PaymentMethodsManagementSwitchContextProvider = { | ||
| let make = React.Context.provider(paymentMethodsManagementSwitchContext) | ||
| let make = React.Context.provider(switchContext) |
There was a problem hiding this comment.
let defaultPaymentMethodsManagementSwitchContext = {
ephemeralKey: "",
paymentRequest,
}
do we need to add ephemeralKey: "" in defaultSwitchContext?
Contributor
Author
There was a problem hiding this comment.
I checked and tested this so we do not need the switch context to have this value since its not needed and used
cc: @ArushKapoorJuspay
aritro2002
reviewed
Jan 13, 2026
Comment on lines
+22
to
+30
| let switchValClone: Context.switchContextType = { | ||
| confirmPayment: switchInstance.confirmPayment, | ||
| confirmCardPayment: switchInstance.confirmCardPayment, | ||
| retrievePaymentIntent: switchInstance.retrievePaymentIntent, | ||
| clientSecret: "", | ||
| paymentRequest: switchInstance.paymentRequest, | ||
| ephemeralKey: paymentMethodsManagementElementOptions.ephemeralKey, | ||
| completeUpdateIntent: switchInstance.completeUpdateIntent, | ||
| initiateUpdateIntent: switchInstance.initiateUpdateIntent, | ||
| confirmTokenization: switchInstance.confirmTokenization, |
Contributor
Author
There was a problem hiding this comment.
On testing this i found out that even though we have client secret value but its not needed or consumed anywhere since its provided in element options and not from the switch context, so we do not need to add the ephemeral key here since its not needed
cc: @ArushKapoorJuspay
aritro2002
approved these changes
Jan 13, 2026
AbhishekChorotiya
approved these changes
Jan 13, 2026
src/Context.res
Outdated
| paymentRequest, | ||
| completeUpdateIntent: _ => Promise.resolve(Dict.make()->JSON.Encode.object), | ||
| initiateUpdateIntent: _ => Promise.resolve(Dict.make()->JSON.Encode.object), | ||
| confirmTokenization: confirmTokenizationFn, |
Collaborator
There was a problem hiding this comment.
Suggested change
| confirmTokenization: confirmTokenizationFn, | |
| confirmTokenization: _ => Promise.resolve(Dict.make()->JSON.Encode.object), |
ArushKapoorJuspay
approved these changes
Jan 14, 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
Made the changes for Exposing
ConfirmTokenizationcallback for Payment Methods ManagementOld Approach (Not used now)
useHyperhook from the react wrapper for PMM as well which leads to exposing of default Payments Switch context from the wrapper, So we were not able to get the PMM Context during Integration and always getting the default switch instance of payments.useHyperManagementhook to expose the PMM Context on the merchant side and fixed theHyperManagementMethodsswitch instance to expose all the methods correctlyNew approach
How did you test it?
tested via generating the build of the wrapper and putting in local react demo app for consuming it.
reference video -
Screen.Recording.2026-01-12.at.5.49.40.PM.mov
V1 Test -
Screen.Recording.2026-01-12.at.6.27.16.PM.mov
Usage Notes
New entry point added for Payment methods management react integration
Version Update
package.jsonfollowing semantic versioning:x.x.xfor major changes (breaking).1.3.4for minor changes (new feature, no breaking changes).x.x.xfor patch changes (bug fixes, minor improvements).Checklist
npm run re:buildand verified the build artifacts.Screenshots or Logs
Added Screen Recording