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
- Open the
03_StarsPayment_Demoscene. - Drag
FastTMA_StarsPayButtonunderCanvasor your store shelf panel. - Select the button and customize parameters in
TelegramStarsButtonwithin the Inspector:
| Field | Description |
|---|---|
| Product Id | Unique product identifier (e.g., vip_pass_tier1) |
| Title | Checkout sheet title, max 32 characters (e.g., 30-Day VIP Pass) |
| Description | Product description, max 255 characters |
| Stars Price | Amount of Stars to charge (e.g., 50) |
- 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
- Select an existing custom purchase button in your commercial project (preserving original animations and materials).
- Click Add Component →
TelegramStarsButton. - Remove the fulfillment method previously attached to Button OnClick, and bind it to the
OnPurchaseSuccessevent slot ofTelegramStarsButton.
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.