Skip to main content

After Checkout Verification

After checkout verification allows customers to complete their order first, then verify their ID on the order confirmation page. This is the recommended approach for most stores.

How it works

  1. Customer shops and completes checkout normally
  2. On the order confirmation page, they see the ID verification prompt
  3. Customer uploads their ID and completes verification
  4. Order is held until verification is complete

Setup

Step 1: Install the Real ID App

  1. Visit the Real ID app listing in the BigCommerce App Marketplace
  2. Click Install and authorize the app for your store
  3. You'll be redirected to the Real ID dashboard

Step 2: Configure After Checkout Flow

  1. In the Real ID dashboard, go to Settings > Automations
  2. Enable Automated ID checks
  3. Select After checkout as your verification flow (this is the default)
  4. Configure your trigger rules (see Built-in Triggers below)
  5. Click Save

That's it! The Real ID verification script is automatically installed on your order confirmation page.

Built-in Triggers

Configure which orders should trigger ID verification. These options require no code - just toggle them on in the Real ID dashboard.

Check all orders

Require ID verification for every order. When enabled, all other trigger rules are ignored.

Order value threshold

Require ID verification only for orders above a certain amount. Set your minimum order value (e.g., $100) and only high-value orders will require verification.

Address mismatch

Require ID verification when the shipping and billing addresses don't match. This is a common fraud indicator and helps verify the customer's identity when there's a discrepancy.

Product categories

Require ID verification for orders containing products from specific categories. Select which product categories should trigger verification - useful for age-restricted items like alcohol, tobacco, or firearms.

U.S. shipping states

Require ID verification only for orders shipping to the United States. You can further narrow this to specific states - useful for complying with state-specific regulations.

Combining Triggers

When multiple triggers are enabled, verification is required if any rule matches. For example, if you enable both "Order value threshold ($100)" and "Address mismatch", a $50 order with mismatched addresses OR a $150 order with matching addresses will both require verification.

Customer experience

When after checkout verification is enabled:

  • Customers complete their purchase normally
  • The verification prompt appears on the order confirmation page
  • Customers can verify immediately or return later via email link
  • Already-verified customers are recognized automatically

Frequently Asked Questions

What happens if a customer doesn't complete verification?

The order remains in your system but is flagged as pending verification. You can configure automatic reminder emails to prompt customers to complete their verification.

Can I customize when verification is required?

Yes! Use the built-in triggers above to configure rules based on order value, address mismatch, specific product categories, or customer location. For more complex conditions, see the Custom Trigger Scripts section below.

What if a customer closes the page before verifying?

Real ID automatically sends an email with a link to complete verification. You can also configure automatic reminders.

Do returning customers need to verify again?

No. Real ID remembers verified customers. When they return and place another order, they're automatically recognized and won't need to verify again.

Custom Trigger Scripts

For merchants who need custom trigger logic beyond the built-in options, you can create scripts that conditionally trigger ID verification using the Real ID JS SDK based on order details.

SDK and Order Data Already Loaded

The Real ID SDK and order data are automatically loaded on your order confirmation page when you enable after checkout verification. You only need to add a custom script with your trigger logic - no need to add the SDK or modify your theme.

How Custom Triggers Work

  1. Your custom script fetches order details using the BigCommerce Storefront API
  2. If conditions are met, your script calls RealID.createFlow() to trigger verification
  3. The SDK handles the rest - displaying the verification UI and processing the result

Adding a Custom Trigger Script

  1. In BigCommerce admin, go to Storefront > Script Manager
  2. Click Create a Script
  3. Fill in the following:
    • Name: Real ID Custom Trigger
    • Description: Custom ID verification trigger
    • Location on page: Footer
    • Select pages where script will be added: Order Confirmation
    • Script category: Essential
    • Script type: Script
  4. Paste one of the example scripts below
  5. Click Save
Using the Store Hash

The order confirmation page already has the store hash available via window.realIdOrderData.store_hash (set automatically by the Real ID app). The examples below use this value directly.

Example 1: Specific State AND Product Category (Combined)

Trigger verification only when BOTH conditions are met: shipped to California AND order contains products from specific categories.

<script>
// Helper: Wait for an element to appear in the DOM
function waitForSelector(selector, timeoutMs) {
timeoutMs = timeoutMs || 30000;
return new Promise(function(resolve) {
var existing = document.querySelector(selector);
if (existing) { resolve(existing); return; }
var observer = new MutationObserver(function(mutations, obs) {
var element = document.querySelector(selector);
if (element) { obs.disconnect(); resolve(element); }
});
observer.observe(document.body, { childList: true, subtree: true });
setTimeout(function() { observer.disconnect(); resolve(null); }, timeoutMs);
});
}

