How to Integrate the SDK

The latest version of our Zero Data SDK:

Quickstart from Dashboard

You should have your organization registered at the VGS Dashboard. Sandbox vault will be pre-created for you. You should use your to start collecting data. Follow integration guide below.

Integrate VGS Collect SDK into Your Android Project

To use the SDK in your project you just need to add the following line of dependency in your module build.gradle file and then rebuild project.

Info
Follow our last releases .
dependencies {
    //...
    implementation 'com.verygoodsecurity:vgscollect:<latest-version>'
    //...
}
This is a sample VGS echo server.
This is a HTTP port number to access.
This is an example of your API endpoint.
This is an example of your Credit reporting API endpoint.
This is an example of your Issuing platform API endpoint.
This is alias which you receive on redact step from your payload value. Please observe the code snippet of redact step.
More about the aliases available formats you can read at nomenclature page.
This is alias which you receive on redact step from your payload value. Please have a look on code snippet of redact step.
More about the available formats of alias you can read here.
This is a sample vault id.
Sign in to see your personalized example.
This is a vault id.
Sign in to see your personalized example.
This is a vault id.
Sign in to see your personalized example.
This is your vault id.
These are an access credentials for a sample test vault.
These are an access credentials for a sample test vault.
This is a placeholder for your access credentials.
This is a sample vault url.
Sign in to see your personalized example.
This is a sample proxy vault url.
This is your vault url.
This is your proxy vault url.
This is a sample vault host.
This is your vault host.
This is your current Organization ID.
A pre-generated JS script placeholder for your current organization.
Sign in to see your personalized example.
A pre-generated JS script placeholder for your current organization.
Please talk to support in order to enable it for this organization.
This is your pre-generated JS script for your current organization.
The unique name that identifies a specific iframe.
Unique client ID used for VGS CLI authentication.
Please contact VGS Support in order to enable it for your organization.
Client secret used for VGS CLI authentication.
Please contact VGS Support in order to enable it for your organization.
Version of the CLI published on quay.io.
Command on the VGS CLI.
This is a full path to the certificate file.
This option allows curl to proceed without providing a TLS certificate. If you'd like to include your certificate, use --cacert [FILE].

Include additional configurations

In case you have minifyEnabled enabled don't forget to add next line to your project’s R8 configuration files before build your app.

//...
-keep public class com.google.android.material**  { *; }
//...
This is a sample VGS echo server.
This is a HTTP port number to access.
This is an example of your API endpoint.
This is an example of your Credit reporting API endpoint.
This is an example of your Issuing platform API endpoint.
This is alias which you receive on redact step from your payload value. Please observe the code snippet of redact step.
More about the aliases available formats you can read at nomenclature page.
This is alias which you receive on redact step from your payload value. Please have a look on code snippet of redact step.
More about the available formats of alias you can read here.
This is a sample vault id.
Sign in to see your personalized example.
This is a vault id.
Sign in to see your personalized example.
This is a vault id.
Sign in to see your personalized example.
This is your vault id.
These are an access credentials for a sample test vault.
These are an access credentials for a sample test vault.
This is a placeholder for your access credentials.
This is a sample vault url.
Sign in to see your personalized example.
This is a sample proxy vault url.
This is your vault url.
This is your proxy vault url.
This is a sample vault host.
This is your vault host.
This is your current Organization ID.
A pre-generated JS script placeholder for your current organization.
Sign in to see your personalized example.
A pre-generated JS script placeholder for your current organization.
Please talk to support in order to enable it for this organization.
This is your pre-generated JS script for your current organization.
The unique name that identifies a specific iframe.
Unique client ID used for VGS CLI authentication.
Please contact VGS Support in order to enable it for your organization.
Client secret used for VGS CLI authentication.
Please contact VGS Support in order to enable it for your organization.
Version of the CLI published on quay.io.
Command on the VGS CLI.
This is a full path to the certificate file.
This option allows curl to proceed without providing a TLS certificate. If you'd like to include your certificate, use --cacert [FILE].

Configure Your App

To initialize VGSCollect you have to set your vault id and Environment type. You can find more information at the following section.

import com.verygoodsecurity.vgscollect.core.Environment
import com.verygoodsecurity.vgscollect.core.VGSCollect

class MainActivity : AppCompatActivity() {

    private lateinit var vgsForm:VGSCollect

    override fun onCreate(savedInstanceState: Bundle?) {
       super.onCreate(savedInstanceState)
       setContentView(R.layout.activity_main)

       vgsForm = VGSCollect(this, "<VAULT_ID>", Environment.<SANDBOX>)
    }

