Overview
This guide walks through integrating Grantex agent passports with the Machine Payments Protocol (MPP). You’ll learn how to:
- Agent side — Issue passports and attach them to outgoing MPP requests
- Merchant side — Verify passports on incoming requests with one line of code
- Trust registry — Look up organization trust levels before fulfilling requests
Prerequisites
- A Grantex account with an API key (sign up free)
- A registered agent with an active grant that includes
payments:mpp:* scopes
- Node.js 18+ for the TypeScript SDK
Installation
Agent Side: Issue and Attach Passports
Step 1: Issue a Passport
The grant must include the corresponding payments:mpp:* scopes for each category.
For example, requesting ['inference', 'compute'] requires the grant to have
payments:mpp:inference and payments:mpp:compute scopes.
Step 2: Attach to MPP Requests
Use the middleware to automatically inject the X-Grantex-Passport header:
Merchant Side: Verify Passports
Option A: Express Middleware (Recommended)
One line to protect any route:
Invalid passports return 403 with a typed error code:
Option B: Standalone Verification
Trust Registry Lookup
Before fulfilling a high-value request, check the organization’s trust level:
Results are cached in-memory for 1 hour by default.
Revoking Passports
Instantly revoke a passport — flips the StatusList2021 bit:
After revocation, any verifyPassport() call with checkRevocation: true will throw PASSPORT_REVOKED.
Verification Options Reference
Next Steps