@agorio/sdk • Docs
Interface: CartMandate
AP2 Client — Agent Payments Protocol (FIDO Alliance)
GA in agorio v0.8. Implements the full AP2 mandate lifecycle: IntentMandate → CartMandate → SignedMandate → payment result
Real deployments must supply a sign function backed by a FIDO2/WebAuthn
authenticator (ES256 / EdDSA). The default signer is a deterministic mock
(prefix: “mock_sig_”) suitable for testing and CI only.
Receivers (merchants / payment gateways) can use verifyMandateShape to
sanity-check incoming SignedMandates before handing them to a real verifier.
Usage: const client = new Ap2Client({ merchantId: ‘merchant_xyz’ }); const intent = client.createIntentMandate({ amount: ‘49.99’, currency: ‘USD’ }); const cart = client.attachCart(intent, lineItems); const signed = await client.sign(cart); const result = await client.submitPayment(signed, paymentUrl);
Extends
Properties
amount
amount:
string
Total amount to be charged
Inherited from
Defined in
src/client/ap2-client.ts:30
cartTotal
cartTotal:
string
Recomputed total from line items — must match amount
Defined in
src/client/ap2-client.ts:49
createdAt
createdAt:
string
ISO-8601 creation timestamp
Inherited from
Defined in
src/client/ap2-client.ts:35
currency
currency:
string
Inherited from
Defined in
src/client/ap2-client.ts:31
expiresAt
expiresAt:
number
Unix timestamp (ms) at which this mandate expires
Inherited from
Defined in
src/client/ap2-client.ts:33
lineItems
lineItems:
CartLineItem[]
Defined in
src/client/ap2-client.ts:47
mandateId
mandateId:
string
Unique mandate identifier
Inherited from
Defined in
src/client/ap2-client.ts:26
merchantId
merchantId:
string
Merchant receiving the payment
Inherited from
Defined in
src/client/ap2-client.ts:28