SDK reference · Node SDK
prov.mandate.grants.spend
prov.mandate.grants.spend in Node SDK. What the mandate spent, newest first: one entry per debit (a verify pass, a cart it covered at a store), with what caused it.
Signature
prov.mandate.grants.spend(mandateId: string, params?: { includeDescendants?: boolean; limit?: number; cursor?: string }): Promise<ListResponse<GrantSpendEntry>>Parameters
mandateIdstringRequiredparams{ includeDescendants?: boolean; limit?: number; cursor?: string }
Request fields
idstringpathRequired- The object's ID.
include_descendantsenumquerytruelists the entries of every mandate delegated from this one as well (defaultfalse). One oftrue,false.limitintegerquery- Page size, 1–100 (default 20). Outside the range → 400 parameter_invalid.
cursorstringquery- Opaque; pass a response's
next_cursorback to get the next page.
Returns
Promise<ListResponse<GrantSpendEntry>> The entries.
HTTP operation
GET /v1/mandate/grants/{id}/spend: List a mandate's spend
Errors
Example
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/grants`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"device_id": "dev_00000000000000000000000000000001",
"agent_session_id": "sess_buyer_1",
"constraints": {
"max_amount": 400,
"budget_amount": 2400,
"budget_window": "month",
"currency": "USD",
"expires_at": "2027-12-31T23:59:59Z"
}
}),
})).json();
const mandateId = step1.id;
const mandateToken = step1.mandate_token;
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/intents`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"action_description": "Pay invoice INV-2041: $180.00 to Brindlecote Supplies",
"agent_session_id": "sess_buyer_1",
"device_id": "dev_00000000000000000000000000000001",
"mandate_token": mandateToken
}),
})).json();
const intentToken = step2.intent_token;
const step3 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/assessments`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"intent_token": intentToken,
"action_description": "Pay invoice INV-2041: $180.00 to Brindlecote Supplies",
"context": {
"transaction_amount": 180,
"currency": "USD"
}
}),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/grants/${mandateId}/spend`, {
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/mandate/grants", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"device_id": "dev_00000000000000000000000000000001",
"agent_session_id": "sess_buyer_1",
"constraints": {
"max_amount": 400,
"budget_amount": 2400,
"budget_window": "month",
"currency": "USD",
"expires_at": "2027-12-31T23:59:59Z"
}
}).json()
grant_id = step1["id"]
mandate_token = step1["mandate_token"]
step2 = httpx.post(f"{api}/v1/mandate/intents", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"action_description": "Pay invoice INV-2041: $180.00 to Brindlecote Supplies",
"agent_session_id": "sess_buyer_1",
"device_id": "dev_00000000000000000000000000000001",
"mandate_token": mandate_token
}).json()
intent_token = step2["intent_token"]
step3 = httpx.post(f"{api}/v1/mandate/assessments", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"intent_token": intent_token,
"action_description": "Pay invoice INV-2041: $180.00 to Brindlecote Supplies",
"context": {
"transaction_amount": 180,
"currency": "USD"
}
}).json()
data = httpx.get(f"{api}/v1/mandate/grants/{grant_id}/spend", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()