Newsroom · Guides
Guides

Build a Telegram Payout Bot on a Payments API: 5 Steps

To build your own Telegram payout bot, you connect a bot you control to a payments API in five steps: request a quote, show a confirm card, execute the quote with a unique key, receive the webhook, and fetch the receipt. With Storspay this is done on the Enterprise plan, with a narrowly scoped API key and a sandbox to test first.

Storspay2 min read

What do you need before you start?

What is a scoped key, and why does it matter?

An API key is the secret your bot uses to speak to Storspay. A scoped key can do only a short list of things. The payout bot template allows three: create quotes and pay out, read balances, and download receipts.

That key can never change team members, bank details or the plan. You also set limits on the key and, if you wish, the IP addresses allowed to use it.

What are the five build steps?

  1. Request a quote. Your bot sends the IBAN, the recipient's name and the amount. The answer carries the exact fee and the total.
  2. Show the card. Build the confirm card from the quote, not from what the user typed, and show it only to the person allowed to pay.
  3. Execute the quote with a unique idempotency key. This is a label you attach to one payment. If the same request arrives twice, the second returns the same payment and nothing is paid twice.
  4. Receive the webhook. Storspay tells your server what happened to the payment.
  5. Fetch the PDF receipt and post it in the chat.

What is a webhook, in plain words?

A webhook is a message that Storspay sends to your server when something happens, so your bot does not have to keep asking. You receive one when a payment is paid, held, returned or failed.

Webhooks are signed. Your server checks the signature to be sure the message really comes from Storspay before it tells the user "Paid".

What should you test in the sandbox?

CaseWhat your bot should do
Quote older than 60 secondsSay it expired and ask for the details again
Confirm tapped twiceReturn the same payment
Payment heldSay it is under review and wait
Payment returnedSay the money is back on the balance; do nothing more
API cannot be reachedSay "Not sent, try again"; never retry by itself

Which rules are worth copying from the hosted bot?

The hosted Storspay bot follows a few rules that any payout bot should keep. Only the owner can confirm. A first payment to a new IBAN needs a one-time code sent outside the bot. A person, not the bot, decides what happens after an error.

For example, a firm in Lagos builds a bot for its finance lead. A request for €480 produces a card with a fee of €6.75; she confirms, the webhook says paid, and the bot posts the receipt. Chat payouts are in early access for verified businesses on the Premium or Enterprise plan; your own bot needs Enterprise.

Frequently asked questions

Which plan do I need to build my own payout bot?

The Enterprise plan, which includes the API: $1,990 for the first year, then $199 a month.

Can an API key for a bot change my bank details?

No. A key from the payout bot template can create quotes and pay out, read balances and download receipts. It can never change team members, bank details or the plan.

What is an idempotency key?

A unique label attached to one payment request. If the request is sent twice, the second returns the same payment, so nothing is paid twice.

Pay from the chat you already work in. Paste an IBAN, a name and an amount in Telegram or WhatsApp; see the exact fee; only you can confirm.

See how paying by chat works →
Share on LinkedInShare on XEmail

More from the newsroom

Guides

Why a Payment Bot Should Never Retry a Payment on Its Own

Why a payment bot should never retry on its own after a timeout, what "Not sent, try again" means, and why a person decides what happens next.

Guides

Who Can Confirm a Payment in a Business Chat Bot?

Who can confirm a payment in a business chat bot? Why only the owner should, what a client's message can do, and where the confirm card appears.

Guides

Payment Under Review After Paying From a Chat: What It Means

What "under review" means on a payment sent from a chat, why first payments to new recipients are checked, and what you should do: nothing.