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:[email protected]" comment="[email protected]">send ln payment</a>

Or even better using an Android Intent:

Intent(Intent.ACTION_SEND).apply {

    data = Uri.parse("lightning:[email protected]") 
    //type = "message/rfc822"
    putExtra("comment", "[email protected]")

}

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

1 Answer 1

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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