For the complete documentation index, see llms.txt. This page is also available as Markdown.

CVC Element

The embedded CVC Element that collects the cvc number.

The standalone CVC field is used only for saved card payments. Do not use it when collecting details for a new card, as the PaymentElement already includes CVC collection.

Find the Demo App

Find the demo app here

When to use it

Use CardCVCElement when all of these are true:

  1. You are building a custom saved-payment-methods screen (your own UI, not the drop-in sheet).

  2. The customer has a saved card (check lastUsed.payment_method === 'card').

  3. The saved card requires CVV to confirm (check lastUsed.requires_cvv === true).

If none of these apply, skip this widget entirely.

1. Basic Usage

1.1 Install the react native sdk

npm install @juspay-tech/react-native-hyperswitch
# or
yarn add @juspay-tech/react-native-hyperswitch

1.1.1 Install Peer Dependencies

The SDK requires the following peer dependencies to be installed in your project:

yarn add react-native-inappbrowser-reborn
yarn add react-native-svg
yarn add @sentry/react-native
# or
npm install react-native-inappbrowser-reborn
npm install react-native-svg
npm install @sentry/react-native

1.2 Initialize Hyperswitch

Initialize Hyperswitch once using your publishable key and profile ID. Reuse the same initialized instance throughout your application.

Keep the Hyperswitch secret API key on your backend only. The app should never handle it.

1.2 Get sdk_authorization from your Backend

Call your payment-creation endpoint. Its JSON response must contain sdk_authorization.

1.3 Wrap your app with HyperElements

To use HyperSwitch hooks and the Embedded UI in a React Native application, wrap your payment screen with the HyperElements component. During initialization, you must provide the required sdkAuthorization prop to HyperElements. This authorization is necessary for the SDK to initialize correctly.

1.4 Fetch saved payment methods (inside HyperElements):

1.5 Decide whether CVC is needed:

1.6 Render the widget only when required.

Give it a stable id — you'll need the same id in step 1.8

1.6 Wait for readiness, then enable your Pay button:

Also reset cvcReady to false whenever the underlying payment session or the selected saved method changes, so the user can't submit against a stale widget.

1.7 Confirm headlessly with the same id:

1.8 Handle the result:

Congratulations! You have successfully integrated the CVC Element into your application.

Last updated

Was this helpful?