Collecting cards with the Hyperswitch Vault SDK

The Vault SDK collects card details in the browser and returns a token, so your servers pay with that token and never handle the raw card number. This page covers how the pattern works, what you configure, and what to confirm before go-live.

On this page

Collecting cards with the Hyperswitch Vault SDK keeps raw card data out of your servers

The Hyperswitch Vault SDK tokenizes cards in the customer's browser and sends them to the PCI-compliant Hyperswitch Vault, so your application receives a token instead of a card number. Payments then run server-to-server, with your backend submitting the token to the orchestration layer. This is the pattern a team needs when it runs a self-hosted Hyperswitch stack, must take cards, and wants raw card data to stay out of its own web tier, logs and databases. It is one of the vault models Hyperswitch documents for self-hosted deployments, and it sits alongside the in-house PCI model and the external PCI vault option.

The choice usually comes down to who carries PCI DSS obligations for the card data path. In the in-house model, the Hyperswitch docs state that the merchant is fully responsible for PCI DSS certification and data handling, which means your team owns the locker, its keys and its controls. The vault-then-pay pattern shifts card storage to the hosted Hyperswitch Vault while your servers keep running routing and the app server. Confirm the exact scope reduction with your assessor and with Juspay, since the result depends on how your pages load the SDK, what your servers receive and which fields your logs capture.

Plan the integration around the boundary itself. Your checkout page must load the SDK from a path you control, your backend must never accept card fields in its own request bodies, and your monitoring must not record payment payloads. Ask Juspay to confirm the current SDK integration steps, the server-to-server calls used with the token, and how saved payment methods are managed in the vault before you commit to the design. Hyperswitch documents both server-to-server and SDK integration paths, so decide early which one your team will operate.

Where card data flows in the vault-then-pay pattern

The flow starts in the customer browser, where the Vault SDK sends card details directly to the Hyperswitch Vault. The vault returns a token, and only that token reaches your merchant server, which then calls the Hyperswitch app server for the payment. The trust boundary sits around the vault: the card number should never cross into your own servers. Check that your frontend, logs and error handling never capture the raw card fields before the token is issued.

Raw card data goes to the vault only; your servers handle tokens.

Which vault integration option fits your team

This table compares the SDK and server-to-server paths and the three documented vault models, showing when each fits, what it does to PCI DSS scope and what your team operates. Read each row against your own card volume, in-house PCI capability and tolerance for a hosted dependency, then confirm the scope effect with your assessor before choosing.

OptionWhen it fitsEffect on PCI DSS scopeWhat your team operates
Vault SDK in the browser with the native Hyperswitch Vault (self-hosted)You want raw card data kept off your servers and you can run the card vault and its keys in your own infrastructureCard entry happens in the customer's browser through the SDK, but the merchant remains responsible for PCI DSS certification and data handling for the vault it hostsThe card vault, its database, TLS, key custodians and key storage backend, plus the SDK version pinned to your server release
Server-to-server calls with the native Hyperswitch Vault (self-hosted)Your backend already holds card data from a legacy flow and you need to tokenize it into the vaultRaw card data passes through your servers, which brings your application servers into PCI DSS scopeYour application servers, the card vault, key management and the assessment evidence for the card data flow
Self-hosted orchestration with an external PCI vault such as VGS or TokenexYou want an external PCI vault provider to hold cards while you keep routing and the app server in your infrastructureScope depends on how the provider's collection path is built, so confirm with the provider and your assessor which systems are in scopeThe orchestration stack, the integration with the external vault's collection and token APIs, and that provider's contract and evidence
Self-hosted orchestration with the SaaS Hyperswitch VaultYou want routing and the app server under your control but prefer cards held by Juspay's hosted vaultCards sit outside your infrastructure, which changes your scope and data residency position, so confirm the vault's scope and location terms in writingYour orchestration stack, the SDK integration and vendor review of the hosted vault's dependency and availability
Vault SDK path (browser tokenization, then payment with the token)Your checkout is web or mobile and you want the cardholder's data entered directly into the SDKLowers the chance that raw card data reaches your servers, but it does not remove obligations for the systems you still controlSDK version alignment with your Control Center and router releases, and checks that the payment page loads the SDK from your approved source
Server-to-server path (tokenize and pay from your backend)You run a backend-only flow, such as a recurring billing job, or a flow with no browser collectionYour servers handle card data or tokens, so your backend is in scope and needs review against PCI DSS requirementsBackend integration code, secret handling for API keys and logging controls that keep card data out of logs
Hybrid: SDK for new customer cards, server calls for saved cardsMost merchants that accept new cards in checkout and reuse saved payment methods laterScope follows the paths you use, so document which flow touches card data and keep the server path as narrow as possibleBoth integrations, their tests and a written map of which flow handles raw card data and which handles tokens only