// Real ID - Verify orders shipping to CA with products in specific categories
(async function() {
var REQUIRED_STATE = 'CA'; // State code to require verification
var REQUIRED_CATEGORY_IDS = [23, 45, 67]; // Customize with your category IDs
console.log('Real ID: Checking for state=' + REQUIRED_STATE + ' AND categories=' + REQUIRED_CATEGORY_IDS.join(', '));

// Check for order data
if (!window.realIdOrderData || !window.realIdOrderData.order_id) {
console.log('Real ID: No order data found');
return;
}

try {
// Step 1: Fetch order and check shipping state
var response = await fetch('/api/storefront/orders/' + window.realIdOrderData.order_id);
var order = await response.json();

// Get shipping consignment for address info
var shippingConsignment = order.consignments &&
order.consignments.shipping &&
order.consignments.shipping[0];
var displayAddress = shippingConsignment || order.billingAddress;

if (!displayAddress) {
console.log('Real ID: No address found');
return;
}

console.log('Real ID: Shipping to ' + displayAddress.stateOrProvince + ', ' + displayAddress.country);

// Get state code
var stateCode = (order.billingAddress && order.billingAddress.stateOrProvinceCode) ||
(shippingConsignment && shippingConsignment.stateOrProvinceCode) ||
displayAddress.stateOrProvince;
var countryCode = (order.billingAddress && order.billingAddress.countryCode) ||
(shippingConsignment && shippingConsignment.countryCode) ||
displayAddress.country;

var isUS = countryCode === 'US' || countryCode === 'United States';
var stateMatches = isUS && stateCode === REQUIRED_STATE;

if (!stateMatches) {
console.log('Real ID: State code "' + stateCode + '" does not match ' + REQUIRED_STATE + ', skipping verification');
return;
}

console.log('Real ID: State matches ' + REQUIRED_STATE + ', checking product categories...');

// Step 2: Extract product IDs from order
var productIds = [];
var physicalItems = (order.lineItems && order.lineItems.physicalItems) || [];
physicalItems.forEach(function(item) {
if (item.productId) {
productIds.push(item.productId);
}
});

if (productIds.length === 0) {
console.log('Real ID: No products found in order');
return;
}

// Fetch Storefront API token from Real ID
var tokenResponse = await fetch('https://real-id.getverdict.com/api/bc/shops/' +
window.realIdOrderData.store_hash + '/storefront-token');
var tokenData = await tokenResponse.json();
if (!tokenData.token) {
console.log('Real ID: Could not fetch storefront token');
return;
}

var query = '{ site { products(entityIds: [' + productIds.join(',') + '], first: 50) { edges { node { entityId categories { edges { node { entityId } } } } } } } }';
var gqlResponse = await fetch('/graphql', {
method: 'POST',
credentials: 'same-origin',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + tokenData.token
},
body: JSON.stringify({ query: query })
});
var gqlData = await gqlResponse.json();

var products = gqlData.data && gqlData.data.site && gqlData.data.site.products && gqlData.data.site.products.edges || [];
var categoryMatches = products.some(function(productEdge) {
var categories = productEdge.node.categories && productEdge.node.categories.edges || [];
return categories.some(function(catEdge) {
return REQUIRED_CATEGORY_IDS.includes(catEdge.node.entityId);
});
});

if (!categoryMatches) {
console.log('Real ID: No products in required categories, skipping verification');
return;
}

console.log('Real ID: Both conditions met! Triggering verification');

// Wait for the order confirmation heading
var heading = await waitForSelector('[data-test="order-confirmation-heading"]');
if (heading) {
RealID.createFlow({
target: '[data-test="order-confirmation-heading"]',
mode: 'full',
shopName: window.realIdOrderData.store_hash,
email: order.billingAddress.email,
firstName: order.billingAddress.firstName,
lastName: order.billingAddress.lastName
});
}
} catch (e) {
console.error('Real ID: Error checking conditions', e);
}
})();
</script>
Finding Category IDs

To find your category IDs, go to Products > Product Categories in your BigCommerce admin. Click on a category - the ID is shown in the URL (e.g., /manage/categories/23 means the ID is 23).

Example 2: Specific State AND Custom Field (Combined)

Trigger verification only when BOTH conditions are met: shipped to California AND order contains products with the id_verification_required custom field.

<script>
// Helper: Wait for an element to appear in the DOM
function waitForSelector(selector, timeoutMs) {
timeoutMs = timeoutMs || 30000;
return new Promise(function(resolve) {
var existing = document.querySelector(selector);
if (existing) { resolve(existing); return; }
var observer = new MutationObserver(function(mutations, obs) {
var element = document.querySelector(selector);
if (element) { obs.disconnect(); resolve(element); }
});
observer.observe(document.body, { childList: true, subtree: true });
setTimeout(function() { observer.disconnect(); resolve(null); }, timeoutMs);
});
}

