Verify Purchase Intent

The verifyPurchaseIntent function handles payment verification and processing workflows. This function will start all of the consent flows (2FA and Passkey) to ensure a payment method is properly confirmed to allow full access to all credential types.

import { verifyPurchaseIntent } from '@basis-theory-ai/react';
 
async function handleVerification(projectId, intentId) {
  try {
    const result = await verifyPurchaseIntent(projectId, intentId);
    console.log('Verification result:', result);
    return result;
  } catch (error) {
    console.error('Verification failed:', error);
    throw error;
  }
}
 
function VerificationComponent({ projectId, purchaseIntentId }) {
  const { verifyPurchaseIntent } = useBasisTheory();
  
  const handleVerify = async () => {
    try {
      const result = await verifyPurchaseIntent(projectId, purchaseIntentId);
      console.log('Verification result:', result);
    } catch (error) {
      console.error('Verification failed:', error);
    }
  };

Parameters

ParameterTypeRequiredDescription
projectIdstringYesThe project id that owns the purchase intent
purchaseIntentIdstringYesThe ID of the purchase intent to verify

Return Value

Returns a Promise that resolves to a PurchaseIntentResult object:

{
  "id": "46c029d2-485a-4928-83b5-4326c4866722",
  "status": "active",
}

Response Properties

PropertyTypeDescription
idstringThe purchase intent id.
statusstringThe purchase intent status: active, verify or unavailable.