@agorio/sdkDocs


Interface: DelegatedMandate

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

IntentMandate.amount

Defined in

src/client/ap2-client.ts:30


createdAt

createdAt: string

ISO-8601 creation timestamp

Inherited from

IntentMandate.createdAt

Defined in

src/client/ap2-client.ts:35


currency

currency: string

Inherited from

IntentMandate.currency

Defined in

src/client/ap2-client.ts:31


delegation

delegation: object

chain

chain: DelegationLink[]

Ordered authority chain principal → … → delegate.

delegate

delegate: string

The party that signs this mandate (the delegate).

principal

principal: string

The party ultimately on whose behalf payment is authorized (the buyer).

Defined in

src/client/ap2-client.ts:89


expiresAt

expiresAt: number

Unix timestamp (ms) at which this mandate expires

Inherited from

IntentMandate.expiresAt

Defined in

src/client/ap2-client.ts:33


mandateId

mandateId: string

Unique mandate identifier

Inherited from

IntentMandate.mandateId

Defined in

src/client/ap2-client.ts:26


merchantId

merchantId: string

Merchant receiving the payment

Inherited from

IntentMandate.merchantId

Defined in

src/client/ap2-client.ts:28