Skip to main content

Sending Zaps

Sending a Zap via Zapf follows the standard NIP-57 and LUD-16 payment flows, but adds an identity resolution step. This allows your wallet or app to send funds to user-friendly identifiers like discord:username#1234 or email:user@example.com.

The Sender Flow

As an integrator (wallet developer or app builder), implementing the Zapf sending flow involves 4 steps:

1. Resolve the Identity

When a user enters a legacy identifier into your UI, your client needs to discover the corresponding LNURL endpoint.

By default, the zapf.app Identity Authority supports resolving any supported LIDP string natively:

# Format: <lidp_name>:<identifier>@<ia_domain>
discord:some_user#1234@zapf.app
email:satoshi@nakamoto.com@zapf.app

2. Fetch the LNURL Metadata (LUD-16)

Perform a standard GET request to the .well-known endpoint of the Identity Authority domain:

curl https://zapf.app/.well-known/lnurlp/discord:some_user#1234

The IA will return a standard LNURL payload. Key fields include:

  • callback: The URL to request the final Lightning invoice.
  • minSendable / maxSendable: The payment boundaries (in millisats).
  • allowsNostr: true (indicating you should generate a Zap Request).
  • nostrPubkey: The IA's pubkey (for verifying the eventual receipt).

3. Generate a Zap Request (Kind 5520)

Instead of a standard Kind 9734 Zap Request, generate a Kind 5520 event.

Sign the event with the sender's Nostr private key. The p tag must contain the recipient's target (either their Nostr pubkey if known, or the SHA-256 hash of the lidp:identifier string).

URL-encode the JSON string representation of this signed event.

4. Fetch the Invoice and Pay

Make a request to the callback URL you received in Step 2, appending the amount (in millisats) and the URL-encoded nostr parameter containing your Kind 5520:

curl "https://zapf.app/api/lnurl/cb/discord:some_user#1234?amount=1000000&nostr=%7B%22kind%22%3A5520..."

The IA will respond with a pr containing a BOLT11 Lightning Invoice. Your client can now pay this invoice via its connected Lightning node or wallet.

The Receipt

Once the payment settles, the IA will automatically publish a Kind 5521 (Zap Receipt) to the relays specified in your original Kind 5520 request.

Your client can listen on those relays to instantly update the UI with a "Payment Confirmed" state, verifying the receipt signature against the /docs/protocol/lnurl#lud-16-internet-identifiers nostrPubkey provided in Step 2.