How it works
Your app locks the funds on chain. The maker pays the invoice, which reveals its preimage, and only then can it claim your lockup. If the maker never pays, your app refunds the lockup. In the normal case your app only funds the lockup: it builds no transaction.Setup
The code on this page assumes this setup. It connects to the signet maker and loads your swap mnemonic. See Installation and Keys and recovery if you have neither yet.Pay an invoice
1
Get a fixed-amount invoice
Use a BOLT11 invoice with an amount. For a Lightning address or an LNURL-pay link, resolve it first:
2
Create the swap
3
Fund the lockup
Send exactly
swap.expectedAmount to swap.address in one transaction from your wallet.4
Wait for the payment
The swap reaches
invoice.paid, then transaction.claimed. You are done.Python
Python
If something goes wrong
If the swap reachesinvoice.failedToPay, transaction.lockupFailed, or swap.expired, refund the lockup:
timeoutBlockHeight. See Claims and refunds.