-
Notifications
You must be signed in to change notification settings - Fork 194
Making Payment Transactions Smart With Structured Metadata
Specifications such as Webln bought better solutions to the UX for lightning networks. On top of this, many broad applications such as instant payments via a web browser using Bitcoin Sats (eg. Alby), tippings for content writers, podcasts and streamers (Medium tipping via Alby) and many more came into working. Along with every transaction we can also store additional information in form of metadata which can make specifications such as Webln more broad and applicative in terms of interactivity.
Transaction lists as we know them from our private bank accounts are often a simple list of transactions sorted by date. Each transaction has data like Sender, Receiver, amount, reason and date.
The aim of this project is to extend existing standards such as Webln to enrich transactions with additional information as structured metadata so that transactions containing static data contain more meaningful information giving more interactivity to the transactions.
Webln SendPayment
which takes PaymentRequest
parameter holding Bolt11 invoice, we can extend this function to add an extra "optional" parameter named metadata
which will hold metadata as a string which can be passed to the Wallets.
sendPayment(paymentRequest: string, metadata?: string): Promise<SendPaymentResponse>;
WeblnProvider attachted by wallets currently
WeblnProvider attached by wallets after implementation of spec
sendPayment(paymentRequest: string, metadata?: string): Promise<SendPaymentResponse>;
Use Schema.org specifications to structure metadata in form of JSON-LD
Developers only need to know JSON and two keywords ( @context and @id ) to use the basic functionality in JSON-LD. Compatibility. A JSON-LD document is always a valid JSON document.
eg.
var Metadata = {};
Metadata = {
"type": "AudioObject",
"name": title,
"creator": artist,
"image": image
}
export var Metadata;
Go through our documentation for this - Here
webln.sendPayment(Bolt 11 invoice, Metadata)
.then(function(r) {
if(r != undefined){
// do after payment actions with the metadata. eg. allowing user to download song after payment is done
}
})
.catch(function(e) {
alert("Failed: " + e.message);
console.log('err pay:', e);
});
})
.catch(function(e) {
alert("Webln error, check console");
console.log('err, provider', e);
});
}
To get a better grasp on the project idea I decided to create a simple prototype through which a visitor can play a song if they like they can buy a song. While buying a song during confirmation payment they get to know about the song name, artist, and song image(send as base64 encoded string, decode on Alby side). After successful payment, a song gets downloaded into users' local storage.
- Home
- Bounties
- Calls
- Connector API
- Internationalization i18n (Developer Guide)
- Lightning Monetization meta tag
- Lightning Node Connect
- Making Payment Transactions Smart With Structured Metadata
- Open Design
- Test Setup
- Image Compression Tutorial