Skip to content

Add l402-go: Go client for L402 pay-per-request APIs - #93

Open
joelklabo wants to merge 1 commit into
bcongdon:masterfrom
joelklabo:master
Open

Add l402-go: Go client for L402 pay-per-request APIs#93
joelklabo wants to merge 1 commit into
bcongdon:masterfrom
joelklabo:master

Conversation

@joelklabo

Copy link
Copy Markdown

Summary

Adds l402-go - a Go client library for the L402 protocol (HTTP 402 + Lightning invoice + pay-and-retry).

What is L402?

L402 is a protocol for pay-per-request APIs using Lightning Network:

  1. Client makes request
  2. Server returns HTTP 402 with a Lightning invoice
  3. Client pays invoice and retries with payment proof
  4. Server fulfills request

The library provides a simple http.Client wrapper that handles the 402/retry flow automatically.

Example

client := l402.NewClient(wallet)
resp, err := client.Get("https://api.example.com/paid-endpoint")

This complements existing pay-per-call libraries like ln-paywall and paypercall by providing a standardized client-side implementation of the L402 protocol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant