AITP-01 Schema Reference
- Version: 1.0.0
- Spec Status: Ideation
This schema specification is in early development and subject to change. While the core concepts are stable, implementation details may evolve as we gather feedback from real-world use cases.
Schema URL
https://aitp.dev/capabilities/aitp-01-payments/v1.0.0/schema.json
Message Types
AITP-01 Payments defines several message types to support payment workflows between agents:
Quote
A payment quote is sent by a merchant or service to request payment.
{
"$schema": "https://aitp.dev/capabilities/aitp-01-payments/v1.0.0/schema.json",
"quote": {
"quote_id": "q_123456789",
"merchant_id": "store.near",
"description": "Premium Subscription - Annual Plan",
"expiration": "2025-03-01T12:00:00Z",
"next_recipient": "service-agent.near",
"payment_options": [
{
"amount": "99.99",
"currency": "USD",
"payment_methods": [
{
"type": "near_payment_channel",
"token": "usdc.near",
"recipient": "store.near"
}
]
}
],
"revenue_share": {
"affiliate_share_bps": 300,
"affiliates": []
},
"merchant_signature": "ed25519:..."
}
}
Quote Fields:
quote_id
: Unique identifier for this payment requestmerchant_id
: Identifier for the recipient of the paymentdescription
: Human-readable description of what is being paid forexpiration
: (Optional) When this quote expiresnext_recipient
: (Optional) The next agent in the chain that should receive this quotepayment_options
: Available payment optionsamount
: (Optional) Amount to be paidcurrency
: Currency code (e.g., 'USD')payment_methods
: Available methods to pay this amounttype
: Type of payment method (currently only "near_payment_channel")token
: Token contract addressrecipient
: Recipient account or address
revenue_share
: (Optional) Configuration for affiliate revenue sharingaffiliate_share_bps
: Percentage in basis points allocated to affiliatesaffiliates
: List of affiliates that should receive a share
merchant_signature
: Cryptographic signature by the merchant
Wrapped Quote
A wrapped quote allows agents to add themselves and others as affiliates while forwarding the payment request.
{
"$schema": "https://aitp.dev/capabilities/aitp-01-payments/v1.0.0/schema.json",
"wrapped_quote": {
"original_quote": {
"quote_id": "q_123456789",
"merchant_id": "store.near",
"description": "Premium Subscription - Annual Plan",
"expiration": "2025-03-01T12:00:00Z",
"next_recipient": "service-agent.near",
"payment_options": [
{
"amount": "99.99",
"currency": "USD",
"payment_methods": [
{
"type": "near_payment_channel",
"token": "usdc.near",
"recipient": "store.near"
}
]
}
],
"revenue_share": {
"affiliate_share_bps": 300,
"affiliates": []
},
"merchant_signature": "ed25519:..."
},
"wrappers": [
{
"affiliate_id": "service-agent.near",
"role": "service",
"added_affiliates": [],
"next_recipient": "assistant.near",
"timestamp": "2025-02-25T08:29:15Z",
"signature": "ed25519:..."
},
{
"affiliate_id": "assistant.near",
"role": "personal_assistant",
"added_affiliates": [
{
"id": "discovery.near",
"role": "discovery",
"weight": 1
}
],
"next_recipient": "user-interface.near",
"timestamp": "2025-02-25T08:30:15Z",
"signature": "ed25519:..."
}
]
}
}
Wrapped Quote Fields:
original_quote
: The original quote as issued by the merchantwrappers
: Chain of agents that have wrapped this quoteaffiliate_id
: Identifier for this affiliaterole
: Role of this affiliate in the transactionadded_affiliates
: Additional affiliates added by this wrappernext_recipient
: The next agent in the chain that should receive this quotetimestamp
: When this wrapper was addedsignature
: Cryptographic signature by this wrapper
Payment
A payment message is sent by the payer to authorize payment for a quote.
{
"$schema": "https://aitp.dev/capabilities/aitp-01-payments/v1.0.0/schema.json",
"payment": {
"quote_id": "q_123456789",
"payment_method": {
"type": "near_payment_channel",
"token": "usdc.near",
"channel_id": "ch_987654321",
"amount": "99.99",
"currency": "USD"
},
"payer_id": "user.near",
"timestamp": "2025-02-25T08:32:15Z",
"payer_signature": "ed25519:..."
}
}
Payment Fields:
quote_id
: Reference to the quote being paidpayment_method
: Details of the payment method usedtype
: Type of payment method used (currently only "near_payment_channel")token
: Token contract addresschannel_id
: Identifier for the payment channelamount
: (Optional) Amount paidcurrency
: Currency code (e.g., 'USD')
payer_id
: Identifier for the payertimestamp
: When the payment was madepayer_signature
: Cryptographic signature by the payer
Payment Confirmation
A payment confirmation is sent by the merchant to confirm receipt of payment.
{
"$schema": "https://aitp.dev/capabilities/aitp-01-payments/v1.0.0/schema.json",
"payment_confirmation": {
"quote_id": "q_123456789",
"payment_id": "pay_987654321",
"result": "success",
"timestamp": "2025-02-25T08:33:15Z",
"message": "Your premium subscription has been activated!",
"details": [
{
"label": "Order Number",
"value": "ORD-12345",
"url": "https://example.com/orders/12345"
},
{
"label": "Subscription Period",
"value": "February 25, 2025 - February 25, 2026"
}
],
"merchant_signature": "ed25519:..."
}
}
Payment Confirmation Fields:
quote_id
: Reference to the quote that was paidpayment_id
: Unique identifier for this paymentresult
: Result of the payment processing ("success", "failure", or "pending")timestamp
: When the payment was processedmessage
: (Optional) Human-readable message about the paymentdetails
: (Optional) Additional details about the transactionlabel
: Label for this detailvalue
: Value for this detail (string or number)url
: (Optional) URL with more information
merchant_signature
: Cryptographic signature by the merchant
Top-Up Request
A top-up request is sent by a merchant to request additional funds for an existing payment channel.
{
"$schema": "https://aitp.dev/capabilities/aitp-01-payments/v1.0.0/schema.json",
"top_up_request": {
"channel_id": "ch_987654321",
"amount": "50.00",
"currency": "USD",
"reason": "Additional service usage beyond initial payment",
"merchant_id": "store.near",
"timestamp": "2025-02-26T10:15:30Z",
"merchant_signature": "ed25519:..."
}
}
Top-Up Request Fields:
channel_id
: Identifier for the payment channel to top upamount
: (Optional) Suggested amount to add to the channelcurrency
: Currency code (e.g., 'USD')reason
: (Optional) Reason for requesting more fundsmerchant_id
: Identifier for the merchant requesting the top-uptimestamp
: When the top-up was requestedmerchant_signature
: Cryptographic signature by the merchant
Top-Up Response
A top-up response is sent by the payer to confirm additional funds have been added to a payment channel.
{
"$schema": "https://aitp.dev/capabilities/aitp-01-payments/v1.0.0/schema.json",
"top_up_response": {
"channel_id": "ch_987654321",
"amount": "50.00",
"currency": "USD",
"new_balance": "75.50",
"payer_id": "user.near",
"timestamp": "2025-02-26T10:20:45Z",
"payer_signature": "ed25519:..."
}
}
Top-Up Response Fields:
channel_id
: Identifier for the payment channel that was topped upamount
: Amount added to the channelcurrency
: Currency code (e.g., 'USD')new_balance
: (Optional) New balance in the channelpayer_id
: Identifier for the payertimestamp
: When the top-up was processedpayer_signature
: Cryptographic signature by the payer
Signature Requirements
AITP-01 Payments relies on cryptographic signatures to ensure the authenticity and integrity of messages. Below are the specific requirements for generating and verifying signatures.
Original Quote Signature
The merchant_signature
in the original quote must be generated by signing a canonical representation of the quote object with the merchant's private key.
Signing Process:
- Create a JSON object with all quote fields except
merchant_signature
- Sort all object keys alphabetically
- Remove all whitespace from the JSON
- Create a UTF-8 encoded byte array from this canonical JSON string
- Sign the byte array using the merchant's ed25519 private key
- Format the signature as
"ed25519:{base64_signature}"
// Example pseudocode for signing an original quote
function signOriginalQuote(quote, privateKey) {
// Create a copy without the signature field
const quoteToSign = {...quote};
delete quoteToSign.merchant_signature;
// Create canonical JSON (sorted keys, no whitespace)
const canonicalJson = JSON.stringify(quoteToSign, Object.keys(quoteToSign).sort());
// Sign the UTF-8 encoded canonical JSON
const signature = ed25519Sign(privateKey, utf8Encode(canonicalJson));
// Return the formatted signature
return `ed25519:${base64Encode(signature)}`;
}
Wrapped Quote Signature
For wrapped quotes, each wrapper must sign the combination of the original quote and all previous wrappers, creating a chain of signatures where each wrapper authenticates the entire quote history.
Signing Process for Wrappers:
- Create a JSON object with the wrapper's fields except
signature
- Sort all object keys alphabetically
- If this is the first wrapper, include the entire original quote (with its signature)
- If this is not the first wrapper, include all previous wrappers (with their signatures)
- Remove all whitespace from the JSON
- Create a UTF-8 encoded byte array from this canonical JSON string
- Sign the byte array using the wrapper's ed25519 private key
- Format the signature as
"ed25519:{base64_signature}"
// Example pseudocode for signing a wrapper
function signWrapper(originalQuote, previousWrappers, newWrapper, privateKey) {
// Create a copy of the wrapper without the signature field
const wrapperToSign = {...newWrapper};
delete wrapperToSign.signature;
// Create the payload that includes the original quote and all previous wrappers
const payload = {
original_quote: originalQuote,
previous_wrappers: previousWrappers,
new_wrapper: wrapperToSign
};
// Create canonical JSON (sorted keys, no whitespace)
const canonicalJson = JSON.stringify(payload, Object.keys(payload).sort());
// Sign the UTF-8 encoded canonical JSON
const signature = ed25519Sign(privateKey, utf8Encode(canonicalJson));
// Return the formatted signature
return `ed25519:${base64Encode(signature)}`;
}
Verification Process
When receiving a wrapped quote, implementations must verify:
- The original quote's signature is valid
- Each wrapper's signature is valid, verifying against the original quote and all previous wrappers
- The signatures are created by the claimed identities
This chain of signatures ensures that no party can modify the quote or any previous wrapper without invalidating the signature chain.
Security Considerations
When implementing AITP-01 Payments:
- Always verify all signatures in the chain to ensure message integrity
- Validate quote expiration to prevent replay attacks
- Check payment amounts match the quoted amounts
- Implement idempotency to prevent double-charging
- Store transaction details securely for auditing
- Use secure random number generators for all cryptographic operations
Current Limitations
AITP-01 Payments currently has the following limitations:
- NEAR blockchain only: Only supports NEAR blockchain and associated tokens
- Limited payment methods: Only supports payment channels (no credit cards, etc.)
- Simple affiliate model: Revenue sharing model is still being refined
- No subscription management: Recurring payments must be managed manually
These limitations will be addressed in future versions of the specification.