mirror of
https://github.com/aljazceru/BitcoinAndLightningLayerSpecs.github.io.git
synced 2025-12-17 14:04:20 +01:00
219 lines
9.0 KiB
HTML
219 lines
9.0 KiB
HTML
<!DOCTYPE html>
|
|
<html class="writer-html5" lang="en" >
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<link rel="shortcut icon" href="../../img/favicon.ico" />
|
|
<title>sendPayment - WebBTC Specification</title>
|
|
<link rel="stylesheet" href="../../css/theme.css" />
|
|
<link rel="stylesheet" href="../../css/theme_extra.css" />
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/github.min.css" />
|
|
<link href="../../css/custom.css" rel="stylesheet" />
|
|
|
|
<script>
|
|
// Current page data
|
|
var mkdocs_page_name = "sendPayment";
|
|
var mkdocs_page_input_path = "transactions/send.md";
|
|
var mkdocs_page_url = null;
|
|
</script>
|
|
|
|
<script src="../../js/jquery-3.6.0.min.js" defer></script>
|
|
<!--[if lt IE 9]>
|
|
<script src="../../js/html5shiv.min.js"></script>
|
|
<![endif]-->
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/highlight.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/languages/javascript.min.js"></script>
|
|
<script>hljs.initHighlightingOnLoad();</script>
|
|
</head>
|
|
|
|
<body class="wy-body-for-nav" role="document">
|
|
|
|
<div class="wy-grid-for-nav">
|
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
|
|
<div class="wy-side-scroll">
|
|
<div class="wy-side-nav-search">
|
|
<a href="../.." class="icon icon-home"> WebBTC Specification
|
|
</a><div role="search">
|
|
<form id ="rtd-search-form" class="wy-form" action="../../search.html" method="get">
|
|
<input type="text" name="q" placeholder="Search docs" title="Type search term here" />
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="../..">Overview</a>
|
|
</li>
|
|
</ul>
|
|
<p class="caption"><span class="caption-text">API Reference</span></p>
|
|
<ul class="current">
|
|
<li class="toctree-l1"><a class="reference internal" href="#">Enable</a>
|
|
<ul>
|
|
<li class="toctree-l2"><a class="reference internal" href="../../enable/">Enabling</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="#">Information</a>
|
|
<ul>
|
|
<li class="toctree-l2"><a class="reference internal" href="../../info/">info</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="#">Signatures</a>
|
|
<ul>
|
|
<li class="toctree-l2"><a class="reference internal" href="../../signatures/sign/">Signing</a>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="../../signatures/verify/">Verification</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l1 current"><a class="reference internal current" href="#">Invoices</a>
|
|
<ul class="current">
|
|
<li class="toctree-l2"><a class="reference internal" href="../../invoices/makeInvoice/">makeInvoice</a>
|
|
</li>
|
|
<li class="toctree-l2 current"><a class="reference internal current" href="./">sendPayment</a>
|
|
<ul class="current">
|
|
<li class="toctree-l3"><a class="reference internal" href="#syntax">Syntax</a>
|
|
</li>
|
|
<li class="toctree-l3"><a class="reference internal" href="#parameters">Parameters</a>
|
|
</li>
|
|
<li class="toctree-l3"><a class="reference internal" href="#returns">Returns</a>
|
|
</li>
|
|
<li class="toctree-l3"><a class="reference internal" href="#example">Example</a>
|
|
</li>
|
|
<li class="toctree-l3"><a class="reference internal" href="#notes">Notes</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l2"><a class="reference internal" href="../sendTransaction/">sendTransaction</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="#">Addresses</a>
|
|
<ul>
|
|
<li class="toctree-l2"><a class="reference internal" href="../../addresses/getAddress/">getAddress</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../extendability/extending/">Extending</a>
|
|
</li>
|
|
</ul>
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../squatting/">Namespace Squatting</a>
|
|
</li>
|
|
</ul>
|
|
<ul>
|
|
<li class="toctree-l1"><a class="reference internal" href="../../references/">Resources</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
|
<nav class="wy-nav-top" role="navigation" aria-label="Mobile navigation menu">
|
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
|
<a href="../..">WebBTC Specification</a>
|
|
|
|
</nav>
|
|
<div class="wy-nav-content">
|
|
<div class="rst-content"><div role="navigation" aria-label="breadcrumbs navigation">
|
|
<ul class="wy-breadcrumbs">
|
|
<li><a href="../.." class="icon icon-home" alt="Docs"></a> »</li>
|
|
<li>API Reference »</li>
|
|
<li>Invoices »</li><li>sendPayment</li>
|
|
<li class="wy-breadcrumbs-aside">
|
|
</li>
|
|
</ul>
|
|
<hr/>
|
|
</div>
|
|
|
|
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
|
<div class="section" itemprop="articleBody">
|
|
|
|
<h1 id="send-payment">Send Payment</h1>
|
|
<p>The <code>sendPayment</code> method is called to pay an lightning invoice or BIP21 URI.</p>
|
|
<h2 id="syntax">Syntax</h2>
|
|
<pre><code>sendPayment(String)
|
|
</code></pre>
|
|
<h2 id="parameters">Parameters</h2>
|
|
<ul>
|
|
<li>bip21 url : string or paymentRequest: string <span class="badge">Required</span></li>
|
|
</ul>
|
|
<h2 id="returns">Returns</h2>
|
|
<ul>
|
|
<li>Promise</li>
|
|
</ul>
|
|
<blockquote>
|
|
<p><strong><em>NOTE:</em></strong><br />
|
|
This call is asynchronous is would return a promise based on wether or not the payment has been broadcast <span class="badge">Onchain</span> and or processed successfully <span class="badge">WebLN</span>.</p>
|
|
</blockquote>
|
|
<h2 id="example">Example</h2>
|
|
<pre><code>// Example for processing a BIP21 URI Invoice
|
|
> await window.webbtc.sendPayment('bitcoin:n1nk1j5DKmmWWuV2TvzhUb3AYBtnqAK1u1?amount=1')
|
|
{
|
|
"txid":"ba8d75e01ab32932d9ac899418a6bec95f2869e1b1c161b871f661c5a8789a0e"
|
|
}
|
|
</code></pre>
|
|
<pre><code>// Example for processing a LN payment
|
|
window.webbtc.sendPayment('lnbc10n1p3x9thxpp59xj4cmm26jnpnrfekgncyj42e9lxredz…734s07kxt8hl2s6wuv20kh7kw7h5lurtmyscsrwgkgptn4z2j')
|
|
|
|
{
|
|
"preimage": "6665333431626331363632653134386630643435626532626165383332323333",
|
|
"paymentHash": "d221b791c7ef1996b25424ff7cfb4ddf8d4444076666ce6c4ba0f6a24d99117e"
|
|
}
|
|
</code></pre>
|
|
<h2 id="notes">Notes</h2>
|
|
<ul>
|
|
<li>The purpose of this method includes both signing as well as broadcasting the transaction. The implementation details of this could be done as separate concerns. </li>
|
|
<li>There are more complex versions for onchain including PSBT, pay multiple addresses at the same time.</li>
|
|
</ul>
|
|
|
|
</div>
|
|
</div><footer>
|
|
<div class="rst-footer-buttons" role="navigation" aria-label="Footer Navigation">
|
|
<a href="../../invoices/makeInvoice/" class="btn btn-neutral float-left" title="makeInvoice"><span class="icon icon-circle-arrow-left"></span> Previous</a>
|
|
<a href="../sendTransaction/" class="btn btn-neutral float-right" title="sendTransaction">Next <span class="icon icon-circle-arrow-right"></span></a>
|
|
</div>
|
|
|
|
<hr/>
|
|
|
|
<div role="contentinfo">
|
|
<!-- Copyright etc -->
|
|
</div>
|
|
|
|
Built with <a href="https://www.mkdocs.org/">MkDocs</a> using a <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
|
|
</footer>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
<div class="rst-versions" role="note" aria-label="Versions">
|
|
<span class="rst-current-version" data-toggle="rst-current-version">
|
|
|
|
|
|
<span><a href="../../invoices/makeInvoice/" style="color: #fcfcfc">« Previous</a></span>
|
|
|
|
|
|
<span><a href="../sendTransaction/" style="color: #fcfcfc">Next »</a></span>
|
|
|
|
</span>
|
|
</div>
|
|
<script>var base_url = '../..';</script>
|
|
<script src="../../js/theme_extra.js" defer></script>
|
|
<script src="../../js/theme.js" defer></script>
|
|
<script src="../../search/main.js" defer></script>
|
|
<script defer>
|
|
window.onload = function () {
|
|
SphinxRtdTheme.Navigation.enable(true);
|
|
};
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|