Skip to content

03 · Stars Virtual Currency Payment

Used to open the native Telegram checkout sheet to deduct Stars and securely fulfill goods.


Implementation Tracks

Track A — Prefab Workflow

  1. Open the 03_StarsPayment_Demo scene.
  2. Drag FastTMA_StarsPayButton under Canvas or your store shelf panel.
  3. Select the button and customize parameters in TelegramStarsButton within the Inspector:
FieldDescription
Product IdUnique product identifier (e.g., vip_pass_tier1)
TitleCheckout sheet title, max 32 characters (e.g., 30-Day VIP Pass)
DescriptionProduct description, max 255 characters
Stars PriceAmount of Stars to charge (e.g., 50)
  1. Fulfillment Binding: In the On Purchase Success (String) event slot at the bottom, click +, drag in your fulfillment script (e.g., BagManager), and select the reward fulfillment method from the dropdown.

Track B — Non-Invasive Component Attachment

  1. Select an existing custom purchase button in your commercial project (preserving original animations and materials).
  2. Click Add Component → TelegramStarsButton.
  3. Remove the fulfillment method previously attached to Button OnClick, and bind it to the OnPurchaseSuccess event slot of TelegramStarsButton.

Runtime Logic: Upon click, the component automatically:

  • Requests an invoice link from the Cloudflare Worker deployed in Step 2
  • Opens the native Telegram checkout sheet
  • Triggers the fulfillment function after payment confirmation

Demo Reference

See Packages/com.fasttma.core/Samples/03_StarsPayment for the full Demo implementation.