Payment Rails
PEAC records what happened during commerce flows. Each rail mapping extracts upstream artifacts, preserves them as-is, and produces a PEAC receipt with typed commerce extensions. PEAC never executes payments, coordinates checkout, or manages wallets.
Supported rails
| Rail | Package | What it records | Status |
|---|---|---|---|
| Paymentauth / MPP | @peac/mappings-paymentauth | HTTP 402 challenges, credentials, upstream receipts | Stable |
| x402 | @peac/adapter-x402 | Offer/receipt verification, v1/v2 headers, upstream artifact separation | Stable |
| Stripe | @peac/rails-stripe | Payment intent observation, SPT delegation lifecycle | Stable |
| Razorpay | @peac/rails-razorpay | UPI, cards, netbanking, wallets | Stable |
| Card networks | @peac/rails-card | Visa, Mastercard, Amex authorization | Stable |
Paymentauth / MPP
Envelope-first parsing for the HTTP Payment authentication scheme (draft-ryan-httpauth-payment). Extracts Challenge, Credential, and Receipt envelopes with raw artifact preservation.
pnpm add @peac/mappings-paymentauth
import { parseChallenge, parseReceipt } from '@peac/mappings-paymentauth';
// Parse 402 challenge from WWW-Authenticate header
const challenge = parseChallenge(wwwAuthenticateHeader);
// Parse upstream receipt from Payment-Receipt header
const receipt = parseReceipt(paymentReceiptHeader);
Carrier coexistence: PEAC-Receipt (PEAC compact JWS) and Payment-Receipt (upstream receipt) coexist without conflict. JSON-RPC error helpers (-32042, -32043) and MCP extraction functions included.
x402
Four-layer adapter architecture (A1/A2/B/C) with 5-layer verification API. Reads v1 (X-PAYMENT-RESPONSE) and v2 (PAYMENT-RESPONSE) headers alongside PEAC-Receipt.
pnpm add @peac/adapter-x402
import { extractReceiptArtifactFromHeaders } from '@peac/adapter-x402';
const artifact = extractReceiptArtifactFromHeaders(headers);
// artifact.receipt_jws: PEAC compact JWS only
// artifact.upstreamArtifact: raw upstream data (preserved as-is)
// artifact.artifactFormat: 'peac' | 'x402-v1' | 'x402-v2'
Stripe
Payment intent observation and SPT delegation evidence. Commerce event fields are set only when the upstream PaymentIntent explicitly proves the claimed payment state.
pnpm add @peac/rails-stripe
Payment intent observation
import { fromStripePaymentIntentObservation } from '@peac/rails-stripe';
const evidence = fromStripePaymentIntentObservation(paymentIntent);
// succeeded -> commerce event: settlement
// requires_capture -> commerce event: authorization
// processing, canceled -> no commerce event
SPT delegation lifecycle
Delegation events record token lifecycle, not payment finality:
| Event | Type | Commerce event |
|---|---|---|
delegated_payment_granted | Delegation lifecycle | None |
delegated_payment_presented | Delegation lifecycle | None |
delegated_payment_deactivated | Delegation lifecycle | None |
Razorpay
India payment adapter supporting UPI, cards, netbanking, and wallet payments.
pnpm add @peac/rails-razorpay
import { fromRazorpayPayment } from '@peac/rails-razorpay';
const evidence = fromRazorpayPayment({
paymentId: 'pay_abc123',
orderId: 'order_xyz789',
method: 'upi',
amount: 1000,
currency: 'INR',
});
Card networks
Generic card billing bridge for Visa, Mastercard, and Amex.
pnpm add @peac/rails-card
import { fromCardPayment } from '@peac/rails-card';
const evidence = fromCardPayment({
network: 'visa',
authorizationCode: 'AUTH123',
last4: '4242',
amount: 1999,
currency: 'USD',
});
Commerce extension (Wire 0.2)
All commerce evidence uses the org.peacprotocol/commerce extension group:
import { issueWire02 } from '@peac/protocol';
const receipt = await issueWire02({
privateKey: process.env.PEAC_PRIVATE_KEY,
kid: 'peac-2026-03',
claims: {
iss: 'https://api.example.com',
kind: 'evidence',
type: 'org.peacprotocol/payment',
pillars: ['commerce'],
extensions: {
'org.peacprotocol/commerce': {
payment_rail: 'stripe',
amount_minor: '2500',
currency: 'USD',
event: 'settlement',
},
},
},
});
The event field is a 6-value closed enum (authorization, settlement, void, refund, chargeback, observation) and is observational metadata only. It records what the upstream system reported, not more.
Semantic boundary
PEAC mappings preserve raw upstream artifacts and never synthesize payment finality:
- An ACP session "completed" does not prove payment settled
- An SPT "grant" does not prove payment authorized
- A paymentauth receipt proves what the upstream server attested, not more
eventfields are set only when the upstream artifact explicitly proves the claimed state