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
Example
AI Agent — Instant Buy
React — Buy Now Button
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
Scenario Use One-time instant purchase ✅ registerAndInvokeIntent() Recurring / scheduled purchases ❌ Use registerIntent() + invokeIntent() separately Need to store mandate for later ❌ Use registerIntent() separately ”Buy Now” button ✅ registerAndInvokeIntent()
Error Handling
Code Cause Resolution PASSKEY_REJECTEDUser declined the passkey prompt Allow retry PASSKEY_UNAVAILABLEDevice doesn’t support WebAuthn Inform user CARD_NOT_FOUNDCard ID is invalid or removed Refresh card list MANDATE_VIOLATIONInvalid params Check amount/merchant
Next Steps