> ## Documentation Index
> Fetch the complete documentation index at: https://docs.argyle.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Implementation

> Integrating your VOIE solution.

This guide covers the technical implementation of Argyle's VOIE solution, to get you up and running quickly so you can...

* Verify income and employment with real-time data
* ...where data is sourced directly from your applicants' payroll providers
* ...in order to increase your conversion, reduce risk, and lower costs for your business.

## Add your company logo

After initial [sign-up](https://console.argyle.com/sign-up), access Argyle Console and navigate to **Settings** in the left sidebar. Make your first customization of Argyle Link by uploading your company name and logo from the [Company details](https://console.argyle.com/settings/company) tab.

![Image of your company logo shown to the user on the introduction screen of Argyle Link during the payroll connection process.](https://res.cloudinary.com/argyle-media/image/upload/f_auto/v1/docs-v2/voie-implementation-upload-logo)

## Initialize Argyle Link

Argyle Link is the portal through which your applicants connect their payroll accounts.

* Follow the steps below to embed Argyle Link in your website or application.
* Alternatively, you can use Argyle Console to [invite applicants via text or email](/legacy/guides/argyle-console/faq#how-to-invite-new-users). The invitation will include a URL that will connect the applicant to Argyle Link directly.

### Embedded Link configurations

Visit our embedding Link guides for [Web](/legacy/guides/argyle-link/embed/web), [iOS](/legacy/guides/argyle-link/embed/ios), [Android](/legacy/guides/argyle-link/embed/android), and [React Native](/legacy/guides/argyle-link/embed/react-native) to see how to include optional configuration parameters such as [callbacks](/legacy/api-reference/callbacks) and search limits.

Basic configurations:

<Tabs>
  <Tab title="Web">
    ```html theme={}
    <!DOCTYPE html>
    <html>

    <head>
        <meta charset="utf-8" />
    </head>

    <body>
        <script src="https://plugin.argyle.com/argyle.web.v3.js"></script>
        <script type="text/javascript">
         const argyle = Argyle.create ({
            linkKey: 'YOUR_LINK_KEY', // Found in Argyle Console
            apiHost: 'https://api-sandbox.argyle.com/v1', // Sandbox testing environment
            userToken: 'USER_TOKEN' // Used to authenticate users
         })
         argyle.open()
        </script>
    </body>

    </html>
    ```
  </Tab>

  <Tab title="iOS">
    ```swift theme={}
    class ViewController: UIViewController {

      override func viewDidLoad() {
        _ = Argyle.shared
          .loginWith (
            linkKey: "YOUR_LINK_KEY", // Found in Argyle Console
            apiHost: "https://api-sandbox.argyle.com/v1", // Sandbox testing environment
            userToken: "USER_TOKEN" // Used to authenticate users
          )
          .resultListener(self)
      }

      @IBAction func startArgyleFlow(_ sender: Any) {
        let argyle = Argyle.shared.controller
        argyle.modalPresentationStyle = .fullScreen
        self.present(argyle, animated: true, completion: nil)
      }
    }
    ```
  </Tab>

  <Tab title="Android">
    ```kotlin theme={}
    val config = ArgyleConfig.Builder()

        .loginWith (
              "YOUR_LINK_KEY", // Found in Argyle Console
              "https://api-sandbox.argyle.com/v1", // Sandbox testing environment
              "USER_TOKEN" // Used to authenticate users
        )
        .build()

    Argyle.instance.init(config)
    Argyle.instance.startSDK(this)
    ```
  </Tab>

  <Tab title="React Native">
    ```js theme={}
    import ArgyleSdk from '@argyleio/argyle-plugin-react-native'

    ArgyleSdk.loginWith(
        "YOUR_LINK_KEY", // Found in Argyle Console
        "https://api-sandbox.argyle.com/v1", // Sandbox testing environment
        "USER_TOKEN" // Used to authenticate users
      )

    // After configuring the SDK, call ArgyleSdk.start() when the UI is needed
    ArgyleSdk.start()
    ```
  </Tab>
</Tabs>

**Link Keys** — Link keys connect your embedded instance of Argyle Link to your Argyle account. Your Sandbox and Production link keys can be found in the [Link key section](https://console.argyle.com/link-key) of Argyle Console. Make sure the type of link key in your configuration matches the environment.

**Environment** — Argyle Link can run in two types of environments: Sandbox mode (for testing) or Production mode (for connecting real payroll accounts).

* Sandbox configurations use `https://api-sandbox.argyle.com/v1`
* Production configurations use `https://api.argyle.com/v1`

**User tokens** — Argyle utilizes user tokens to authenticate users (your applicants).

<Accordion title="How to create a user token for a first time user">
  1. Create a new user using the [users API endpoint](/legacy/api-reference/users#create)
  2. The response payload will include a `token` and `id`
  3. Save the `id` for quickly creating user tokens for this user in the future
  4. Initialize Argyle Link using the `token` as the user token in your configuration
</Accordion>

<Accordion title="How to create a user token for a returning user">
  1. Create a new user token using the [user-tokens API endpoint](/legacy/api-reference/users#create-token)
  2. The response payload will include an `access` and `refresh` token
  3. Initialize Argyle Link using *only* the `access` token as the user token in your configuration
</Accordion>

## Connect test accounts

In Argyle Link, your applicant would search for their employers or payroll providers and enter their login credentials to connect their accounts. Once successfully connected, Argyle retrieves the data from the connected payroll accounts and makes it available through Console or the API.

When the Sandbox environment is used, you can connect sample users to different payroll accounts through your embedded instance of Argyle Link (or [Flows](https://console.argyle.com/flows) in Console) using the test credentials below:

|                    | Bob                           | Sarah                         | Joe                           |
| ------------------ | ----------------------------- | ----------------------------- | ----------------------------- |
| Email              | test1<span>@</span>argyle.com | test2<span>@</span>argyle.com | test3<span>@</span>argyle.com |
| Username           | test\_1                       | test\_2                       | test\_3                       |
| Password           | passgood                      | passgood                      | passgood                      |
| Verification code  | 8081                          | 8082                          | 8083                          |
| Phone number       | (800) 900-0010                | (800) 900-0020                | (800) 900-0030                |
| Driver's license # | D1230010                      | D1230020                      | D1230030                      |

If a login field does not match one of the fields above, the closest field can be used. For example, a username value can be used for a "UserID" login field.

The sample data returned depends on what type of payroll account (gig or non-gig) was connected in the Sandbox environment.

## View data retrieval status

Argyle begins data retrieval immediately when a payroll account is successfully connected. The time it takes for all data to finish syncing depends on the length of employment:

![Argyle delivers retrieved data after a few seconds to a few hours, depending on the amount of historical data.](https://res.cloudinary.com/argyle-media/image/upload/f_auto/v1632295747/docs-v2/data%20scan%20times-v2)

When viewing data in Console (by clicking on an individual user within the [Connections](https://console.argyle.com/connections) page), spinning status circles will indicate if data is still syncing for a new payroll connection.

You can also monitor the progress of data retrieval by using the [accounts API endpoint](/legacy/api-reference/accounts) and checking the `status` field of the `availability` object. We recommend including the optional `onAccountConnected` [callback](/legacy/api-reference/callbacks#callbacks-reference) in your Link configuration to make automating this process easier.

## Retrieve payroll data

<Note>
  If you are using Console to retrieve payroll data, navigate to the [Connections](https://console.argyle.com/connections) page and click on an individual user to view data from their connected payroll accounts.
</Note>

If you are using the API to retrieve payroll data, visit our [API Reference](/legacy/api-reference/introduction) for more information.

<Accordion title="Retrieving employment data using the API (example)">
  1. Make a GET request to the [employments API endpoint](/legacy/api-reference/employments)
  2. (Optional) Include the query parameter account with the value `accountId`

  * The `accountId` is the ID of the recently connected payroll account
  * If you included the `onAccountConnected` [callback](/legacy/api-reference/callbacks#callbacks-reference) in your Link configuration, the callback automatically returns this `accountId` every time a user connects a new payroll account
  * You can also use the [accounts API endpoint](/legacy/api-reference/accounts) to find the `accountId` for the user

  Example GET request to the employment API endpoint using the Sandbox environment:

  ```text theme={}
  GET https://api-sandbox.argyle.com/v1/employments?account=021a1749-6973-4e47-a82a-307008ca88cc
  ```

  Example JSON response (employment object):

  ```json theme={}
  {
      "id": "857b4aad-1a55-4200-84f7-311cd3dc3432",
      "account": "021a1749-6973-4e47-a82a-307008ca88cc",
      "employer": "floormart",
      "created_at": "2022-01-24T17:29:08.724Z",
      "updated_at": "2022-01-24T17:29:08.724Z",
      "status": "active",
      "type": "part-time",
      "job_title": "cashier",
      "hire_datetime": "2018-10-27T17:29:08.724Z",
      "termination_datetime": null,
      "termination_reason": null,
      "base_pay": {
          "amount": 36400,
          "period": "annual",
          "currency": "USD"
      },
      "pay_cycle": "monthly",
      "platform_ids": {
          "employee_id": "47FJ06ON8",
          "position_id": "INA609028",
          "platform_user_id": "H3WTY0FHMQ24ERDN"
      },
      "metadata": {}
  }
  ```
</Accordion>

<Accordion title="Retrieving pay data using the API (example)">
  1. Make a GET request to the [payouts API endpoint](/legacy/api-reference/payouts)

  * A payout is the equivalent of a single paystub. You can also use the [income totals API endpoint](/legacy/api-reference/income-totals) for yearly pay totals.

  2. (Optional) Retrieve all payouts over a certain time period by include the `from_start_date` and `to_start_date` query parameters
  3. (Optional) Add the `account` query parameter to retrieve the payouts for an individual payroll account

  Example GET request to the payouts API endpoint using the Sandbox environment:

  ```text theme={}
  GET https://api-sandbox.argyle.com/v1/payouts?account=f8bf3e18-09ba-428c-b197-6798f1b2b834&from_start_date=2022-01-01&to_start_date=2022-02-01
  ```

  Example JSON response (payout object):

  ```json theme={}
  {
      "id": "a6b95412-e43a-4584-be9f-1dc101aa349a",
      "account": "f8bf3e18-09ba-428c-b197-6798f1b2b834",
      "document_id": "97f21592-b6b6-352a-91d7-e221bf0dd6e9",
      "employer": "ceilingmart",
      "status": "completed",
      "type": "direct_deposit",
      "payout_date": "2022-01-15T00:00:00Z",
      "payout_period": {
          "start_date": "2022-01-01T00:00:00Z",
          "end_date": "2022-01-31T00:00:00Z"
      },
      "currency": "USD",
      "gross_pay": "1730.77",
      "reimbursements": "279.87",
      "deductions": "68.68",
      "deduction_list": [
          {
              "amount": "68.68",
              "name": "Health Benefits - Pretax",
              "tax_classification": "pre_tax"
          }
      ],
      "taxes": "224.68",
      "tax_list": [
          {
              "amount": "171.28",
              "name": "Fed Withholdng",
              "type": "federal"
          },
          {
              "amount": "53.40",
              "name": "Fed OASDI/EE",
              "type": "fica"
          }
      ],
      "fees": null,
      "net_pay": "1717.28",
      "bonuses": "0.00",
      "commission": "0.00",
      "overtime": "0.00",
      "hours": "80.00",
      "employer_address": {
          "line1": "4 Jackson St",
          "line2": "Apt C",
          "city": "Norton",
          "state": "MA",
          "postal_code": "27660",
          "country": "US"
      },
      "filing_status": [
          {
              "type": "federal",
              "location": null,
              "status": "single"
          },
          {
              "type": "state",
              "location": "MD",
              "status": "single"
          }
      ],
      "metadata": {
          "hours_breakdown": [
              {
                  "hours": "80",
                  "amount": "1730.77",
                  "description": "Work Hours"
              }
          ]
      }
  }
  ```
</Accordion>

## Simulate a data update

For real payroll accounts connected using the Production environment, Argyle periodically scans for any new available data and makes it available through Console or the API.

For testing purposes, you can manually simulate a data update in Sandbox via the API.

The steps below will return 1-5 new payouts and activities for the payroll account of a Sandbox test user.

1. Send a POST request with an empty body to `https://api-sandbox.argyle.com/v1/accounts/<account_id>/periodic_scan`

2. Swap out the `<account_id>` in the request with the ID of the Sandbox account you want to receive the new data

<Note>
  This method is often used for [webhook](/legacy/api-reference/webhooks-overview) testing.
</Note>

## Set up notifications

Argyle uses webhooks to notify you when different events occur, such as a new payroll account connection or new data becoming available for an already connected payroll account.

You can subscribe to webooks from the [webhooks page](https://console.argyle.com/webhooks) in Console, or [using the API](/legacy/api-reference/webhooks-overview#subscribing-to-webhooks).

We recommend subscribing to the following webhooks to get started:

* `accounts.connected` notifies you when a payroll account connection attempt is successful.
* `accounts.failed` lets you know if a connection attempt failed, and provides error details for the event.
* `employments.added` will notify you if a user's employment information changes, for example as a result of them switching jobs or a change in their base pay.
* `payouts.partially_synced` notifies you when pay data is available for a specified number of `days_synced` — one month, one year, or two years, for example.

Visit our [Webhooks Reference](/legacy/api-reference/webhooks-overview) for a full list of available webhooks.

## Going live

When you are ready to transition from Sandbox testing to connecting real payroll accounts in Production mode, make the following adjustments:

<Note>
  If you are using Argyle Console to send invites and view payroll data, simply [flip the toggle switch](/legacy/guides/argyle-console/faq#sandbox-and-production-modes) in the upper left.
</Note>

1. Adjust your Argyle Link configuration to use `https://api.argyle.com/v1` instead of `https://api-sandbox.argyle.com/v1`

2. Swap the Sandbox link key to the Production link key in your Argyle Link configuration

3. Make API requests to `https://api.argyle.com/v1` instead of `https://api-sandbox.argyle.com/v1`
