> For the complete documentation index, see [llms.txt](https://docs.verygoodsecurity.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verygoodsecurity.com/vault/developer-tools/vgs-collect/js/card-attribute-lookup-during-card-entry.md). Agents can also search and read this documentation through its [MCP server](https://docs.verygoodsecurity.com/~gitbook/mcp).

# Card Attribute Lookup During Card Entry

VGS Collect can provide your front-end insights into the card details. VGS will perform the card attribute lookup after the 11th digit is entered into the Card Number Field. Details on which attributes a card can get access to can be found [here](https://docs.verygoodsecurity.com/cmp/products-and-services/card-attributes).

## Step 1: Create Form and Select Attributes

In the VGS Dashboard, create a Collect Form and select all the attributes you wish to be included in the attribute lookup.

<figure><img src="https://2096104711-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUreALQAfVnRMQEz110rC%2Fuploads%2FPlgGkek2YDTR43pdFQvg%2Fimage.png?alt=media&amp;token=43862b8f-5e4e-4247-aba1-5410085e4d3f" alt=""><figcaption></figcaption></figure>

## Step 2: Implement Card Attribute Lookup Hooks on Collect Form

```javascript
const form = await VGSCollect.session({
  vaultId: 'tntYOUR_TENANT_ID',
  env: 'sandbox',
  formId: 'default',
  stateCallback: stateCallback.bind(state),
  authHandler: getVGSAuthToken,
  // error handler if config doesn't load
  onErrorCallback: (error) => {
    console.log(error);
  },
});

// Getting card attributes (success handler)
form.on('getCardAttributesSuccess', (lookup) => {
  console.log('getCardAttributesSuccess', lookup)
});

// Getting card attributes (error handler)
form.on('getCardAttributesError', (errors) => {
  console.log(errors)
});

// Fields
form.cardholderNameField('#cc-name .fake-input', {});
form.cardNumberField('#cc-number .fake-input', {});
form.cardExpirationDateField('#cc-exp-date .fake-input', {});
form.cardCVCField('#cc-cvc .fake-input', {});
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.verygoodsecurity.com/vault/developer-tools/vgs-collect/js/card-attribute-lookup-during-card-entry.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
