Skip to main content

Overview

The registerAndInvokeIntent() method registers an intent and invokes it in a single call. The user approves via passkey once, and you immediately get payment tokens back. Best for: instant “Buy Now” flows where the AI doesn’t need to store a mandate for later.
Internally this calls registerIntent() then invokeIntent() in sequence. The passkey prompt fires once.

Method Signature

prava.registerAndInvokeIntent(params: RegisterAndInvokeParams): Promise<PaymentTokens>

Parameters

params
RegisterAndInvokeParams
required

Return Value

tokens
PaymentTokens

Example

import { PravaSDK } from '@prava-sdk/core';

const prava = new PravaSDK({ publishableKey: 'pk_live_xxx' });

// User says "Buy this" → one call → done
const tokens = await prava.registerAndInvokeIntent({
  cardId: 'enr_abc123',
  merchant: 'Amazon',
  amount: 29.99,
  currency: 'USD',
  itemCount: 1,
  productUrl: 'https://amazon.com/dp/B0EXAMPLE',
});

// tokens.pan, tokens.expMonth, tokens.expYear, tokens.cvv
// → Hand these to the checkout flow
console.log('Virtual PAN:', tokens.pan);

When to Use

ScenarioUse
One-time instant purchaseregisterAndInvokeIntent()
Recurring / scheduled purchases❌ Use registerIntent() + invokeIntent() separately
Need to store mandate for later❌ Use registerIntent() separately
”Buy Now” buttonregisterAndInvokeIntent()

Error Handling

CodeCauseResolution
PASSKEY_REJECTEDUser declined the passkey promptAllow retry
PASSKEY_UNAVAILABLEDevice doesn’t support WebAuthnInform user
CARD_NOT_FOUNDCard ID is invalid or removedRefresh card list
MANDATE_VIOLATIONInvalid paramsCheck amount/merchant

Next Steps