Telegram Stars payments are easy to wire up and awkward to test. Every real test costs real Stars, the interesting failures (a second charge, a redelivered update, a refund you didn't start) are hard to trigger on purpose, and you don't want a staging bot quietly taking money from your teammates.
Here are three layers of testing, from cheapest to most realistic. Most bugs should die in the first one.
Layer 1: fake the updates in your own tests
Your bot never talks to a card or a wallet. It receives two updates ( pre_checkout_query , then a message with successful_payment ) and makes one or two calls back ( answerPreCheckoutQuery , maybe refundStarPayment ). That means you can test almost the whole flow by feeding your handler hand-built updates and recording the calls it makes.
// A fake Bot API: records calls instead of sending them function fakeTelegram ( ) { const calls = [ ] ; return { calls , tg : async ( method , body ) => { calls .…