Skip to content

feat(ilp): implement open payments mechanism#1969

Open
dragosp1011 wants to merge 3 commits intox402-foundation:mainfrom
dragosp1011:feature/ilp-openpayments-mechanism
Open

feat(ilp): implement open payments mechanism#1969
dragosp1011 wants to merge 3 commits intox402-foundation:mainfrom
dragosp1011:feature/ilp-openpayments-mechanism

Conversation

@dragosp1011
Copy link
Copy Markdown

@dragosp1011 dragosp1011 commented Apr 9, 2026

Description

This pull request implements ILP Open Payments support for the x402 v2 payment protocol through the Interledger Protocol, following the x402 Open Payments exact scheme specification (#1962).

Closes #1242.

Key Features

Payment Format - The Open Payments exact scheme uses these PaymentRequirements fields:

{
  scheme: "exact",
  network: "ilp:openpayments",             // CAIP-style network identifier
  amount: "100",                           // Amount in smallest asset unit (e.g. USD cents)
  asset: "USD",                            // Asset code from wallet discovery
  payTo: "https://wallet.example.com/alice", // Server wallet address URL
  maxTimeoutSeconds: 60,                   // Payment validity window
  extra: {
    assetScale: 2                          // Decimal places (2 for USD cents)
  }
}

Key Differences from EVM/SVM:

  • ILP-based settlement (not on-chain): funds move via Interledger; settle is a no-op on the facilitator
  • GNAP grants: client obtains short-lived bearer tokens from the auth server before each operation
  • Wallet discovery: server and facilitator resolve asset code, scale, auth server, and resource server from the wallet address URL at runtime
  • Incoming payment polling: client creates an incoming payment and polls until completed = true before returning proof
  • Proof format: incomingPaymentUrl (string) instead of a transaction hash

Tests

Automated Tests:

pnpm --filter @x402/openpayments test  // 116 unit tests across 5 files
  • 116 unit tests across 5 files
  • 1 integration test for wallet address discovery

Manual Testing:

  • examples/typescript/facilitator/advanced/all_networks.ts - Multi-chain facilitator
  • examples/typescript/servers/advanced/all_networks.ts - Multi-chain server
  • examples/typescript/clients/advanced/all_networks.ts - Multi-chain client

Checklist

  • I have formatted and linted my code
  • All new and existing tests pass
  • My commits are signed (required for merge) -- you may need to rebase if you initially pushed unsigned commits
  • I added a changelog fragment for user-facing changes (docs-only changes can skip)

@github-actions github-actions bot added typescript sdk Changes to core v2 packages examples Changes to examples ci labels Apr 9, 2026
Implements the exact scheme for the ilp:openpayments network.
Updates all networks example to support open payments.
@dragosp1011 dragosp1011 force-pushed the feature/ilp-openpayments-mechanism branch from fde63c6 to 4d5c61d Compare April 9, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci examples Changes to examples sdk Changes to core v2 packages typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Open Payments Implementation — Interledger Protocol Integration

1 participant