auto-402-hub-pay

Automate payments for 402-protected URLs via SCP signing and channel funding.

3|11|Updated May 27, 2022
One-click install
npx skills add https://github.com/ScryProtocol/Contracts --skill auto-402-hub-pay
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: auto-402-hub-pay
Source: https://github.com/ScryProtocol/Contracts/tree/main/skills/auto-402-hub-pay
Command: npx skills add https://github.com/ScryProtocol/Contracts --skill auto-402-hub-pay

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ethers, and includes scripts (resource) and references (resource) components.

What problem does it solve?

Automatically pay HTTP 402-protected URLs through SCP hub routing. Handles offer discovery, AI-aware offer selection, channel funding, and payment in one step. Use when user says "pay this URL", "auto-pay", "402 payment", "buy access", or wants to call a paid API without manual channel management.

Core Features & Use Cases

  • Discover offers for the target URL (GET → 402 response).
  • Select the best offer using readiness scoring and cost awareness.
  • Open/fund a hub channel automatically or use direct routing, including ERC20 allowance handling.
  • Submit the paid request via SCP signing flow and return receipts.

Quick Start

Run the script from the x402s project root with a 402-protected URL to automatically discover offers, fund required channels, and complete the payment.

Frequently Asked Questions about auto-402-hub-pay

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate payments for HTTP 402-protected URLs?

Automate 402 payments by discovering offers, selecting the best one using readiness scoring, and handling channel funding and SCP signing. This script manages ERC20 allowances and completes the payment flow across Base and Ethereum-like networks in one step.

Do I need a private key to use SCP hub routing for 402 payments?

Yes, SCP hub routing requires the AGENT_PRIVATE_KEY environment variable to sign payments. You also need a compatible x402s deployment to discover offers and route transactions through the hub or direct channels.

How does the script select the best payment offer for a 402 response?

The script selects the best payment offer using per-offer readiness scoring and cost awareness. It evaluates offers discovered in the 402 response, then auto-funds or opens channels and manages ERC20 allowances to execute the selected route.

Can I test 402 payment routing without spending tokens?

Yes, the script supports dry-run planning to validate inputs and preview the payment flow without spending tokens. You can review the concise payment summary to confirm offer selection and channel funding steps before executing.

Does this tool handle ERC20 allowance management on Base and Ethereum networks?

Yes, the script manages ERC20 allowances where needed across Base and Ethereum-like networks. It automatically handles the approval transactions required to fund channels and complete 402 payments via SCP hub or direct routing.

What are the limitations of automating 402 payments with this script?

The script requires a compatible x402s deployment and an AGENT_PRIVATE_KEY. It is limited to Base and Ethereum-like networks and depends on valid 402 offer discovery, meaning it cannot process URLs that do not return standard 402 payment responses.