⚙️Specifications Overview
Describes architecture of the spec
This page describes the basic workflow of the current spec broken down into the five steps for different wallets trying to implement this spec.

Workflow
Trigger
SendPayment
method The lightning web application requests for WebLN provider by triggeringSendPayment
method. Provider passed by the wallet to the lightning web application shall contain an extended definition ofSendPayment
method
sendPayment(paymentRequest: string, metadata?: string): Promise<SendPaymentResponse>;
Structure and Pass Metadata Using
SendPayment
method, the lightning web application passes an invoice along with additional metadata. WebLN provider delivers such data to the wallets. Before passing metadata to the wallet using theSendPayment
method, metadata shall present in a structured form using the data models provided in a comprehensive guide.
webln.sendPayment(invoice, metadata)
.then(function (r) {
// Required constraint to protect metadata as a rule while paying empty invoices
if (r != undefined) {
// Provide metadata after successful payment
// Eg. Allow users to download a song after payment is successful
}
})
Validate Metadata Wallets validate received metadata against predefined data models/schemas.
Render Metadata in Confirmation Dialogue ✅ If metadata is passed and is valid, it is rendered in confirmation dialogue along with payment details. ❌ If metadata is passed and is not valid, even if the invoice is valid, there might be a possibility of fraud, and wallets don't allow it to proceed further.
Store, Interact and Do After Actions If metadata passed to the wallet is valid, also an invoice is paid - store, interact and do after actions with metadata.
Know More About Each Step
Follow our comprehensive guide to know more about each step and its implementation details.
☎️Trigger SendPayment Method🧱Structure and Pass Metadata🚦Validate Metadata🖼️Render Metadata in Confirmation Dialogue📀Store, Interact and Do After ActionsLast updated