// Real ID - Verify orders shipping to CA with products that have "id_verification_required" custom field
(async function() {
var REQUIRED_STATE = 'CA'; // State code to require verification
var CUSTOM_FIELD_NAME = 'id_verification_required'; // Custom field name
console.log('Real ID: Checking for state=' + REQUIRED_STATE + ' AND custom field="' + CUSTOM_FIELD_NAME + '"');

// Check for order data
if (!window.realIdOrderData || !window.realIdOrderData.order_id) {
console.log('Real ID: No order data found');
return;
}

try {
// Step 1: Fetch order and check shipping state
var response = await fetch('/api/storefront/orders/' + window.realIdOrderData.order_id);
var order = await response.json();

// Get shipping consignment for address info
var shippingConsignment = order.consignments &&
order.consignments.shipping &&
order.consignments.shipping[0];
var displayAddress = shippingConsignment || order.billingAddress;

if (!displayAddress) {
console.log('Real ID: No address found');
return;
}

console.log('Real ID: Shipping to ' + displayAddress.stateOrProvince + ', ' + displayAddress.country);

// Get state code
var stateCode = (order.billingAddress && order.billingAddress.stateOrProvinceCode) ||
(shippingConsignment && shippingConsignment.stateOrProvinceCode) ||
displayAddress.stateOrProvince;
var countryCode = (order.billingAddress && order.billingAddress.countryCode) ||
(shippingConsignment && shippingConsignment.countryCode) ||
displayAddress.country;

var isUS = countryCode === 'US' || countryCode === 'United States';
var stateMatches = isUS && stateCode === REQUIRED_STATE;

if (!stateMatches) {
console.log('Real ID: State code "' + stateCode + '" does not match ' + REQUIRED_STATE + ', skipping verification');
return;
}

console.log('Real ID: State matches ' + REQUIRED_STATE + ', checking product custom fields...');

// Step 2: Extract product IDs from order
var productIds = [];
var physicalItems = (order.lineItems && order.lineItems.physicalItems) || [];
physicalItems.forEach(function(item) {
if (item.productId) {
productIds.push(item.productId);
}
});

if (productIds.length === 0) {
console.log('Real ID: No products found in order');
return;
}

console.log('Real ID: Found product IDs: ' + productIds.join(', '));

// Fetch Storefront API token from Real ID
var tokenResponse = await fetch('https://real-id.getverdict.com/api/bc/shops/' +
window.realIdOrderData.store_hash + '/storefront-token');
var tokenData = await tokenResponse.json();
if (!tokenData.token) {
console.log('Real ID: Could not fetch storefront token');
return;
}

var query = '{ site { products(entityIds: [' + productIds.join(',') + '], first: 50) { edges { node { entityId customFields { edges { node { name value } } } } } } } }';
var gqlResponse = await fetch('/graphql', {
method: 'POST',
credentials: 'same-origin',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + tokenData.token
},
body: JSON.stringify({ query: query })
});
var gqlData = await gqlResponse.json();

var products = gqlData.data && gqlData.data.site && gqlData.data.site.products && gqlData.data.site.products.edges || [];
var customFieldMatches = products.some(function(productEdge) {
var customFields = productEdge.node.customFields && productEdge.node.customFields.edges || [];
return customFields.some(function(fieldEdge) {
return fieldEdge.node.name === CUSTOM_FIELD_NAME &&
fieldEdge.node.value.toLowerCase() === 'true';
});
});

if (!customFieldMatches) {
console.log('Real ID: No products have "' + CUSTOM_FIELD_NAME + '" = true, skipping verification');
return;
}

console.log('Real ID: Both conditions met! Triggering verification');

// Wait for the order confirmation heading
var heading = await waitForSelector('[data-test="order-confirmation-heading"]');
if (heading) {
RealID.createFlow({
target: '[data-test="order-confirmation-heading"]',
mode: 'full',
shopName: window.realIdOrderData.store_hash,
email: order.billingAddress.email,
firstName: order.billingAddress.firstName,
lastName: order.billingAddress.lastName
});
}
} catch (e) {
console.error('Real ID: Error checking conditions', e);
}
})();
</script>
Creating Custom Fields

To add a custom field to a product:

  1. Go to Products > View in BigCommerce admin
  2. Edit the product
  3. Scroll to Custom Fields
  4. Add a field with name id_verification_required and value true
  5. Save the product
Combining Conditions

These examples demonstrate AND logic - both conditions must be true. You can adapt this pattern to combine any conditions:

  • Change REQUIRED_STATE to any US state code (e.g., 'NY', 'TX')
  • Add multiple states by changing the check to ['CA', 'NY'].includes(stateCode)
  • Combine with order total checks by adding order.orderAmount >= MINIMUM_AMOUNT

Learn More

For more information about the Real ID JS SDK, including theming options and prepopulating customer data, see our JavaScript SDK documentation.