Skip to main content

WordPress Hooks

You can use hooks to extend Real ID into your own WordPress code.

Webhooks also available

You can also use webhooks to subscribe to ID verification events as well.

ID verification status changes

You can subscribe in real time when customers submit their ID photos with the id_verification_status_changed hook.

This hook will fire whenever a customer's ID verification status changes.

Order status changes

This hook will also emit on order verification status changes. For example, if an already verified customer places another order, this hook will also fire, since this new order is now considered verified.

id_verification_status_changed

This hook will emit every single time a customer or order's ID verification status changes.

Parameters

This hook passes a single associative array:

  • check_id - the unique ID verification token tied to the customer
  • new_status - the status being applied to the order. See metadata for a complete list.
  • customer_id - the customer's WordPress user ID
  • order_id the WooCommerce order ID
Relies on webhooks

Metadata updates rely on your site being reachable by the Real ID service by webhook.

Webhooks are asynchronous checkout or order events, they may not happen at the same time as a new order being placed, etc.

Examples

This simple example will log these changes to your WooCommerce logs so you can see the trail of changes of ID verification status updates:

// Subscribing to the update, and logging the change to the WooCommerce Status Logs
add_action('id_verification_status_changed', function($params) {
$logger = wc_get_logger();

$logger->info('ID verification status changed for an order', [
"source" => "Real ID",
"new_status" => $params["new_status"],
"order_id" => $params["order_id"],
"customer_id" => $params["customer_id"],
"check_id" => $params["check_id"],
]);

}, 10, 1);

You can also use the order_id to retreive the current order details:

// Subscribing to the update, and retrieving the order associated with the ID check:
add_action('id_verification_status_changed', function($params) {
$order_id = $params["order_id"];

if(empty($order_id)) {
// it's possible that only the customer metadata is changing
return;
}

$order = get_wc_order($order_id);

// check the current fulfillment, payment statuses, etc.
}, 10, 1);

Frequently Asked Questions

Will this hook be called from new orders from already verified customers?

Yes, even though technically it's not an ID verification event by the customer, the order's metadata is updated with the ID check details on a new order by an already verified customer.

This hooks fires multiple times

Yes, it's possible for this hook to fire multiple times for the same event, this is by design to make sure that your metadata is up to date.

Please make sure your extension logic is idempotent and accounts for the possibility of multiple calls for the same event.

How is this hook called?

The Real ID service emits webhooks to your WordPress site when customers progress through ID verification.

This hook is delayed or isn't firing at all in our tests

Make sure your site is publicly accessible to the internet and you haven't recently change your site's home URL.

If you don't see any incoming webhooks from the Real ID service on your WordPress site whatsoever; then that most likely means that your site's URL has changed and it needs to be updated.

Contact our support if you continue to have issues with metadata or hooks not firing properly.