Setting up card collection with the Vault SDK

This sequence takes a team from choosing a vault model to a tested vault-then-pay flow, where the browser tokenizes the card and your server only ever handles the token. Each step ends with a check you can record before moving on.

  1. Confirm the vault model and deployment

    Before any code is written, the payments lead and the compliance lead agree which vault model applies: the native Hyperswitch Vault in your own infrastructure, an external PCI vault provider, or the SaaS Hyperswitch Vault. The choice determines who carries PCI DSS obligations for stored card data, so it should be written down with the scope decision. Confirm the target environment (sandbox first, then production) and that the Hyperswitch app server is reachable from your checkout and back end. The step is done when the model, the environment and the owner of each responsibility are recorded in your design document.

  2. Configure the Hyperswitch connection and credentials

    Your platform engineers create the API credentials for the target environment and store them in your secrets manager, not in the front-end bundle or the repository. The publishable key is the only value the browser may hold, and the secret key stays on your server. Check the exact parameter names and base URLs in the Vault SDK integration documentation for your version, and confirm that the sandbox and production credentials are separate. The step is done when a server-side call to the app server with the secret key succeeds in a non-production environment and the key is absent from the built front-end assets.

  3. Add the Vault SDK to the checkout page

    Front-end developers load the Hyperswitch Vault SDK on the page that collects card details, using the initialization parameters from the integration guide. The card fields should be rendered by the SDK so that the card number and security code are entered into frames controlled by the vault, not into inputs your own code can read. Confirm the Content Security Policy allows the SDK origins and that the page works with your browser support matrix. The step is done when the card form renders in the sandbox and your own scripts cannot read the field values in the browser developer tools.

  4. Collect and tokenize a sandbox test card

    A tester submits a test card number from the sandbox test card list through the checkout form. The SDK sends the card to the vault and returns a token or payment method identifier to the page. Use only test numbers supplied for the sandbox, never real card data, even in staging. The step is done when the submission completes and the tester sees a token reference in the response, with no card number in the page's network calls to your own domain.

  5. Store the returned token

    The page passes the token identifier to your server over your normal API, and your server stores it against the customer record, along with the fields the vault returns for display, such as the last four digits and expiry. The token is a reference, so it can sit in your customer database, but it must be linked to the right customer and cannot be shared across accounts. Confirm with your processor and vault documentation whether the token is single-use or reusable for saved payments. The step is done when a test customer record holds the token and a database query shows no card number or security code.

  6. Make a server-to-server payment with the token

    Your back end calls the Hyperswitch payments API with the stored token and the amount, currency and customer details, using the secret key. The orchestrator resolves the token against the vault and routes the payment to the processor configured for the sandbox. Use the Hyperswitch docs for the exact request fields and any required authentication or confirmation flags. The step is done when the payment returns a succeeded or expected status in the sandbox, and the same call works from a server with no browser involved.

  7. Verify that no raw card data reaches your systems

    Your security engineers search application logs, error traces, analytics events, and the request and response bodies captured by your API gateway and monitoring tools during the tests above for the test card number and security code. They also review the browser network log for calls that carry card fields to any domain you control. Any match is a defect to fix before go-live, and the fix should be retested with a fresh test card. The step is done when the search returns no matches, the results are saved as evidence for your assessor, and the logging configuration is reviewed for the production rollout.

Security and PCI scope risks when collecting cards

Collecting cards in the browser moves the most sensitive data out of your servers, but it creates new places where card numbers can leak or where your PCI DSS scope can quietly grow. The risks below depend on your chosen vault model, and in the self-hosted, in-house PCI model the merchant carries certification and data handling.