    override fun onDestroy() {
        super.onDestroy()
    }
}
This is a sample VGS echo server.
This is a HTTP port number to access.
This is an example of your API endpoint.
This is an example of your Credit reporting API endpoint.
This is an example of your Issuing platform API endpoint.
This is alias which you receive on redact step from your payload value. Please observe the code snippet of redact step.
More about the aliases available formats you can read at nomenclature page.
This is alias which you receive on redact step from your payload value. Please have a look on code snippet of redact step.
More about the available formats of alias you can read here.
This is a sample vault id.
Sign in to see your personalized example.
This is a vault id.
Sign in to see your personalized example.
This is a vault id.
Sign in to see your personalized example.
This is your vault id.
These are an access credentials for a sample test vault.
These are an access credentials for a sample test vault.
This is a placeholder for your access credentials.
This is a sample vault url.
Sign in to see your personalized example.
This is a sample proxy vault url.
This is your vault url.
This is your proxy vault url.
This is a sample vault host.
This is your vault host.
This is your current Organization ID.
A pre-generated JS script placeholder for your current organization.
Sign in to see your personalized example.
A pre-generated JS script placeholder for your current organization.
Please talk to support in order to enable it for this organization.
This is your pre-generated JS script for your current organization.
The unique name that identifies a specific iframe.
Unique client ID used for VGS CLI authentication.
Please contact VGS Support in order to enable it for your organization.
Client secret used for VGS CLI authentication.
Please contact VGS Support in order to enable it for your organization.
Version of the CLI published on quay.io.
Command on the VGS CLI.
This is a full path to the certificate file.
This option allows curl to proceed without providing a TLS certificate. If you'd like to include your certificate, use --cacert [FILE].

Configuring UI Elements

Add input field to R.layout.activity_main layout file:

Warning
You must set up fieldName to the VGSCardNumberEditText in other way input field will be ignored by VGSCollect.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="16dp">

    <com.verygoodsecurity.vgscollect.widget.VGSTextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:hintEnabled="true"
        app:hint="Card number"
        app:boxCornerRadius="4dp"
        app:boxBackgroundModes="outline">

        <com.verygoodsecurity.vgscollect.widget.VGSCardNumberEditText
            android:id="@+id/cardNumberField"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:fieldName="card_number"
            app:numberDivider="-"
            app:cardBrandIconGravity="end"/>

    </com.verygoodsecurity.vgscollect.widget.VGSTextInputLayout>

    <Button
        android:id="@+id/submitBtn"
        android:text="Submit"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

</LinearLayout>
This is a sample VGS echo server.
This is a HTTP port number to access.
This is an example of your API endpoint.
This is an example of your Credit reporting API endpoint.
This is an example of your Issuing platform API endpoint.
This is alias which you receive on redact step from your payload value. Please observe the code snippet of redact step.
More about the aliases available formats you can read at nomenclature page.
This is alias which you receive on redact step from your payload value. Please have a look on code snippet of redact step.
More about the available formats of alias you can read here.
This is a sample vault id.
Sign in to see your personalized example.
This is a vault id.
Sign in to see your personalized example.
This is a vault id.
Sign in to see your personalized example.
This is your vault id.
These are an access credentials for a sample test vault.
These are an access credentials for a sample test vault.
This is a placeholder for your access credentials.
This is a sample vault url.
Sign in to see your personalized example.
This is a sample proxy vault url.
This is your vault url.
This is your proxy vault url.
This is a sample vault host.
This is your vault host.
This is your current Organization ID.
A pre-generated JS script placeholder for your current organization.
Sign in to see your personalized example.
A pre-generated JS script placeholder for your current organization.
Please talk to support in order to enable it for this organization.
This is your pre-generated JS script for your current organization.
The unique name that identifies a specific iframe.
Unique client ID used for VGS CLI authentication.
Please contact VGS Support in order to enable it for your organization.
Client secret used for VGS CLI authentication.
Please contact VGS Support in order to enable it for your organization.
Version of the CLI published on quay.io.
Command on the VGS CLI.
This is a full path to the certificate file.
This option allows curl to proceed without providing a TLS certificate. If you'd like to include your certificate, use --cacert [FILE].

Collecting Sensitive Data on Android

Once you have added the input field to your layout , find the object, attach it to VGSCollect for the data to be sent securely:

import com.verygoodsecurity.vgscollect.core.Environment
import com.verygoodsecurity.vgscollect.core.VGSCollect
import com.verygoodsecurity.vgscollect.widget.VGSCardNumberEditText

class MainActivity : AppCompatActivity() {

    private lateinit var vgsForm:VGSCollect

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        vgsForm = VGSCollect(this, "<VAULT_ID>", Environment.<SANDBOX>)

        val submitBtn = findViewById<Button>(R.id.submitBtn)

