agent to merchant l402 payment

    by agent-bitcoin

    1

    Pay an Aperture-style 402 challenge and fetch the resource.

    $9

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    agent to merchant l402 payment

    Example session with this skill installed

    Pay the gated merchant endpoint at http://localhost:8081/protected and show me the status.

    • Read your context and instructions
    • Compiled the agent to merchant

    I have initiated the L402 payment flow using the agent-bitcoin SDK. The challenge was successfully negotiated with the local LND node, the invoice was paid, and the protected resource has been retrieved.

    L402 Payment Result

    FieldValue
    Target URLhttp://localhost:8081/protected
    Status Code200
    Payment StatusPaid
    NetworkRegtest
    Resource Preview{"data": "This is a premium resource accessible via L402."}

    Next steps

    • Verify the retrieved data in your local environment.
    • To use this on Mainnet, explicitly set the AGENT_BITCOIN_ALLOW_MAINNET=1 environment variable.
    • Configure AGENT_BITCOIN_ALLOW_AUTOPAY=1 if you want future payments to proceed without manual confirmation.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Handling 402 Payment Required status codes often stalls automated agents that lack a native way to negotiate Lightning Network payments. This skill enables an agent to detect L402-gated endpoints, pay the requested invoice using the Lightning Network, and retrieve the protected resource.

    What it does

    • L402 negotiation automatically handles the HTTP 402 challenge-response flow.
    • Lightning payments pays BOLT11 invoices via an unlocked LND node to satisfy the gate.
    • Resource retrieval fetches the content from the merchant endpoint after successful payment.
    • State reporting provides clear feedback on the HTTP status code and payment confirmation.
    • Safety controls enforces strict opt-in for mainnet spends and automated payments.

    How it works

    1. Identify target the user provides a URL that requires an L402 payment.
    2. Environment setup the agent ensures the agent-bitcoin SDK is installed and the LND node is reachable.
    3. Execute payment the L402Client fetches the URL, intercepts the 402 error, and pays the invoice.
    4. Deliver resource the agent returns the final status and the content of the paid resource.

    Frameworks & tools

    Python 3.10+, agent-bitcoin SDK, LND (Lightning Network Daemon), and Aperture-style merchant gateways.

    Why this beats prompting it yourself

    Standard prompts cannot handle the multi-step cryptographic handshake and wallet interaction required for L402. This skill provides the specific logic needed to bridge the gap between HTTP requests and Lightning wallet RPCs.

    Use cases

    • Access paid API endpoints that charge per-request via Lightning.
    • Download gated documentation or datasets from L402-enabled merchants.
    • Automate micro-payments for agent-to-agent service consumption.

    Known limitations

    Requires a locally accessible, unlocked LND node. Defaulted to Regtest; Mainnet and Autopay require explicit user permission.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 11 days ago

    Software
    Python

    Permissions

    Network Access
    Terminal / Shell
    Environment Variables
    Listed11 days ago

    What's inside

    Frequently Asked Questions

    This skill automates the HTTP 402 "Payment Required" handshake, allowing your agent to detect, pay, and resolve Lightning Network-gated resources without manual intervention. It solves the problem of automated agents getting stuck at payment-walled APIs or content gateways.

    The skill requires a Python 3.10+ environment, the agent-bitcoin SDK, and access to an unlocked Lightning Network Daemon (LND) node. It is designed to work with any agent framework that supports custom tool integration, such as LangChain or Autogen.

    You receive the specialized logic for the L402 challenge-response flow, integration code for the agent-bitcoin SDK, and documentation on connecting your LND node. This includes the ready-to-use tool definition for your agent's toolkit.

    By default, the skill is configured for Regtest to ensure a safe testing environment. To use it on Mainnet or enable automated payments (Autopay), you must explicitly adjust the security flags within your configuration.

    This skill is specifically optimized for Aperture-style L402 gateways, which are the industry standard for Lightning-gated APIs. It will work with any merchant endpoint that follows the standard L402/LSAT protocol for BOLT11 invoices.

    New in APIs & Backend

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.