Overview
The registerIntent() method registers a payment intent (mandate). Internally it maps the merchant to an MCC code, generates a card network mandate, and prompts the user to approve via passkey.
Returns an intentId that the AI App uses to invoke purchases — immediately, on a schedule, or recurring.
Requires Passkey : This method triggers biometric/device authentication to ensure the user explicitly authorizes the purchase.
Method Signature
prava . registerIntent ( params : RegisterIntentParams ): Promise < RegisterIntentResult >
Parameters
params
RegisterIntentParams
required
Card to charge (from collectPAN() or listCards())
Merchant name (mapped to MCC internally by Prava’s merchant directory)
ISO 4217 currency code (USD, EUR, etc.)
URL of the product/service
Max number of times this intent can be invoked. 1 = one-time, omit = unlimited
one-time · daily · weekly · monthly — for recurring intents
ISO 8601 expiry. Intent cannot be invoked after this date
Return Value
Unique identifier for this intent
Resolved Merchant Category Code (e.g., "5812")
Internal card network mandate reference
Example
import { PravaSDK } from '@prava-sdk/core' ;
const prava = new PravaSDK ({ publishableKey: 'pk_live_xxx' });
// User says: "Order me food from Uber Eats every week"
const intent = await prava . registerIntent ({
cardId: 'enr_abc123' ,
merchant: 'Uber Eats' ,
amount: 25.00 ,
currency: 'USD' ,
itemCount: 1 ,
productUrl: 'https://ubereats.com/order/xyz' ,
useLimit: 5 ,
frequency: 'weekly' ,
});
console . log ( intent . intentId ); // "int_m7kx9..."
console . log ( intent . status ); // "approved"
console . log ( intent . mcc ); // "5812" (Eating Places, Restaurants)
Under the Hood
When you call registerIntent():
Merchant Resolution
SDK resolves the merchant name → MCC code via Prava’s merchant directory.
Mandate Generation
A card network mandate is generated with the specified constraints (amount, merchant, frequency, limits).
Passkey Prompt
The user’s device triggers a passkey prompt (WebAuthn) for biometric/device confirmation.
Mandate Activation
On approval, the mandate is activated with the card network.
Result
The intentId is returned — your AI App stores this to invoke later.
Passkey Authentication Flow
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_VIOLATIONAmount/merchant doesn’t match constraints Check params
Best Practices
Use Limits and Frequency
// ✅ One-time purchase
await prava . registerIntent ({
cardId , merchant: 'Amazon' , amount: 29.99 , currency: 'USD' ,
useLimit: 1 ,
});
// ✅ Weekly recurring (max 4 times)
await prava . registerIntent ({
cardId , merchant: 'DoorDash' , amount: 50.00 , currency: 'USD' ,
useLimit: 4 , frequency: 'weekly' ,
});
// ✅ Open-ended with expiry
await prava . registerIntent ({
cardId , merchant: 'Spotify' , amount: 9.99 , currency: 'USD' ,
frequency: 'monthly' ,
expiresAt: '2027-01-01T00:00:00Z' ,
});
Next Steps