        val cardNumberField = findViewById<VGSCardNumberEditText>(R.id.cardNumberField)
        vgsForm.bindView(cardNumberField)
    }

    override fun onDestroy() {
        super.onDestroy()
    }
}
This is a sample VGS echo server.
This is a HTTP port number to access.
This is an example of your API endpoint.
This is an example of your Credit reporting API endpoint.
This is an example of your Issuing platform API endpoint.
This is alias which you receive on redact step from your payload value. Please observe the code snippet of redact step.
More about the aliases available formats you can read at nomenclature page.
This is alias which you receive on redact step from your payload value. Please have a look on code snippet of redact step.
More about the available formats of alias you can read here.
This is a sample vault id.
Sign in to see your personalized example.
This is a vault id.
Sign in to see your personalized example.
This is a vault id.
Sign in to see your personalized example.
This is your vault id.
These are an access credentials for a sample test vault.
These are an access credentials for a sample test vault.
This is a placeholder for your access credentials.
This is a sample vault url.
Sign in to see your personalized example.
This is a sample proxy vault url.
This is your vault url.
This is your proxy vault url.
This is a sample vault host.
This is your vault host.
This is your current Organization ID.
A pre-generated JS script placeholder for your current organization.
Sign in to see your personalized example.
A pre-generated JS script placeholder for your current organization.
Please talk to support in order to enable it for this organization.
This is your pre-generated JS script for your current organization.
The unique name that identifies a specific iframe.
Unique client ID used for VGS CLI authentication.
Please contact VGS Support in order to enable it for your organization.
Client secret used for VGS CLI authentication.
Please contact VGS Support in order to enable it for your organization.
Version of the CLI published on quay.io.
Command on the VGS CLI.
This is a full path to the certificate file.
This option allows curl to proceed without providing a TLS certificate. If you'd like to include your certificate, use --cacert [FILE].

Submit Information

Call asyncSubmit to execute and send data on VGS Server

Warning
Do not use submit on the UI thread as this will crash.
import com.verygoodsecurity.vgscollect.core.Environment
import com.verygoodsecurity.vgscollect.core.VGSCollect
import com.verygoodsecurity.vgscollect.widget.VGSCardNumberEditText

class MainActivity : AppCompatActivity() {

    private lateinit var vgsForm:VGSCollect

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        vgsForm = VGSCollect(this, "<VAULT_ID>", Environment.<SANDBOX>)

        val submitBtn = findViewById<Button>(R.id.submitBtn)
        submitBtn?.setOnClickListener {
            submitData()
        }

        val cardNumberField = findViewById<VGSCardNumberEditText>(R.id.cardNumberField)
        vgsForm.bindView(cardNumberField)
    }

    private fun submitData() {
        vgsForm.asyncSubmit("/post", HTTPMethod.POST)
    }

    override fun onDestroy() {
        super.onDestroy()
    }
}
This is a sample VGS echo server.
This is a HTTP port number to access.
This is an example of your API endpoint.
This is an example of your Credit reporting API endpoint.
This is an example of your Issuing platform API endpoint.
This is alias which you receive on redact step from your payload value. Please observe the code snippet of redact step.
More about the aliases available formats you can read at nomenclature page.
This is alias which you receive on redact step from your payload value. Please have a look on code snippet of redact step.
More about the available formats of alias you can read here.
This is a sample vault id.
Sign in to see your personalized example.
This is a vault id.
Sign in to see your personalized example.
This is a vault id.
Sign in to see your personalized example.
This is your vault id.
These are an access credentials for a sample test vault.
These are an access credentials for a sample test vault.
This is a placeholder for your access credentials.
This is a sample vault url.
Sign in to see your personalized example.
This is a sample proxy vault url.
This is your vault url.
This is your proxy vault url.
This is a sample vault host.
This is your vault host.
This is your current Organization ID.
A pre-generated JS script placeholder for your current organization.
Sign in to see your personalized example.
A pre-generated JS script placeholder for your current organization.
Please talk to support in order to enable it for this organization.
This is your pre-generated JS script for your current organization.
The unique name that identifies a specific iframe.
Unique client ID used for VGS CLI authentication.
Please contact VGS Support in order to enable it for your organization.
Client secret used for VGS CLI authentication.
Please contact VGS Support in order to enable it for your organization.
Version of the CLI published on quay.io.
Command on the VGS CLI.
This is a full path to the certificate file.
This option allows curl to proceed without providing a TLS certificate. If you'd like to include your certificate, use --cacert [FILE].

End Session

Finish work with VGSCollect by calling onDestroy inside android onDestroy callback:

import com.verygoodsecurity.vgscollect.core.Environment
import com.verygoodsecurity.vgscollect.core.VGSCollect
import com.verygoodsecurity.vgscollect.widget.VGSCardNumberEditText

class MainActivity : AppCompatActivity() {

    private lateinit var vgsForm:VGSCollect

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        vgsForm = VGSCollect(this, "<VAULT_ID>", Environment.<SANDBOX>)

