← 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
        }

        allow "office-purchase" when {
            action.kind == "purchase"
            checkout.content.merchant.website == merchants.officeShop.website
            payment.payee.website == merchants.officeShop.website
            payment.instrument.id == methods.companyCard.id
            payment.instrument.type == methods.companyCard.type
            payment.currency == "USD"
            payment.amount > 0
            payment.amount <= maxPerPurchase
        }

        require 2 of [treasury, security] if (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
        }

        allow "office-purchase" when {
            action.kind == "purchase"
            checkout.content.merchant.website == merchants.officeShop.website
            payment.payee.website == merchants.officeShop.website
            payment.instrument.id == methods.companyCard.id
            payment.instrument.type == methods.companyCard.type
            payment.currency == "USD"
            payment.amount > 0
            payment.amount <= maxPerPurchase
        }

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