A mandate records what the user approved: the items, the most per purchase, an optional budget, the allowed payees and merchants, and conditions on the terms. It is signed, versioned and checked on every purchase. See How TheWavly works.
Errors return {"error": {"code", "message", "field", "request_id"}} with a 4xx or 5xx status. See Errors.
curl -X POST https://thewavly.com/v1/mandates \
-H "Authorization: Bearer $WAVLY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"instruction": "Order my weekly groceries from FreshCart, up to ₹2,000 an order",
"approved_by": "user_7f3",
"agent": "grocer-assistant",
"rules": {
"items": [
"Groceries"
],
"max_amount_paise": 200000,
"budget_paise": 600000,
"payees": [
"freshcart@okhdfc"
],
"currency": "INR"
}
}'
import { Wavly } from "@thewavly/sdk";
const wavly = new Wavly(process.env.WAVLY_API_KEY);
const result = await wavly.request("POST", "/v1/mandates", {
"instruction": "Order my weekly groceries from FreshCart, up to ₹2,000 an order",
"approved_by": "user_7f3",
"agent": "grocer-assistant",
"rules": {
"items": [
"Groceries"
],
"max_amount_paise": 200000,
"budget_paise": 600000,
"payees": [
"freshcart@okhdfc"
],
"currency": "INR"
}
});
from thewavly import Wavly
wavly = Wavly(os.environ["WAVLY_API_KEY"])
result = wavly.request("POST", "/v1/mandates", {
"instruction": "Order my weekly groceries from FreshCart, up to ₹2,000 an order",
"approved_by": "user_7f3",
"agent": "grocer-assistant",
"rules": {
"items": [
"Groceries"
],
"max_amount_paise": 200000,
"budget_paise": 600000,
"payees": [
"freshcart@okhdfc"
],
"currency": "INR"
}
})
Response
{
"id": "chk_P1iENx01EDRJ",
"status": "paid",
"instruction": "Order my weekly groceries from FreshCart, up to ₹2,000 an order",
"approved_by": "user_7f3",
"agent": "grocer-assistant",
"token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…"
}
import { Wavly } from "@thewavly/sdk";
const wavly = new Wavly(process.env.WAVLY_API_KEY);
const result = await wavly.request("POST", "/v1/mandates/import", {
"credential": "eyJhbGciOi…~WyJzYWx0Ii…~",
"approved_by": "user_7f3"
});
from thewavly import Wavly
wavly = Wavly(os.environ["WAVLY_API_KEY"])
result = wavly.request("POST", "/v1/mandates/import", {
"credential": "eyJhbGciOi…~WyJzYWx0Ii…~",
"approved_by": "user_7f3"
})
Response
{
"id": "chk_P1iENx01EDRJ",
"status": "paid",
"instruction": "Order my weekly groceries from FreshCart, up to ₹2,000 an order",
"approved_by": "user_7f3",
"agent": "grocer-assistant",
"token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…"
}
import { Wavly } from "@thewavly/sdk";
const wavly = new Wavly(process.env.WAVLY_API_KEY);
const result = await wavly.request("GET", "/v1/mandates/chk_P1iENx01EDRJ");
from thewavly import Wavly
wavly = Wavly(os.environ["WAVLY_API_KEY"])
result = wavly.request("GET", "/v1/mandates/chk_P1iENx01EDRJ")
Response
{
"id": "chk_P1iENx01EDRJ",
"status": "paid",
"instruction": "Order my weekly groceries from FreshCart, up to ₹2,000 an order",
"approved_by": "user_7f3",
"agent": "grocer-assistant",
"token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…"
}
import { Wavly } from "@thewavly/sdk";
const wavly = new Wavly(process.env.WAVLY_API_KEY);
const result = await wavly.request("POST", "/v1/mandates/chk_P1iENx01EDRJ/revoke", {
"reason": "not_as_ordered"
});
from thewavly import Wavly
wavly = Wavly(os.environ["WAVLY_API_KEY"])
result = wavly.request("POST", "/v1/mandates/chk_P1iENx01EDRJ/revoke", {
"reason": "not_as_ordered"
})
Response
{
"id": "chk_P1iENx01EDRJ",
"status": "paid",
"instruction": "Order my weekly groceries from FreshCart, up to ₹2,000 an order",
"approved_by": "user_7f3",
"agent": "grocer-assistant",
"token": "eyJhbGciOiJFZERTQSIsImtpZCI6Ik…"
}