SDK
Tokenize cards and manage saved payment methods using Juspay Hyperswitch's PCI-compliant Vault SDK - available for React and Vanilla JS
The Juspay Hyperswitch Vault SDK provides a secure, PCI-compliant iframe for merchants to collect, store, and manage customer payment methods - without raw card data ever touching your servers.
What the Widget Does
The PaymentMethodsManagementElement / paymentMethodsManagement widget embeds a secure iframe that lets customers:
View all saved payment methods
Add a new card (captured and tokenized without touching your servers)
Delete an existing saved payment method
After a successful confirmTokenization(), you receive a payment_method_id that can be reused in future Vault-Then-Pay flows - no need to re-collect card details.
Key Benefits
Minimal PCI scope - Card data is captured inside a Hyperswitch-hosted iframe; your servers only ever see tokens.
Pre-built Payment Methods Management UI - Customers can view, add, and delete saved cards through the embedded widget.
One-click repeat purchases - Reuse a
payment_method_idfor future payments without re-collecting card details.Customizable appearance - Theme the widget to match your brand.
Before You Start
To integrate with the Hyperswitch Vault, configure your API credentials and profile settings first.
Step 1: Generate API Key
Access Dashboard - Log into the Hyperswitch Control Centre.
Navigate to API Keys - In the left-hand navigation menu, select Developers > API Keys.
Create Key - Click Create New API Key.
Secure Storage - Copy the generated key immediately and store it securely (it will not be shown again). Use this key in the
Authorization: api-key=<YOUR_VAULT_API_KEY>header for all Vault API calls.

Step 2: Access Profile ID
Navigate to Payment Settings - In the left-hand navigation menu, select Developers > Payment Settings.
Copy Profile ID - Locate and copy your Profile ID from the Payment Settings page. This ID is required for API calls that specify which merchant profile to use.

Step 1 - Server-Side Setup: Create a Payment Method Session Endpoint
Your backend creates a payment method session and returns the sdkAuthorization to your frontend. The client uses this token to initialize the SDK.
Never expose your Vault API Key to your client application.
API reference: Payment Method Session — Create
Step 2 - Client-Side Integration
Choose your frontend framework:
React Integration
2.1 Install Libraries
2.2 Initialize HyperLoader
Configure with your publishable key and profile ID (safe for frontend use):
2.3 Fetch Session Details
2.4 Mount the HyperManagementElements Component
2.5 Access Hyper Hooks in the Child Component
2.6 Render the Payment Methods Management Element
2.7 Confirm Tokenization
Call confirmTokenization() when the user submits. Hyper handles any required 3DS redirect and returns the user to return_url.
JavaScript Integration
2.1 Define the HTML Placeholder
2.2 Load HyperLoader.js, Fetch Session, and Mount the Widget
See It in Action
First-Time User: Saving a New Card
A new customer enters their card details inside the secure iframe. The card is tokenized and vaulted - your servers never see the raw number.

Returning User: Viewing Saved Cards
A returning customer opens the widget and instantly sees all their previously vaulted cards - no need to re-enter any details.

Managing Saved Cards: Delete and Update
Customers can view all their saved cards, remove ones they no longer need, and update existing card details - all from within the widget.

Customizing the SDK Appearance
The widget supports theming to match your brand - colors, fonts, and layout can all be configured via the customization options.

Last updated
Was this helpful?

