Gateway/Overview

Gateway

Accept Lightning payments for requests to your API using MPP or L402. Your application decides when payment is required and how much to charge. Nodana requests and verifies payment through your Phoenixd node.

Customers call your API, and payments arrive at your node. Prices are supplied by your backend for each paid operation.

How it works

  1. Your API asks Nodana to request payment for an operation.
  2. Nodana returns a payment ID and a challenge for your API to relay to the customer.
  3. The customer pays and retries. Your API sends the payment ID and credentials to Nodana.
  4. Nodana authorises paid access, and your API serves the result.

MPP flow

The agent's payment client combines the challenge with the preimage returned by its wallet to build the MPP credential. Your API returns the resource and payment receipt after Nodana verifies it.

MPP flow: your API relays Nodana's challenge, the agent pays your node over Lightning, then retries with a credential. Nodana verifies payment and your API returns the resource and receipt.

L402 flow

The challenge contains a macaroon and an invoice. After paying, the agent's client sends the macaroon and preimage together as its L402 credential. Nodana verifies it and your API returns the resource.

L402 flow: your API relays a macaroon and invoice from Nodana, the agent pays your node over Lightning, then retries with the macaroon and preimage. Nodana verifies payment and your API returns the resource.

Get started

On this page