Integrating the Hyperswitch web checkout with React: what it involves
Integrating the Hyperswitch web checkout with React means your React app mounts the payment element in the browser while your REST backend creates and confirms each payment on the server. If you run a React front end and a REST backend and want to accept cards and other methods through a self-hosted Hyperswitch stack, this is the pattern to plan for. Hyperswitch is open source under Apache 2.0, and its documentation covers client SDKs for web, Android, iOS, React Native and Flutter, so the web SDK is one of several client options rather than a fixed requirement. The browser never holds your secret API key. Your backend calls the Hyperswitch payments API with that key, receives a client secret for the payment, and passes that value to the front end, which uses it to render the unified checkout and collect the customer's details.
The split matters for scope. On the server, you own the endpoint that creates the payment, the amount and currency validation, the order record that links to the payment, and the handling of status updates, which should come from webhooks rather than from the browser alone. In React, you own the component that loads the SDK, the payment element mount point, the confirmation step, and the screens for success, pending and failed results. Errors arrive in several forms, from validation failures in the form to declined authorizations and network timeouts, and each needs a defined user message and a server-side reconciliation step. Confirm with your team which SDK version matches your self-hosted router version before you write code, because the web client and the server must be on compatible releases.
Choose this integration when you want Hyperswitch's own checkout UI with payment method selection, and your app can host a React component and a backend endpoint. A headless approach fits teams that want to build their own card fields and accept the added PCI scope that follows. A payment link fits when you want no front-end build at all. Decide early, because switching later changes the server contract and the front-end code. Ask your implementation partner or internal team to document the client secret flow, the return URL handling and the webhook events they will act on, and confirm each one against the Hyperswitch docs for your deployed version.
The secret key stays on the server while the browser only receives the client secret
The flow starts when a shopper clicks pay in the React app. The React app calls your customer backend, which creates the payment on the self-hosted Hyperswitch router using the secret key. The router returns a client secret, which is the only payment credential the browser receives, and the React app uses it to mount the payment element. Check that the secret key never appears in the browser bundle or network responses, and that webhooks reach your backend to confirm the final result.
Trust boundary: only the client secret crosses to the browser, never the secret key.
Which configuration choices fit your React checkout
This table compares the main configuration choices for a React checkout on a self-hosted Hyperswitch stack, from the UI model to where the SDK assets and backend come from. Read each row for when the option fits and what it changes for your team, then choose the combination your release process can support.
| Choice | When it fits | What it changes for the team |
|---|---|---|
| Prebuilt unified checkout | Teams that want Hyperswitch to render payment methods and handle the card fields with minimal front-end work | Less UI code to maintain, but styling and layout changes are limited to what the SDK exposes. Card data still flows through Hyperswitch-hosted fields. |
| Headless checkout | Teams with a custom design system that need full control over the payment form | Your team builds and tests the card fields and their flow, which changes the PCI scope analysis. Confirm the current headless SDK requirements with Hyperswitch before committing. |
| Hyperswitch default SDK assets | Proofs of concept and sandbox testing where speed matters more than version control | Fewer build steps, but the client version is set by the hosted assets rather than by your release cycle, so you must confirm which version you receive. |
| Self-hosted web SDK client | Production stacks that need control over client versions, release timing and content security policy | Your pipeline builds and hosts the client, so every upgrade must be tested with it. The client must match the app server version. |
| Pointing the SDK at a self-hosted backend | Organizations that keep payment data and API traffic inside their own infrastructure | Requires custom API URLs and a publishable key per environment. Test each environment separately before go-live. |
| Server-side payment creation | Any production integration, since the API key must never reach the browser | Your backend creates the payment and returns only the client secret to React. This adds an API endpoint your team must secure and monitor. |
| Version pinning across the stack | Teams that upgrade on a schedule with compatibility checks | Check the compatibility matrix in each Hyperswitch release for Control Center and web client versions before moving the app server or SDK. |
How to build the React checkout step by step
This sequence takes a React app from an empty Hyperswitch environment to a working checkout that creates payments on the server, mounts the payment element and treats webhooks as the record of what happened.
Confirm a Hyperswitch environment to build against
Start with the Docker-based local setup or the hosted sandbox, whichever your team can reach first, so the React work has a live backend to call. Your platform or backend engineers do this, and a self-hosted deployment in your own infrastructure follows once the integration logic is proven. You know it is done when a health request to the local or sandbox API returns a success response and you can open the Control Center for that environment. Confirm the Hyperswitch version you run in the Hyperswitch release notes before you pick client SDK versions, because the server and client need to match.
Create merchant account and API keys
In the Control Center, create or select a merchant account, connect at least one test processor connector, and generate the API key the server will use. Record the publishable key separately, since the browser needs only that key and must never receive the secret key. The output is a stored secret key in your server's secret manager or environment, and a publishable key your React app can read from configuration. Check this by confirming the publishable key and secret key are different values and that neither appears in your React source or build output.
Add a server endpoint that creates the payment
Build a backend route, for example a POST handler your React app calls when the customer reaches checkout, that sends the order amount, currency and a unique merchant order reference to the Hyperswitch payments API with the secret key. The server returns only the client secret and payment identifier from the response to the browser. Your backend team owns this endpoint, and it must derive the amount from your own order record rather than from the browser. Verify it by calling the endpoint with a test order and confirming the response contains a client secret but no secret key or processor credentials.
Load the web SDK in React
Add the Hyperswitch web SDK to the React project using the version that matches your deployed server, and initialize it once with the publishable key and the environment URL for your sandbox or self-hosted backend. Keep initialization in a single provider or module so that re-renders do not create duplicate instances. Check the SDK version against the compatibility matrix in the release notes for your server version. You know the step is complete when the app loads without console errors and the SDK object is available to your checkout component.
Mount the payment element with the client secret
Fetch the client secret from your server endpoint when the checkout page mounts, then create the payment element with that secret and mount it into a container in the page. Handle the loading and error states explicitly so the customer sees a clear message if the secret request fails. Confirm that the element renders in the sandbox and that a test card number loaded from the sandbox documentation can be entered. The check is a visible payment form that accepts test input and sends no card data to your own server.
Handle the return and status in the browser
After the customer submits, the SDK returns a status to the browser, and your app should route to a success, pending or failure page based on that status and the payment identifier in the return URL. Treat this browser result as a prompt to show the right screen, not as proof of payment, because a customer can close the tab or a redirect-based method can finish later. Verify by completing a successful test payment, a declined test payment and an abandoned redirect, and confirming each one lands on the page you designed for it.
Wire webhooks as the source of truth
Configure a webhook endpoint on your backend, register it in the Control Center for the events you need, and update your order state only when a verified webhook confirms the payment status. Validate each webhook signature on the server and make the handler idempotent so duplicate deliveries do not fulfil an order twice. The output is an order record that changes state from the webhook, and the browser return page reads that state. Check this by replaying a test webhook and confirming that the order updates once and that a request without a valid signature is rejected.
Handling results, errors and payment states in React
A payment in the React checkout passes through several states, and the client sees only part of them. The cards below cover the decisions your team must make about declines, unfinished confirmations, duplicate clicks and webhooks so the UI never shows a result the server has not confirmed. Exact status values and event names should be checked against the Hyperswitch docs before you code against them.
Declined and requires-action outcomes
A declined card, a failed authentication challenge and a payment that needs a further customer step are different outcomes, and each needs its own UI path. Design a mapping from each Hyperswitch status to one of three actions: show a retryable message, hand control back to the payment element for a challenge, or close the flow. Keep decline reasons generic in the UI, since detailed issuer codes help attackers more than customers. Confirm the status values and any next-action fields in the Hyperswitch docs before writing the mapping.
Hyperswitch docsNetwork failures during confirmation
The browser may lose connection after the customer has submitted payment details but before the response arrives. The React app then cannot tell whether the payment was created, authorized or never sent. Decide how the page recovers: query the server for the payment by its identifier, not by re-submitting the form, and show a pending state until the server answers. Define a timeout and a clear message that tells the customer not to pay again until the status is known.
Duplicate submissions
Double clicks, slow networks and browser back navigation can each send a second confirm request for the same checkout. Disable the submit control as soon as the first request starts, and create the payment on your server with an idempotency key tied to the order, so a retried request returns the existing payment. Test the case where a customer reloads the page mid-payment and confirm the server rejects a second charge for the same order.
Client result versus server-confirmed status
The result the SDK returns in the browser is a hint, not proof that money moved. Only the server's view of the payment, read with your secret credentials, should drive fulfillment such as granting access or releasing goods. Build the React UI so it can show success provisionally, then wait for the server status before final confirmation. Write down which statuses your backend accepts as final and which it treats as still open.
Webhook delivery and retries
Webhooks are the path that still works when a customer closes the tab before the page updates. Plan an endpoint that verifies the webhook signature, stores the event, and updates your order state idempotently, since the same event may arrive more than once or out of order. Check how Hyperswitch retries failed webhook deliveries and what your endpoint must return to stop them. Confirm the signing method and retry schedule in the Hyperswitch docs.
Pending state in the React UI
A payment can stay pending for minutes while an external provider or customer step completes. Decide what the page shows during that time: a non-blocking status message, a polling interval with a cap, and a way for the customer to leave and return later. Make the order page able to show the current status when opened from an email link. Test this state with a delayed or abandoned payment so the UI does not spin forever.
Pointing the React checkout at a self-hosted Hyperswitch backend
A self-hosted Hyperswitch deployment runs its own Router and Scheduler services, backed by PostgreSQL with a master and replica setup and by Redis for caching and the scheduler queue. The React app must therefore be pointed at your endpoints rather than the hosted defaults. Three values control this: the SDK script URL that loads the checkout, the publishable key that identifies the merchant profile, and the API base URL the client uses to reach the payment backend. Set each one per environment (development, staging, production) from build-time configuration, so a staging build can never create payments against the production router. Confirm the exact configuration keys and how your chosen web SDK build reads them against the SDK documentation for your version, since the names are not something this page can fix for you.
Your version matrix needs the same care. The Hyperswitch releases page lists a compatibility matrix for Control Center and web client versions with each release, and those pairings should drive what you deploy. Before you upgrade the router, check the release notes for dependency changes. The v1.124.0 release notes state that Superposition became a required configuration dependency, and that a Superposition service must be running before you upgrade to that version. A React checkout that loads a web client newer or older than the router can fail in ways that look like frontend bugs, so treat the router, Control Center and web client as one release set and pin the web client build in your deployment pipeline. Review the Hyperswitch releases page at each planned upgrade rather than relying on memory of an earlier pairing.
Before go-live, run a short check that proves the React app talks only to your environment. Load the checkout in a staging browser session, confirm in the network log that the script and API calls go to your own hostnames, and confirm that the payment created by the server appears in your Control Center for that environment. Then repeat the check after every router or web client change. Record which router, Control Center and web client versions were tested together, because that record is the first thing an operations team or auditor will ask for when a checkout issue appears after an upgrade.
Security and PCI scope for the browser checkout
The browser checkout touches card data, server credentials and the admin console at the same time, so each of these needs its own boundary. The cards below cover the decisions that shape your PCI DSS scope and the controls around them. Confirm every conclusion with a Qualified Security Assessor (QSA) before you rely on it.
Card entry inside the payment element
The payment element collects card fields in the browser and sends them toward the Hyperswitch backend, so your React code should never read, log or store the PAN or CVV. Ask whether your architecture keeps card entry inside the iframe or hosted fields and whether any card data passes through your own servers. Confirm with your QSA which SAQ type and which data flows the chosen design implies.
Vault models docsKeep the secret key on the server
Payment creation calls need the merchant secret API key, which must only exist in your server environment. The browser should receive the client secret returned for a single payment and nothing more. Check that build tooling does not expose secret variables to the bundle, and that server logs do not capture full request bodies with credentials.
Content Security Policy and script hosting
Load the checkout script from a source you control and pin its version to the app server release. Your Content Security Policy must allow the script, frames and connect targets the SDK needs, and nothing broader. Review any third-party script added to the checkout page, because scripts on the payment page can affect card data handling in the browser.
Card vault model selection
Hyperswitch documents three self-hosted vault models: the native Hyperswitch Vault with in-house PCI, an external PCI vault provider such as VGS or Tokenex, and the SaaS Hyperswitch Vault. The choice decides where card data lives and how much of PCI DSS your organization carries. Compare the models in writing with your QSA before the first production payment.
External vault docsIn-house PCI responsibilities
Under the self-hosted, in-house PCI model, the Hyperswitch docs state that the merchant is fully responsible for PCI DSS certification and data handling. That covers the vault host, key management, network segmentation, logging, patching and access reviews. Ask your team to list which of these they own before choosing this model, and budget for the assessment work your QSA will request.
Control Center access through OIDC SSO
The Control Center supports SSO through OpenID Connect only, with no SAML, no JIT or SCIM provisioning, and roles managed inside Hyperswitch. Users must be invited before they can sign in, so access reviews run in two places: your identity provider and the Control Center. Document who can view and change payment settings, and remove invitations when people leave.
Configure SSO docsWhat to monitor after the React checkout goes live
Once the React checkout is live, the first thing to monitor is whether customers finish paying. Track checkout conversion and client-side error rates by browser, device and payment method, and set alerts on sudden drops after each deploy. A payment element that mounts but never reaches a confirmed state often looks like a frontend problem, so compare what the browser reports with what the server records for the same payment ID. Your team should also decide who owns the first response when conversion falls, since the cause may sit in your React code, the self-hosted SDK assets, the backend or a processor.
Webhook delivery is the second area. The server-side payment status is the source of truth, and redirects or client callbacks can be lost when a customer closes the tab. Confirm that your endpoint receives every status event from the Hyperswitch server, that it verifies signatures and is idempotent, and that failed deliveries are retried and visible to operators. Watch for a growing backlog of payments stuck in an intermediate state, because that pattern usually means orders are being taken without being fulfilled. Confirm the exact retry behavior and webhook settings with the Hyperswitch docs for your version before you rely on them.
Version alignment needs its own check on every upgrade. The React application, the hyperswitch-web SDK build and the Hyperswitch server must match according to the compatibility matrix published with each release on the Hyperswitch releases page. Record the SDK and server versions in your deployment metadata and compare them in every environment. Before production, rehearse failure paths in the Hyperswitch sandbox: declined cards, timeouts, abandoned redirects, a webhook that arrives late and an expired client secret. Keep the results as a runbook your on-call team can follow.
Limits to confirm in your environment before you build
Several Hyperswitch limits only show up once you test against your own region, processors and identity setup. The cards below list what to confirm with the Hyperswitch docs or your own tests before you commit the React integration to a design.
Payment methods in your region
Which payment methods appear in the unified checkout depends on the country, currency and processor configuration of each merchant account. Confirm that every method your customers expect, including wallets such as Apple Pay and Google Pay, renders for your target markets in the sandbox and in a staging environment with your own processor credentials. Record the results per market, because a method that works in one country may not appear in another.
Hyperswitch docsConnector support for each processor
The README lists more than 100 processors, but support for a given processor differs by payment method, currency, 3DS flow and feature. Ask for the connector's supported operations for each processor you plan to use, and test captures, refunds, voids and webhooks on that connector itself. A connector listed in the README is not proof that your specific flow works.
- Processors listed in README
- 100+
Control Center SSO limits
The Control Center supports SSO through OpenID Connect only, with no SAML and no SCIM. There is no just-in-time provisioning, so each user must be invited in Hyperswitch before they can sign in, and roles are managed in Hyperswitch rather than mapped from your identity provider. Plan the user onboarding and offboarding process around these limits and confirm them against the current SSO guide.
SSO setup guideBrowser and React version support
Confirm which React versions and browsers the web SDK version you pin supports, including the minimum versions your customers use. Check that your React build tooling, such as the bundler and framework version, works with the SDK script loading approach you choose. Test on the browsers and devices in your customer analytics before launch, since support statements from the vendor may not cover every version in your fleet.
Compatibility with app server versions
The web client must match the version of the Hyperswitch app server it talks to. Hyperswitch publishes a compatibility matrix with each release for Control Center and web client versions, so read the matrix for the release you run before you pin the client. Mismatched versions are a common cause of checkout failures that look like integration bugs.
Hyperswitch releasesBrand and accessibility fit
Decide whether the prebuilt checkout meets your brand requirements for fonts, colors, layout and payment method ordering, and whether it meets your accessibility obligations for keyboard use, screen readers and contrast. Audit the rendered checkout with your own accessibility tooling and with assistive technology users where possible. If the gaps are material, plan the headless approach or a custom front end before the build starts.
Questions teams ask before building the Hyperswitch React checkout
How much effort does a React integration of the Hyperswitch web checkout take?
The effort depends less on React than on the server side and on how many payment methods, environments and result states you need to handle. The browser work is mounting the payment element and handling the result, which is usually the smaller part. The larger parts are the server endpoint that creates payments, webhook handling, and testing across success, decline, 3DS challenge and timeout paths. Ask any provider to break the quote into these components: the server endpoint, the React mount and result handling, environment configuration, processor credential setup, and end-to-end test cases. A quote that lists only "frontend integration" is missing most of the work.
Can an in-house team build the Hyperswitch React checkout without outside help?
Yes, a team with experience in React, a backend language and payment flows can build it, and the Hyperswitch docs and SDK are public. The questions to answer honestly are whether anyone on the team has built payment result handling before, who owns the server endpoint, and who will keep the integration current as the SDK and app server change. Most in-house teams underestimate the error and edge-case handling and the testing against processor sandboxes. An outside partner is most useful for a fixed-scope first build, a review of the design before go-live, or a handover with written runbooks. DeployOpen plans, implements and documents self-hosted platforms in your own infrastructure, so you keep ownership of the code and the deployment.
What does the client need to provide before a Hyperswitch React integration starts?
Plan to provide the following before work begins:
- A running Hyperswitch app server with a publishable key and API key for each environment you test in, and a self-hosted or sandbox endpoint the SDK can reach.
- Processor or connector credentials for the sandbox accounts you intend to use, plus access to the webhook settings for those processors.
- A server endpoint in your existing REST backend that creates payments and never exposes the secret key to the browser.
- Named staging and production environments, with access for the people who will test and approve releases.
- A qualified security assessor (QSA) or your compliance lead, engaged early if the checkout will change which systems touch card data.
Confirm with your compliance team whether your planned flow keeps card fields inside the Hyperswitch-hosted element, because that choice determines your PCI DSS scope.
How long does a Hyperswitch React checkout integration take?
Duration depends on scope, not on a fixed template. The main drivers are the number of payment methods, whether you need saved cards or wallets, how many processors are connected, how many result and error states your product must handle, and how quickly sandbox credentials and environments are provided. A narrow first build with one processor and card payments moves faster than a build that adds wallets, saved payment methods, multiple currencies and custom retry messages. No duration is given here. Ask any provider for a timeline tied to a written scope with named milestones, and ask which client dependencies are assumed to be ready on day one.
Does a Hyperswitch React checkout need ongoing work after launch?
Yes. The checkout depends on the app server, the web SDK and your backend, and these are released on their own schedules. Hyperswitch ships roughly monthly minor releases, and its releases page lists a compatibility matrix for Control Center and web client versions, so the SDK version you load must match the server you run. Recurring work includes reviewing release notes, testing upgrades in staging, checking webhook and payment result handling after each change, and monitoring failed payments. Ask for an upgrade procedure, a monitoring plan and a support model in the quote, and decide whether these are covered by a retainer or by your own team.
When should I choose a headless build or a payment link instead of the React checkout?
Choose the prebuilt web checkout when you want Hyperswitch to render the payment element and you need a standard, well-supported flow in your own React app. Choose a headless build when you need full control over the card fields and layout, which adds PCI implications, because you take on more of the card-data handling. Choose a payment link when you need to accept payments with no custom checkout build, with a hosted page on your own domain. The right choice depends on your product, your compliance scope and how much UI you want to own. Ask a provider to compare these three options against your scope before committing.
What should engineers check when handling payment results and errors in React?
Treat the redirect or callback result as a signal to confirm, not as the final state of the payment. Your server should verify the payment status through the backend and reconcile it with webhooks, because a browser can close or redirect before the result is recorded. Handle at least four states: succeeded, requires further action such as 3DS, failed with a decline reason, and unknown or timed out. Check that no secret keys reach the browser, that error messages shown to customers do not expose processor details, and that retries do not create duplicate charges. Test each state against sandbox processors before go-live.
Where a partner fits in the build
A partner's quote for this work should itemize five cost components: scoping, the server endpoint that creates payments, the React build of the checkout page, testing, and handover. Scoping settles which app services and environments are in play, which payment methods the checkout must show, how the return and webhook flows will work, and which error states the product team expects customers to see. The server endpoint covers the code that calls the Router to create a payment and returns the client secret to the browser, along with authentication and logging around that call. The React build covers mounting the payment element, styling the container, and wiring result and error handling into the app's routing. Testing and handover round out the quote. Ask for each component to be priced separately so you can see which parts your own engineers could absorb.
Most engagements of this kind are fixed-scope, so DeployOpen agrees the scope, deliverables and timeline in writing before any build work starts. The written scope should name the React framework and version, the backend language and the endpoints involved, the Hyperswitch version the integration targets, and whether the SDK assets are loaded from the hosted sandbox or from a self-hosted location. Any change to those points after signing is a change request. One cost is recurring rather than one-time: when the Hyperswitch release cadence moves the client SDK forward, the React integration may need a version bump and a regression pass. Ask in the quote whether that upkeep is included, sold as a retainer, or left to your team.
The fixed scope also sets what your team must provide before work begins: sandbox or test credentials for a Hyperswitch environment you control, a named product owner who can decide on checkout copy and error messages, and access to the repository and CI pipeline. Delays in those inputs are the most common reason a fixed-scope timeline slips, so confirm them during scoping. DeployOpen will not state a price or duration for this integration here. Your quote will follow from the written scope, and the scope should tell you which parts of the build depend on decisions your organization has not yet made.
How DeployOpen scopes, delivers and supports this integration
DeployOpen approaches the React web checkout as a fixed-scope engagement: the payment flow, server-side endpoints, error handling and test coverage are agreed in writing before work starts. The integration is built inside your own infrastructure against a Hyperswitch backend you control, and handed over with documentation your engineers can maintain.
How we scope
- Agree in writing which payment methods, currencies and result pages the React checkout must support
- Confirm the self-hosted Hyperswitch version and matching hyperswitch-web client version before design starts
- Document which server-side endpoints, API keys and webhook handlers your team owns and which DeployOpen builds
How we build
- Create payments from your backend so no secret keys reach the browser and the React app only mounts the payment element
- Wire result handling for success, pending, failed and requires-action states, including redirects back into your app
- Test declined cards, network timeouts and expired sessions, and record which errors your customers see and where logs appear
How we hand over
- Deliver the source, configuration and environment variable inventory in your own repository and CI pipeline
- Provide a runbook covering version pinning, upgrade steps and rollback for the web client and the backend
- Walk through the integration with your engineers and record open items with owners and dates agreed in the scope
How we support
- Offer ongoing support, upgrades and continuous testing as a retainer after the initial handover
- Re-test the checkout flow when the Hyperswitch backend or web client moves to a new release
- Ask any support provider to confirm response expectations and upgrade responsibilities in the quote before signing

