get_invoice_status
Check if a Lightning invoice has been paid by providing the payment hash from invoice creation.
Instructions
Check if a created invoice has been paid. Use the payment_hash from create_invoice.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| payment_hash | Yes | Payment hash of the invoice to check |
Implementation Reference
- src/index.ts:115-117 (schema)Zod schema for get_invoice_status input validation, requiring a 'payment_hash' string parameter.
const GetInvoiceStatusSchema = z.object({ payment_hash: z.string().describe('Payment hash of the invoice to check'), }); - src/index.ts:367-377 (registration)Tool registration in the MCP ListTools handler, defining name, description, and input schema for 'get_invoice_status'.
{ name: 'get_invoice_status', description: 'Check if a created invoice has been paid. Use the payment_hash from create_invoice.', inputSchema: { type: 'object', properties: { payment_hash: { type: 'string', description: 'Payment hash of the invoice to check' }, }, required: ['payment_hash'], }, }, - src/index.ts:954-973 (handler)MCP CallToolRequest handler for 'get_invoice_status' - parses args, calls LightningFaucetClient.getInvoiceStatus(), and formats the response.
case 'get_invoice_status': { const parsed = GetInvoiceStatusSchema.parse(args); const result = await session.requireClient().getInvoiceStatus(parsed.payment_hash); return { content: [ { type: 'text', text: JSON.stringify({ success: true, paid: result.paid, amount_sats: result.amountSats, settled_at: result.settledAt, preimage: result.preimage, expired: result.expired, new_balance: result.newBalance, }, null, 2), }, ], }; } - src/lightning-faucet.ts:337-361 (handler)Core implementation of getInvoiceStatus in LightningFaucetClient. Sends API request to 'get_invoice_status' endpoint with payment_hash, determines payment status (paid/settled/expired), and returns the result.
async getInvoiceStatus(paymentHash: string): Promise<{ paid: boolean; amountSats: number; settledAt?: string; preimage?: string; expired: boolean; newBalance?: number; rawResponse: InvoiceStatusResponse; }> { const result = await this.request<InvoiceStatusResponse>('get_invoice_status', { payment_hash: paymentHash, }); const paid = result.paid || result.settled || result.status === 'settled'; return { paid, amountSats: result.amount_sats || 0, settledAt: result.settled_at, preimage: result.preimage, expired: result.expired || false, newBalance: result.new_balance, rawResponse: result, }; } - src/lightning-faucet.ts:54-65 (helper)InvoiceStatusResponse interface definition used by get_invoice_status to type the raw API response.
interface InvoiceStatusResponse extends ApiResponse { status?: string; paid?: boolean; settled?: boolean; amount_sats?: number; memo?: string; expires_at?: string; settled_at?: string; preimage?: string; expired?: boolean; new_balance?: number; }