Raw card data in frontend code

The vault flow is only safe if card fields are rendered and submitted through the Vault SDK rather than read by your own JavaScript. Any custom handler that reads the card number, CVC or expiry before the SDK call puts raw data in your application context. Review the checkout bundle and any form wrappers, and confirm that no code path serializes card fields into local storage, analytics events or error reports.

Vault SDK docs

Third-party scripts on checkout

Analytics tags, A/B testing libraries, session replay tools and customer support widgets that load on the payment page can read the DOM or intercept input events. Any script that can see the card iframe host page is a candidate for scope review. Keep the list of scripts on payment pages short, pin their versions, and confirm with your QSA or assessor how each one is treated before it ships.

Token handling in logs

Vault tokens and payment method identifiers are not card numbers, but they are sensitive references that let a caller charge a stored card. Application logs, APM traces, proxy access logs and error tracking often capture request bodies and headers by default. Configure log redaction for token fields and for the server-to-server payment calls, and confirm that retention and access to these logs match your data handling policy.

CORS and allowed origins

Allowed origins and CORS settings decide which web pages can call your payment endpoints and load the SDK. Overly broad origins, wildcard headers or staging domains left enabled in production widen the set of sites that can initiate collection. List the exact production and staging origins, remove test domains before go-live, and review these settings again after every checkout domain change.

Credential rotation for server calls

The server-to-server payment calls that use a stored token authenticate with API credentials held by your backend. If those keys are shared across environments or never rotated, a leaked key allows charges against saved cards. Store keys in a secrets manager, give each environment its own key, and document how and when you rotate them, including the steps for revoking a key after a personnel change.

Checkout changes that alter scope

A small change, such as moving card fields out of an iframe, adding a payment field to a custom template or changing where a script loads, can change how your environment is classified. Treat changes to payment pages as scope-relevant. Require a review for each release that touches checkout, and confirm with your assessor which changes trigger a re-check of your PCI DSS scope and the vault model you documented.

Questions teams ask before collecting cards with the Vault SDK

What drives the cost of a Vault SDK card collection integration?

Scope, the number of payment surfaces, and the review work around them decide most of the cost. A single hosted checkout page that collects cards in the browser and calls the Hyperswitch server-to-server APIs for payment is a different job from a platform with saved cards in several apps, multiple markets and refund flows. Cost has two parts: one-time build work (SDK wiring, token handling, error paths, testing across browsers and devices, and security review) and recurring work (SDK and API version upgrades, monitoring and support). Ask any partner for a written scope listing the payment surfaces, the APIs in use, the environments covered and the test evidence delivered, since those items are what a quote should price.

How long does a Vault SDK integration take?

Duration follows the same drivers as cost: how many payment surfaces the integration covers, how many saved-card flows it supports, whether the team already runs a self-hosted Hyperswitch stack, and how long security and compliance review takes. A team with an existing Hyperswitch deployment and one checkout to change will move faster than a team building the server, the SDK integration and the vault configuration together. Confirm the timeline against the written scope and ask which steps depend on other teams, such as access approvals, DNS and TLS for the frontend, or sign-off from the assessor.

What skills does the team need for Vault SDK card collection?

The work needs three groups. Frontend engineers integrate the SDK in the browser, render the card fields in the hosted or embedded form, handle validation messages and pass the resulting token to the backend. Backend engineers call the server-to-server APIs with the token, manage idempotency, store only the token and payment identifiers, and handle webhooks and failures. Security or compliance staff review the data flow, confirm that raw card data never reaches your servers or logs, and document the PCI DSS responsibilities that remain with you. Teams that lack one of these groups should plan for that gap before the build starts.

Can an in-house team collect cards with the Vault SDK without a partner?

Yes, an in-house team can build it if it has the frontend, backend and security skills described above and time to test the flows. The hard parts are rarely the SDK calls themselves. They are the edge cases: token expiry, duplicate submissions, 3DS challenges, saved-card lifecycle, webhook ordering and evidence for the assessor. A partner is most useful when the team needs a fixed scope, an outside review of the data flow or a second pair of hands on testing before go-live. Whichever path you choose, put the decision on the written scope so that ownership of each deliverable is clear.

How does the vault model change PCI scope when collecting cards?

