@aureahub/agent-pay
v0.1.0
Published
Aurea agentic-payments SDK + embeddable commerce widget (Product A).
Maintainers
Readme
@aureahub/agent-pay
Aurea agentic-payments SDK + embeddable commerce widget (Product A). Lets a
company integrate AI-assisted checkout that settles into its Aurea Pay account —
the same way @aureahub/pay integrates payments.
Install
npm install @aureahub/agent-paySDK (typed API client)
import { createClient } from '@aureahub/agent-pay'
const client = createClient({
baseUrl: 'https://api.aureahub.com',
token: '<session token>', // or merchantKey: '<scoped key>'
})
// Merchant: publish a product feed for a merchant agent.
await client.feed(agentId, [
{ sku: 'TSHIRT', name: 'T-Shirt', price: '19.99', currency: 'EUR' },
])
// Shopper/agent: build a cart -> cart mandate -> settle (split optional).
const session = await client.createCheckout({
agentId,
items: [{ sku: 'TSHIRT', quantity: 2 }],
})
const result = await client.completeCheckout(session.checkoutId, {
recipient: '0xMERCHANT_PAYOUT',
splits: [
{ partyType: 'merchant', recipient: '0xMERCHANT', amount: '37.98' },
{ partyType: 'fee', recipient: '0xPLATFORM', amount: '2.00' },
],
})Every checkout is locked as a cart mandate and settled through the Aurea policy engine (spend controls, KYA, step-up). Totals are computed server-side with exact decimal arithmetic.
Embeddable widget
<div id="aurea-widget"></div>
<script src="https://cdn.aureahub.com/agent-pay/widget.global.js"></script>
<script>
const client = AureaAgentPay.createClient({ baseUrl: 'https://api.aureahub.com', token })
AureaAgentPay.mountWidget('#aurea-widget', {
client,
agentId: 'MERCHANT_AGENT_ID',
merchantRecipient: '0xMERCHANT_PAYOUT',
})
</script>The widget is Aurea-branded, shows the EU AI-Act disclosure, and renders the
product list → cart → policy-gated checkout. See demo.html.
Pay by card (Stripe)
Set enableCard: true to add a Pay by card button. Card checkout opens a
hosted Stripe Checkout Session and redirects the shopper, so buyers without an
Aurea wallet can pay by card; funds settle to the merchant's connected
account. Crypto checkout remains the other option.
AureaAgentPay.mountWidget('#aurea-widget', {
client, agentId, merchantRecipient,
enableCard: true,
successUrl: 'https://shop.example/done',
cancelUrl: 'https://shop.example/cart',
})Embeddable merchant management
Merchants can manage their account + agent from inside an external app such as Aurea Pay — no Aurea admin needed.
<div id="aurea-manage"></div>
<script src="https://cdn.aureahub.com/agent-pay/manage.global.js"></script>
<script>
const client = AureaAgentManage.createManagementClient({
baseUrl: 'https://api.aureahub.com', token,
})
AureaAgentManage.mountDashboard('#aurea-manage', { client })
</script>createManagementClient is the typed API surface (agents, policies, mandates,
credentials, feed, analytics, tenant enablement). mountDashboard renders a
branded dashboard: enablement toggle, agents (create + per-agent spend policy),
and recent spend. See demo-manage.html.
Build
npm run build # dist/index.{js,cjs,d.ts} + widget.global.js + manage.global.js
npm test