Official SDK for Lexiso - AP2 authorization for AI agent payments
npm install lexisoOfficial JavaScript SDK for Lexiso - AP2-compliant authorization for AI agent payments.
bash
npm install lexiso
`Quick Start
`javascript
const { Lexiso } = require('lexiso');const client = new Lexiso('sk_live_your_api_key');
// Authorize a purchase
const result = await client.authorize('agent_xxx', 25.00, {
merchant: 'Amazon',
category: 'shopping'
});
console.log(result.decision); // 'allow' or 'deny'
console.log(result.signature); // Cryptographic proof
`AP2 Mandate Flow
`javascript
// 1. User creates intent
const intent = await client.createIntent('agent_xxx', 'Buy coffee under $10', {
max_amount: 10.00,
categories: ['food', 'beverage']
});// 2. Agent proposes cart
const cart = await client.createCart('agent_xxx', intent.id, [
{ name: 'Latte', price: 5.50, quantity: 1 }
], 'Starbucks');
console.log(cart.decision); // 'allow' or 'deny'
`API Reference
$3
- createAgent(name, platform) - Register an AI agent
- listAgents() - List all agents
- revokeAgent(agentId) - Revoke an agent$3
- createPolicy(agentId, name, rules, currency) - Create spending policy
- listPolicies(agentId) - List policies
- updatePolicy(policyId, updates) - Update a policy$3
- authorize(agentId, amount, options) - Authorize a transaction$3
- createIntent(agentId, intent, constraints) - Create user intent
- createCart(agentId, intentId, items, merchant)` - Submit cart for approvalMIT