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

# Shopify

> Verify customer identities during Shopify checkout and account creation.

The Shopify integration adds identity verification to your Shopify store. Require KYC for high-value orders, age-restricted products, or new customer account creation.

## Prerequisites

* A Shopify store on the Basic plan or above
* Shopify admin access to create custom apps
* Verilock Business or Enterprise plan

## Setup

<Steps>
  <Step title="Create a Custom App">
    In your Shopify admin, go to **Settings > Apps and sales channels > Develop apps**. Click **Create an app** and name it `Verilock Identity`.
  </Step>

  <Step title="Configure API Scopes">
    Under **Configuration**, add the following Admin API scopes:

    | Scope             | Purpose                                             |
    | ----------------- | --------------------------------------------------- |
    | `read_customers`  | Access customer data for verification               |
    | `write_customers` | Update customer metafields with verification status |
    | `read_orders`     | Access order data for checkout verification         |
    | `write_orders`    | Tag orders with verification status                 |

    Click **Save** and then **Install app**.
  </Step>

  <Step title="Copy Access Token">
    After installation, copy the **Admin API access token**. This token is shown only once, so store it securely.
  </Step>

  <Step title="Configure in Verilock">
    Go to **Dashboard > Settings > Integrations > Shopify** and enter:

    * **Shop Domain**: `your-store.myshopify.com`
    * **Access Token**: The Admin API access token
    * **Webhook Secret**: Auto-generated, copy this for your Shopify webhook configuration
  </Step>

  <Step title="Configure Shopify Webhooks">
    In Shopify admin, go to **Settings > Notifications > Webhooks**. Create webhooks for:

    * `customers/create` pointing to `https://verilock.io/api/v1/integrations/shopify/webhook`
    * `orders/create` pointing to the same URL

    Use the webhook secret from step 4 for HMAC verification.
  </Step>

  <Step title="Test Connection">
    Click **Test Connection** in the Verilock dashboard. Create a test customer in Shopify to verify the end-to-end flow.
  </Step>
</Steps>

## Verification Triggers

<Tabs>
  <Tab title="Account Creation">
    When a new customer registers, Verilock sends them an email with a verification link. The customer's account is tagged as `verilock:pending` until verification completes.

    | Setting                | Description                           | Default |
    | ---------------------- | ------------------------------------- | ------- |
    | `verify_on_register`   | Require verification for new accounts | `false` |
    | `verification_profile` | Profile to use                        | `basic` |
    | `block_until_verified` | Prevent orders until verified         | `false` |
  </Tab>

  <Tab title="Checkout">
    For orders matching configured rules, customers are redirected to the Verilock verification flow before payment. The order is held until verification completes.

    | Setting                | Description                                                  | Default    |
    | ---------------------- | ------------------------------------------------------------ | ---------- |
    | `order_threshold`      | Minimum order total to trigger verification                  | Disabled   |
    | `product_tags`         | Product tags requiring verification (e.g., `age-restricted`) | None       |
    | `verification_profile` | Profile to use                                               | `standard` |
  </Tab>
</Tabs>

## Customer Metafields

Verilock stores verification results as Shopify customer metafields:

```json theme={null}
{
  "namespace": "verilock",
  "key": "verification_status",
  "value": "approved",
  "type": "single_line_text_field"
}
```

| Metafield Key                  | Type   | Description                                  |
| ------------------------------ | ------ | -------------------------------------------- |
| `verilock.verification_status` | String | `approved`, `declined`, `pending`, `expired` |
| `verilock.session_id`          | String | Verilock session ID                          |
| `verilock.verified_at`         | String | ISO 8601 timestamp                           |
| `verilock.risk_score`          | Number | Risk score (0-100)                           |

## Order Tags

Orders associated with verified customers are automatically tagged:

| Tag                 | Meaning                                         |
| ------------------- | ----------------------------------------------- |
| `verilock:verified` | Customer was verified before or during checkout |
| `verilock:pending`  | Verification is in progress                     |
| `verilock:declined` | Customer verification was declined              |

<Tip>
  Use Shopify Flow to automate actions based on these tags, such as auto-fulfilling verified orders or flagging declined orders for review.
</Tip>

## Shopify Flow Integration

If you use Shopify Flow, Verilock triggers are available as custom events:

1. **Verilock - Customer Verified**: Fires when a customer completes verification
2. **Verilock - Customer Declined**: Fires when a customer fails verification
3. **Verilock - High Risk Detected**: Fires when risk score exceeds your threshold

<Info>
  Shopify Flow is available on Shopify Plus or through the Shopify Flow app on Advanced plans.
</Info>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Verification email not sent">
    Check that the customer has a valid email address. Verify the Shopify `customers/create` webhook is active and pointing to the correct URL.
  </Accordion>

  <Accordion title="Order not held at checkout">
    Ensure the product tags or order threshold match your configuration. Review the Verilock integration logs in **Dashboard > Logs > Integrations**.
  </Accordion>

  <Accordion title="Metafields not updating">
    Verify the access token has `write_customers` scope. Check that the token has not been revoked in Shopify admin.
  </Accordion>
</AccordionGroup>
