mirror of
https://github.com/aljazceru/breez-sdk-docs.git
synced 2025-12-17 13:54:20 +01:00
add csharp snippets
This commit is contained in:
29
snippets/csharp/LnurlPay.cs
Normal file
29
snippets/csharp/LnurlPay.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Breez.Sdk;
|
||||
|
||||
public class LnurlPaySnippets
|
||||
{
|
||||
public void LnurlPay(BlockingBreezServices sdk)
|
||||
{
|
||||
// ANCHOR: lnurl-pay
|
||||
// Endpoint can also be of the form:
|
||||
// lnurlp://domain.com/lnurl-pay?key=val
|
||||
// lnurl1dp68gurn8ghj7mr0vdskc6r0wd6z7mrww4excttsv9un7um9wdekjmmw84jxywf5x43rvv35xgmr2enrxanr2cfcvsmnwe3jxcukvde48qukgdec89snwde3vfjxvepjxpjnjvtpxd3kvdnxx5crxwpjvyunsephsz36jf
|
||||
var lnurlPayUrl = "lightning@address.com";
|
||||
|
||||
try
|
||||
{
|
||||
var input = BreezSdkMethods.ParseInput(lnurlPayUrl);
|
||||
if (input is InputType.LnUrlPay lnurlp)
|
||||
{
|
||||
var amountMsat = lnurlp.data.minSendable;
|
||||
var result = sdk.PayLnurl(
|
||||
new LnUrlPayRequest(lnurlp.data, amountMsat, "comment"));
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// Handle error
|
||||
}
|
||||
// ANCHOR_END: lnurl-pay
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user