Skip to main content
Glama

get_invoice_status

Check payment status of Bitcoin Lightning invoices using payment hash to verify if transactions are complete.

Instructions

Check if a created invoice has been paid. Use the payment_hash from create_invoice.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
payment_hashYesPayment hash of the invoice to check

Implementation Reference

  • The tool handler for get_invoice_status in the MCP server request handler.
    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),
          },
        ],
      };
    }
  • The client-side implementation of getInvoiceStatus which sends the request to the backend.
    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,
      };
  • Input validation schema for the get_invoice_status tool.
    const GetInvoiceStatusSchema = z.object({
      payment_hash: z.string().describe('Payment hash of the invoice to check'),
    });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lightningfaucet/lightning-wallet-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server