Getting Started

Getting Started with VGS Collect React Native SDK

Before you start, you can also check @vgs/collect-react-native GitHub Pagearrow-up-right and Example Applicationarrow-up-right.

How to Integrate the SDK

Quickstart from Dashboard

You should have your organization registered at VGS Dashboardarrow-up-right. A Sandbox Vault will be pre-created for you. Use your VGS Dashboardarrow-up-right to start collecting data, then follow the VGSCollectSDK integration guide below.

Integrate VGSCollectSDK into your React Native Project

Step 1: Install the SDK

AI Agent Integration & Assisted Development

To accelerate your integration and ensure your implementation follows VGS best practices, you can use the AGENTS.mdarrow-up-right file as a context for AI Coding Agents. Attach or reference the URL to the AGENTS.md file to your agent's context: https://github.com/verygoodsecurity/vgs-collect-react-native-public/blob/main/AGENTS.mdarrow-up-right.

Example System Prompt: "You are an autonomous engineering agent integrating the VGS Collect RN SDK into an existing ReactNative app. Use the contents of AGENTS.md as your authoritative policy. Goals:

  1. Add a secure card form (Number, Name, Expiration, CVC).

  2. Validate all fields before submission.

  3. Provide unit tests for valid/invalid card inputs.”

Manual Installation

VGS Collect SDK is distributed through npmarrow-up-right.

Install the @vgs/collect-react-native package using npm or yarn:

Ensure you have React Native set up in your project. If not, follow the React Native Getting Started guidearrow-up-right.

Next

Follow the steps below to build a simple form that collects credit card data and submits it securely to your Vault.

Step 2: Configure Your App

Import the SDK Components:

To initialize VGSCollect instance you need to set your Vault id and Environmentarrow-up-right type.

Initialize VGSCollect:

  • You can have multiple VGSCollect instances; they will work independently with the fields you configure for each specific instance. - All VGSCollect instances can be configured differently.

There are two steps in the integration process:

  • Configuring VGS Collect UI components

  • Sending data to VGS

Configure UI Components

Create UI Form with VGS Input components

VGS Collect UI inputs have pre-defined configurations, such as validation and masking. To use a pre-defined configuration, you should use the type field. Available types are described in VGSInputType. More information about VGS Collect UI components is described here.

Setup styles attributes

Securely collecting and sending information

Use vgsCollect.submit(_:) to collect data from VGS Collect UI components and save it to your secure Vault. You can find additional information on how to send data to your Vault here.

Check next

Last updated