Source: https://cryptanio.com/wiki/accept-crypto-payments-telegram-bot/
Language: en

# How to accept crypto payments in a Telegram bot

Link a physical\-product order in your own Telegram bot to a Cryptanio invoice\, send a payment link\, and verify payment\. Includes Telegram Stars and Mini Apps restrictions\.

Updated: 2026-11-14

You can link a cryptocurrency payment to an order in your own Telegram bot\: your server creates a Cryptanio invoice\, the bot sends the buyer a link\, and\, after verifying payment\, confirms that the order has been accepted\. This guide uses a shop selling physical goods\, such as printed posters\. You develop and maintain the bot and order processing yourself\.

## Check Telegram\'s rules first {#check-telegram-s-rules-first}

Digital goods and services sold inside Telegram must be paid for with Telegram Stars\, identified by XTR\. Paid access to a bot\'s content is one example\. Linking to an external website does not create an exception\: you cannot offer cryptocurrency instead of Stars for such a purchase\. These restrictions are explicitly covered in the [Telegram Stars documentation](<https://core.telegram.org/bots/payments-stars>)\.

Our scenario uses a regular bot without a Mini App to sell a physical product\. Mini Apps and their associated bots face additional blockchain integration restrictions\, including the use of TON\. Regular bots without a Mini App are explicitly exempt from those rules in the [Telegram Blockchain Guidelines](<https://core.telegram.org/bots/blockchain-guidelines>)\. Do not transfer this setup to a Mini App without checking its requirements separately\. Telegram\'s rules were checked on November 13\, 2026\.

## What you need {#what-you-need}

Prepare your own bot\, a server to run it\, a Cryptanio account\, and a project with an active Payments service\. You need receiving addresses connected to that project\'s Payments service and a live API key with permission to manage invoices and access the relevant service\.

Keep the Telegram bot token\, Cryptanio API key\, and webhook verification secret on your server\. Send the buyer only their payment link\. This scenario does not provide a ready\-made connection that creates your shop and processes orders for you\.

## 1\. Prepare the payment project {#1-prepare-the-payment-project}

Activate Payments and add receiving addresses to the service\'s pool through the dashboard\. An address\-book entry alone is not enough\. Make sure the network and asset you need are available in your project\; do not promise the buyer options that are absent from the payment page\.

If the difference between USDT and a network is still unclear\, start with [Network and token](<https://cryptanio.com/wiki/network-and-token/>)\. The [invoice](<https://cryptanio.com/wiki/what-is-an-invoice/>) itself links a particular payment request to its status\.

## 2\. Link the order to the buyer {#2-link-the-order-to-the-buyer}

Once the user has chosen a poster and confirmed the order\, your server creates an internal order number\. Store the relationship between the order\, the Telegram buyer\, and the future invoice ID\. Keep contact information and the shipping address in your own system\; they do not need to appear in a technical link or a public message\.

The stored invoice ID must identify one order unambiguously\. This lets you process the payment even after the bot restarts\.

## 3\. Create a separate invoice {#3-create-a-separate-invoice}

Create the invoice through API v1 on your server\. To let the buyer choose a network and asset\, specify the order quote using invoice\_currency and invoice\_amount\. For example\, USD 12\.50 is a unit of quotation\, while payment is made in a supported cryptocurrency\. This does not mean accepting dollars or automatically converting funds\.

The following block references a supported order\-creation example in the documentation catalog\:

```bash
#!/usr/bin/env bash
set -euo pipefail
: "${CRYPTANIO_API_KEY:?Set CRYPTANIO_API_KEY}"
: "${CRYPTANIO_OPERATION_ID:?Set CRYPTANIO_OPERATION_ID}"
: "${CRYPTANIO_PROJECT_ID:?Set CRYPTANIO_PROJECT_ID}"
json_string() {
  local text="$1" char code index output='"'
  for ((index=0; index<${#text}; index++)); do
    char="${text:index:1}"
    case "$char" in
      '"'|'\') output+="\\$char" ;;
      *) printf -v code '%d' "'$char"
         if ((code < 32)); then printf -v char '\\u%04x' "$code"; fi
         output+="$char" ;;
    esac
  done
  printf '%s"' "$output"
}
response_file="$(mktemp)"
trap 'rm -f "$response_file"' EXIT
transfer_status=0
http_status="$(curl \
  --silent --show-error --max-time 30 --request POST \
  --header "Authorization: Bearer $CRYPTANIO_API_KEY" \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header "Idempotency-Key: $CRYPTANIO_OPERATION_ID" \
  --data-binary '{"project":'"$(json_string "$CRYPTANIO_PROJECT_ID")"',"invoice_currency":"USD","invoice_amount":"12.50","reference":"order-42"}' \
  "https://api.cryptanio.com/v1/invoices" \
  --output "$response_file" --write-out '%{http_code}')" || transfer_status=$?
if [[ "$http_status" == 2?? ]]; then
  cat "$response_file"
  exit "$transfer_status"
fi
printf 'HTTP %s\n' "$http_status" >&2
cat "$response_file" >&2
exit 1
```

[Download example](</wiki/examples/ace23bd7c3cba0e47dafdcd6075a506ddb2ec8d6581c6129af815c1558f5a8fc.sh>)

Supply your own order parameters\. Each new operation needs a unique Idempotency\-Key\; when retrying the same request after a failure\, keep the original key\. A repeated click should therefore not create another invoice\. See the [order confirmation guide](<https://cryptanio.com/wiki/confirm-orders-with-crypto-payment-webhooks/>) for details\.

## 4\. Send the buyer the link {#4-send-the-buyer-the-link}

Save checkout\_url from the creation response and send it as a link button in a private chat\. The Bot API supports URL buttons\, as described under [InlineKeyboardButton](<https://core.telegram.org/bots/api#inlinekeyboardbutton>)\. The buyer opens the Cryptanio page and chooses an available payment method\.

Send the exact URL you received\. Do not construct a link from the ID\: the link returned when reading an invoice is for viewing\. The saved creation response is what you need to continue the interactive payment flow\.

## 5\. Verify payment on your server {#5-verify-payment-on-your-server}

Configure the project\'s [webhook](<https://cryptanio.com/wiki/what-is-a-webhook/>) to point to your handler and verify the signature against the original request body\. Match the event to the stored invoice\, then check its current status through the API\.

Process the order only when the invoice status is paid\. Discovering a transaction\, the buyer returning to the chat\, or their message saying “I\'ve paid” does not provide that confirmation\. A partial\, insufficient\, excessive\, or late payment may require a separate decision\; do not confirm such an order automatically\. A repeated webhook must not trigger fulfillment again\.

## How to test and where to look for errors {#how-to-test-and-where-to-look-for-errors}

Test the complete flow with your own order\: creation\, opening the link\, payment\, the status change\, and the bot\'s message\. Account for network fees\; this invoice creation uses real data\. Also test repeated button clicks and duplicate event deliveries\.

If funds have been sent but the order is not confirmed\, check the network\, asset\, payment details\, and [transaction confirmations](<https://cryptanio.com/wiki/transaction-confirmations/>)\. If the status is already paid\, look for an error in the order\-to\-invoice relationship or the bot\'s handler\. You can set up Telegram notifications for the owner using the [separate guide](<https://cryptanio.com/wiki/telegram-crypto-transaction-notifications/>)\; those messages do not replace server\-side order verification\.

Tags: [Payments](https://cryptanio.com/wiki/tag/payments/), [Telegram](https://cryptanio.com/wiki/tag/telegram/), [Webhooks](https://cryptanio.com/wiki/tag/webhooks/)

## Related articles

- [How networks and tokens differ](https://cryptanio.com/wiki/network-and-token/)
- [What is an invoice](https://cryptanio.com/wiki/what-is-an-invoice/)
- [How to automatically confirm order payment through a webhook](https://cryptanio.com/wiki/confirm-orders-with-crypto-payment-webhooks/)
