bars-progressPayment Methods Management

Hyperswitch is designed to facilitate the management of saved payment methods

The Hyperswitch Payment Methods Management SDK provides a secure solution for merchants to handle and store payment information without the burden of PCI DSS compliance requirements. By leveraging Hyperswitch's Vault service, merchants can securely store customer payment methods (credit cards, digital wallets, etc.) while minimizing their exposure to sensitive payment data.

Key Features of Payment Method Management in Hyperswitch

Hyperswitch simplifies the complexities of payment method management, so you can offer a seamless, secure experience to your customers with minimal effort.

  1. Payment Method Creation: Easily allow your customers to save new payment methods during checkout, providing a convenient option for future transactions.

  2. Storing Payment Methods: Hyperswitch securely stores customer payment details, enabling repeat purchases without requiring them to re-enter their information each time.

  3. Retrieving Payment Methods: Customers can quickly access their saved payment methods, streamlining their checkout process and enhancing their overall experience.

  4. Deleting/Deactivating Payment Methods: Keep payment options up to date by allowing customers to manage outdated or inactive methods, ensuring a clean and efficient payment experience.

image displaying the payment method management UI.

1. Server-Side Setup

First, you'll need to set up your server to create payment method sessions, which establish secure connections between your frontend and the Hyperswitch Vault.

Obtaining Your API Keys

Get your API key from the Hyperswitch dashboardarrow-up-right under Developers -> API Keys section. You'll need both your API key and profile ID for server and client integration.

All Vault API (V2) requests require authentication using specific API keys generated from your Vault Merchant account. These keys are distinct from your standard payment processing keys.

To generate your Vault API keys, follow these steps:

  1. Access Dashboard: Log into the Hyperswitch Dashboard.

  2. Navigate to Vault: In the left-hand navigation menu, select Vault.

  3. Generate Key: Navigate to the API Keys section and click the Create New API Key button.

  4. Secure Storage: Copy the generated key and store it securely. You must use this key to authenticate all Vault API (V2) calls.

Note: We are currently working on unifying authentication across our platforms. Soon, you will be able to use a single API key for both Payments and Vault APIs.

Creating a Payment Methods Session Endpoint

Add an endpoint on your server that creates payment methods sessions. This endpoint will return the necessary session information to your client application.

Note: Replace YOUR_PROFILE_ID and YOUR_API_KEY with your actual credentials from the Hyperswitch dashboard.

2. Client-Side Integration

Once your server endpoint is set up, you'll need to integrate the Vault/Payment Methods Management SDK into your client application.

2.1 Define the Payment Methods Management Form

Add one empty placeholder div to your page for the Payment Methods Management widget that you'll mount.

2.2 Fetch the Payment Method Session and Mount the Payment Methods Management Element

Make a request to the endpoint on your server to create a new payment method session. The id and clientSecret returned by your endpoint are used to initialize and display the customer's saved payment methods. Following this, create a paymentMethodsManagementElements element and mount it to the placeholder div in your form. This embeds an iframe with a dynamic interface that displays saved payment methods, allowing your customer to view, manage, and delete their payment methods.

Note: Make sure to never share your API key with your client application as this could potentially compromise your payment flow.

2.3 Complete tokenization and handle errors

Call confirmTokenization(), passing the mounted Payment Methods Management widgets and a return_url to indicate where Hyper should redirect the user after any required authentication. Depending on the payment method, Hyper may redirect the customer to an authentication page. After authentication is completed, the customer is redirected back to the return_url.

If there are any immediate errors (for example, invalid request parameters), Hyper returns an error object. Show this error message to your customer so they can try again.

Now that you have integrated the Hyperswitch Payment Methods Management on your app, you can customize it to blend with the rest of your website.

Last updated

Was this helpful?