How to integrate Telegram Stars with a digital store
Follow a Telegram bot checkout, map a recipient delivery and test what happens when an event arrives twice.
Accepting Stars for a digital item
Telegram specifies XTR for digital goods sold in a bot or mini app. Create an invoice with sendInvoice, examine the pre_checkout_query and respond with answerPreCheckoutQuery. Release the purchased item after successful_payment. Store telegram_payment_charge_id with the purchase reference so support can locate the payment for a refund.
Delivering a Stars bundle to a buyer
Obtain the delivery contract from the B2B platform you choose. Bind your order reference to a quantity and a verified recipient identifier. Show both to the buyer before the final confirmation. If the contract returns an external reference, save it as soon as the response arrives. Track the incoming payment and the outgoing delivery separately so support can explain either stage.
For SPXRK, delivery.telegram_username identifies the recipient and quantity on a Stars item is the number of Stars. Select the current SKU from your catalogue and check its quantity limits before submission. For Telegram Premium, set quantity to one and select the SKU for the intended subscription term.
Run two acceptance tests
In a test environment, deliver the same successful payment event to your application twice. Check that one payment record exists and one delivery job was queued. Next, simulate a lost response after delivery submission. The customer should see a pending purchase with the same order number. Your operator should have enough information to reconcile the result before another submission.