Comment on page
webln.keysend()
Request the user to send a keysend payment. This is a spontaneous payment that does not require an invoice and only needs a destination public key and and amount.
async keysend(args: KeysendArgs): SendPaymentResponse;
interface KeysendArgs {
destination: string;
amount: string | number;
customRecords?: Record<string, string>;
}
destination
Hex encoded public key of the destination node. This is a string of length 66 that starts either with02
or03
.amount
The amount of satoshis you want to send as a stringified integer.customRecords
Amap<string, string>
of records that are appended to the payment. The key should be a stringified integer from the TLV Registry. The value should be an unencoded, plain string. The WebLN provider should handle the encoding if necessary. If no custom records are needed, this parameter can be omitted.
interface SendPaymentResponse {
preimage: string;
}
preimage
Note that thepreimage
is not a proof of payment, because unlike a bolt11 payment it is generated by the sender, not by the recipient.
await webln.enable();
const result = await webln.keysend({
destination: "03006fcf3312dae8d068ea297f58e2bd00ec1ffe214b793eda46966b6294a53ce6",
amount: "1",
customRecords: {
"34349334": "HELLO AMBOSS"
}
});
Manual payments to a podcast or episode and attach your own message.
Automatic payments while listening to an episode.
Last modified 1yr ago