1

I'm looking for a way to include extra description (comment) info in a lightning payment request i.e. LUD-12.

Either with anchor link:

<a href="lightning:bitanon@getalby.com" comment="payer@email.com">send ln payment</a>

Or even better using an Android Intent:

Intent(Intent.ACTION_SEND).apply {

    data = Uri.parse("lightning:bitanon@getalby.com") 
    //type = "message/rfc822"
    putExtra("comment", "payer@email.com")

}

The above anchor link works, but does not send comment data to receiving wallet. And I can't get the Android intent to launch wallet app at all. Anyone know how to get this working?

2
  • Tried "lightning:bitanon@getalby.com?comment=foo"?
    – Mercedes
    Jan 23 at 17:33
  • Yeah, doesn't work.
    – bitanon
    Jan 23 at 18:22

1 Answer 1

1

The fine folks at Alby helped solve this ->

First, add query intent to manifest:

<queries>
    <intent>
        <action android:name="android.intent.action.VIEW" />
        <data android:scheme="lightning" />
    </intent>
</queries>

Second, query getalby.com for encoded lnurl:

val requestUrl = "https://getalby.com/lnurlp/bitanon/callback?amount=1000000&comment=hello" // amount is in millisats
val client = OkHttpClient() 
val request = Request.Builder().url(requestUrl).build() 
val response = client.newCall(request).await()

Third, parse json response for 'pr' which contains encoded lnurl.

Fourth, send Lightning PayRequest Android Intent, which will open with device lightning wallet of your choice:

val intent = Intent(Intent.ACTION_VIEW).apply {
    data = Uri.parse("lightning:$lnurl")
}
if (intent.resolveActivity(packageManager) != null) {
    startActivity(intent)
}

Fifth, parse and handle additional response info, such as transaction verification url etc.

New contributor
bitanon is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.