The vault model decides how much of the card data path sits inside your environment. Hyperswitch documents three self-hosted models: self-hosted with the native Hyperswitch Vault, self-hosted orchestration with an external PCI vault provider, and self-hosted orchestration with the SaaS Hyperswitch Vault. In the self-hosted, in-house PCI model, the Hyperswitch docs state that the merchant is fully responsible for PCI DSS certification and data handling. Outsourced and SaaS vault models shift part of that burden, but your scope still depends on how the SDK is hosted, what your servers receive and what your logs capture. Confirm the exact responsibility split with your vendor and your assessor before you commit to a model, using the self-hosted and in-house PCI model documentation as the starting point.

What happens to saved cards if we change the vault later?

Saved cards do not move automatically when the vault changes. Moving tokens or card data between vault models is a migration project with its own plan, testing and evidence, and it depends on whether the source and target vaults allow the data to be exported and re-encrypted under the new keys. Before choosing a model, ask how tokens are stored, whether card data can be exported in a supported way, how customers are notified and how the switchover is tested. Plan the change as a migration, not a configuration toggle, and record which tokens were moved, verified and retired.

What to decide before you build the checkout

The first decision is the vault model, because it determines whether the Vault SDK path is even the right one for your stack. Hyperswitch documents three self-hosted models: self-hosted with the native Hyperswitch Vault (in-house PCI), self-hosted orchestration with an external PCI vault provider such as VGS or Tokenex, and self-hosted orchestration with the SaaS Hyperswitch Vault. The SDK collection pattern works across these, but the PCI scope you carry differs in each. The Hyperswitch docs state that under the in-house model the merchant is fully responsible for PCI DSS certification and data handling, so that choice should be made with your assessor before any checkout code is written. Read the self-hosted and in-house PCI model page and confirm which model your stack will run.

Next, decide who owns the checkout page. The Vault SDK collects card fields in the browser, so the team that builds and maintains that page controls the script loading, the field layout, the error handling and any third-party scripts on the same page. Those controls decide whether raw card data can reach your servers or logs. Name an owner for the page, define who may change it, and agree how script changes get reviewed. Also decide where the token flow ends: whether your server receives only the token and then calls the payment API, and whether any analytics or session-replay tooling runs on the payment page.

Finally, plan how tokens are stored and referenced and how the test plan runs in the sandbox. Store only the token and the customer identifier your application needs, and keep a written rule for which services may hold a token and for how long. Build tests that confirm no card number, expiry or CVC appears in request bodies, application logs, error traces or database rows on your side. Confirm with your QSA or compliance team, before go-live, the evidence they will ask for: the data flow diagram, the list of scripts on the payment page and the test results. Their review should happen while the design is still cheap to change.

How DeployOpen works on this

DeployOpen plans and builds the browser-side card collection flow for Hyperswitch in infrastructure you control, so raw card data goes to the Hyperswitch Vault and never to your application servers. The work covers the front end, the server-to-server payment calls that use the returned token, and the evidence your security and compliance teams will ask for.

How we scope

  • Written scope names the checkout pages, payment flows and saved-card features that will use the Vault SDK.
  • Scope records which Vault SDK integration path you will use and which Hyperswitch components are self-hosted.
  • Scope states how your PCI DSS scope assessment will be prepared, with your assessor confirming the final boundary.

How we build

  • We build the browser tokenization flow and confirm that card fields never reach your own servers or logs.
  • We wire server-to-server payment calls to use only the vault token, with error handling for declines and timeouts.
  • We test the flow in a non-production environment, including saved-card reuse, before any live card is collected.

How we hand over

  • You receive the source changes, configuration, and a runbook describing the card collection and payment sequence.
  • Documentation maps each data flow and network path so your security reviewers can trace where card data is and is not present.
  • Handover includes a retest of the collection flow after fixes, with findings and remediation recorded in writing.

How we support

  • Ongoing support covers Vault SDK version changes and Hyperswitch upgrades that touch the collection flow, available as a retainer.
  • Support includes periodic security testing of the checkout and token handling, scoped in writing.
  • Before each upgrade, we check the Control Center and SDK compatibility that the release notes document, and confirm the flow still behaves as scoped.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.