← AI

Agent payment authorization

Set rules for payment requests signed with Google AP2 or Mastercard Verifiable Intent.

Google AP2 mandates

Authorize checkout and payment mandates. Set rules for merchants, payment methods, currencies, and amounts across a request.

Integration guide
Edict exampleshowcase-ap2.edict
authority "showcase-ap2" {
    intent = "ap2.mandate"
    version = "2.0.0"

    config {
        merchants = {
            officeShop = {
                website = "https://office.example"
            }
        }
        methods = {
            companyCard = {
                id = "card-1"
                type = "card"
            }
        }
    }

    approver treasury {
        type = "reference"
        id = "treasury"
        ref = "treasury@sha256:<digest>"
    }

    approver security {
        type = "reference"
        id = "security"
        ref = "security@sha256:<digest>"
    }

    policy "office-purchases" {
        let maxPerPurchase = 10000
        let maxPerRequest = 15000

        deny "request-total" when {
            not request.allAmountsKnown or purchases.sum(p -> p.payment.amount) > maxPerRequest
        }

        let allowedPurchase = (
            action.kind == "purchase"
            and checkout.content.merchant.website == merchants.officeShop.website
            and payment.payee.website == merchants.officeShop.website
            and payment.instrument.id == methods.companyCard.id
            and payment.instrument.type == methods.companyCard.type
            and payment.currency == "USD"
            and payment.amount > 0
            and payment.amount <= maxPerPurchase
        )

        allow "office-purchase" if (allowedPurchase)

        require 2 of [treasury, security] if (allowedPurchase and payment.amount > 5000)
    }
}

Mastercard Verifiable Intent

Authorize checkout and payment credentials. Check the merchant and payment details for each action and decide which requests need approval.

Integration guide
Edict exampleshowcase-mcintent.edict
authority "showcase-mcintent" {
    intent = "mcintent.mandate"
    version = "2.0.0"

    config {
        merchants = {
            officeShop = {
                website = "https://office.example"
            }
        }
        methods = {
            companyCard = {
                id = "card-1"
                type = "card"
            }
        }
    }

    approver treasury {
        type = "reference"
        id = "treasury"
        ref = "treasury@sha256:<digest>"
    }

    approver security {
        type = "reference"
        id = "security"
        ref = "security@sha256:<digest>"
    }

    policy "office-purchases" {
        let maxPerPurchase = 10000
        let maxPerRequest = 15000

        deny "request-total" when {
            not request.allAmountsKnown or purchases.sum(p -> p.payment.amount) > maxPerRequest
        }

        let allowedPurchase = (
            action.kind == "purchase"
            and checkout.content.merchant.website == merchants.officeShop.website
            and payment.payee.website == merchants.officeShop.website
            and payment.instrument.id == methods.companyCard.id
            and payment.instrument.type == methods.companyCard.type
            and payment.currency == "USD"
            and payment.amount > 0
            and payment.amount <= maxPerPurchase
        )

        allow "office-purchase" if (allowedPurchase)

        require 2 of [treasury, security] if (allowedPurchase and payment.amount > 5000)
    }
}