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.

Example

import { btAi } from '@btai/js-sdk';
 
// ... get signed jwt from your backend
 
// initialize sdk
const btAi = await btAi.init(jwt);
const purchaseIntent = verifyPurchaseIntent("tenant_1234", "purchase_intent_1234");

Parameters

ParameterTypeRequiredDescription
tenantIdstringYesThe tenant 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",
  "entityId": "94c94330-94fd-4832-a106-e8474a274fe4",
  "credentialType": "network-token",
  "status": "active",
  "token": {
    "number": "2222030198005808",
    "expirationMonth": "07",
    "expirationYear": "2028",
    "cryptogram": "AAnSCQ9UvB3WAA4IVFwEAAADFA=="
  },
  "createdAt": "2025-06-16T14:00:00Z",
  "expiresAt": "2025-06-13T18:42:01Z"
}

Response Properties

PropertyTypeDescription
idstringThe purchase intent id.
entityIdstringThe ID for the entity that owns the purchase intent.
credentialTypestringThe purchase intent credential type.
statusstringThe purchase intent status: active, verify or unavailable.
createdAtdatetimeThe purchase intent credential created date.
expiresAtdatetimeThe purchase intent expiration date for the credential.