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
Parameter | Type | Required | Description |
---|---|---|---|
tenantId | string | Yes | The tenant id that owns the purchase intent |
purchaseIntentId | string | Yes | The 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
Property | Type | Description |
---|---|---|
id | string | The purchase intent id. |
entityId | string | The ID for the entity that owns the purchase intent. |
credentialType | string | The purchase intent credential type. |
status | string | The purchase intent status: active , verify or unavailable . |
createdAt | datetime | The purchase intent credential created date. |
expiresAt | datetime | The purchase intent expiration date for the credential. |