RU Open Web

Type to search client APIs, Bot API methods, and guides.

Bots & Mini Apps — Payments & Walt Ledger (THV)
Bots & Mini Apps Payments & Walt Ledger (THV)

Payments & Walt Ledger (THV)

Accept in-platform THV payments inside bots and Mini Apps with sendInvoice, createInvoiceLink, and successful_payment updates.

Theaver includes a built-in Walt ledger (@walt) for virtual internal THV units inside bots and Mini Apps. For legacy currency-code aliases when porting existing checkout flows, see Migrating Bots.

Creating invoices via Bot API

Use sendInvoice to post an interactive payment card into chat, or createInvoiceLink to obtain an invoice_url that opens in-app via window.Theaver.WebApp.openInvoice(url):

POST /bot<token>/sendInvoice
Bot Token
{
  "chat_id": 849201432,
  "title": "Pro Plan — 1 Month",
  "description": "Unlock custom automation templates and priority queue processing.",
  "payload": "order_pro_30d_user42",
  "currency": "THV",
  "prices": [
    { "label": "30-day access", "amount": 50 }
  ]
}

If reply_markup does not specify a pay: true button, the backend automatically prepends a native payment button (Pay 50 THV).

Handling successful_payment

When a user completes payment in Walt:

  1. THV balances settle atomically from the buyer to the bot ledger.
  2. Your bot receives an Update containing message.successful_payment via getUpdates or webhook:
{
  "update_id": 1094,
  "message": {
    "chat": { "id": 849201432, "type": "private" },
    "from": { "id": 491827364, "username": "alex" },
    "successful_payment": {
      "currency": "THV",
      "total_amount": 50,
      "invoice_payload": "order_pro_30d_user42",
      "provider_payment_charge_id": "walt_tx_..."
    }
  }
}

Withdrawing earned THV

Bot owners inspect earnings and withdraw accrued THV to their personal @walt account directly inside the @BotMother Studio Mini App.

Verify invoice_payload server-side

Always match successful_payment.invoice_payload and total_amount against an open order record in your database before provisioning perks or digital goods.