        val submitBtn = findViewById<Button>(R.id.submitBtn)
        submitBtn?.setOnClickListener {
            submitData()
        }

        val cardNumberField = findViewById<VGSCardNumberEditText>(R.id.cardNumberField)
        vgsForm.bindView(cardNumberField)
    }

    private fun submitData() {
        vgsForm.asyncSubmit("/post", HTTPMethod.POST)
    }

    override fun onDestroy() {
        vgsForm.onDestroy()
        super.onDestroy()
    }
}
This is a sample VGS echo server.
This is a HTTP port number to access.
This is an example of your API endpoint.
This is an example of your Credit reporting API endpoint.
This is an example of your Issuing platform API endpoint.
This is alias which you receive on redact step from your payload value. Please observe the code snippet of redact step.
More about the aliases available formats you can read at nomenclature page.
This is alias which you receive on redact step from your payload value. Please have a look on code snippet of redact step.
More about the available formats of alias you can read here.
This is a sample vault id.
Sign in to see your personalized example.
This is a vault id.
Sign in to see your personalized example.
This is a vault id.
Sign in to see your personalized example.
This is your vault id.
These are an access credentials for a sample test vault.
These are an access credentials for a sample test vault.
This is a placeholder for your access credentials.
This is a sample vault url.
Sign in to see your personalized example.
This is a sample proxy vault url.
This is your vault url.
This is your proxy vault url.
This is a sample vault host.
This is your vault host.
This is your current Organization ID.
A pre-generated JS script placeholder for your current organization.
Sign in to see your personalized example.
A pre-generated JS script placeholder for your current organization.
Please talk to support in order to enable it for this organization.
This is your pre-generated JS script for your current organization.
The unique name that identifies a specific iframe.
Unique client ID used for VGS CLI authentication.
Please contact VGS Support in order to enable it for your organization.
Client secret used for VGS CLI authentication.
Please contact VGS Support in order to enable it for your organization.
Version of the CLI published on quay.io.
Command on the VGS CLI.
This is a full path to the certificate file.
This option allows curl to proceed without providing a TLS certificate. If you'd like to include your certificate, use --cacert [FILE].

Handling Responses

To read response you need to implement VgsCollectResponseListener:

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)

    vgsForm = VGSCollect(this, "<VAULT_ID>", Environment.<SANDBOX>)

    val submitBtn = findViewById<Button>(R.id.submitBtn)
    submitBtn?.setOnClickListener {
        submitData()
    }

    val cardNumberField = findViewById<VGSCardNumberEditText>(R.id.cardNumberField)
    vgsForm.bindView(cardNumberField)

    vgsForm.addOnResponseListeners(object : VgsCollectResponseListener {
        override fun onResponse(response: VGSResponse?) {
            when(response) {
                is VGSResponse.SuccessResponse -> {
                    val successCode = response.successCode
                    val rawResponse = response.rawResponse
                }
                is VGSResponse.ErrorResponse -> {
                    val errorCode = response.errorCode
                    val localizeMessage = response.localizeMessage
                }
            }
        }
    })
}
This is a sample VGS echo server.
This is a HTTP port number to access.
This is an example of your API endpoint.
This is an example of your Credit reporting API endpoint.
This is an example of your Issuing platform API endpoint.
This is alias which you receive on redact step from your payload value. Please observe the code snippet of redact step.
More about the aliases available formats you can read at nomenclature page.
This is alias which you receive on redact step from your payload value. Please have a look on code snippet of redact step.
More about the available formats of alias you can read here.
This is a sample vault id.
Sign in to see your personalized example.
This is a vault id.
Sign in to see your personalized example.
This is a vault id.
Sign in to see your personalized example.
This is your vault id.
These are an access credentials for a sample test vault.
These are an access credentials for a sample test vault.
This is a placeholder for your access credentials.
This is a sample vault url.
Sign in to see your personalized example.
This is a sample proxy vault url.
This is your vault url.
This is your proxy vault url.
This is a sample vault host.
This is your vault host.
This is your current Organization ID.
A pre-generated JS script placeholder for your current organization.
Sign in to see your personalized example.
A pre-generated JS script placeholder for your current organization.
Please talk to support in order to enable it for this organization.
This is your pre-generated JS script for your current organization.
The unique name that identifies a specific iframe.
Unique client ID used for VGS CLI authentication.
Please contact VGS Support in order to enable it for your organization.
Client secret used for VGS CLI authentication.
Please contact VGS Support in order to enable it for your organization.
Version of the CLI published on quay.io.
Command on the VGS CLI.
This is a full path to the certificate file.
This option allows curl to proceed without providing a TLS certificate. If you'd like to include your certificate, use --cacert [FILE].

More Information

In addition, there is some documentation you might want to read next about tracking changes or sending additional information.

See also: