Skip to content

Commit f304467

Browse files
committed
Add more Walkthrough sections
1 parent 296da5b commit f304467

3 files changed

Lines changed: 50 additions & 2 deletions

File tree

src/index.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ Its key features include:
2323

2424
### Walkthrough
2525

26-
Start with the main walkthrough. Individual sections are tagged when they apply only to user accounts or bots.
27-
2826
#### Main
2927

3028
{{ "main" |> walkthrough }}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: Star Balance and Transactions
3+
parent: /#walkthrough
4+
walkthrough:
5+
track: main
6+
order: 21
7+
---
8+
9+
Clients can check their Telegram Star balance and transaction history.
10+
11+
## Getting the Balance
12+
13+
Use {{ "getStarBalance" |> m }} with `"me"` to get the current account's balance.
14+
15+
```ts
16+
const balance = await client.getStarBalance("me");
17+
18+
console.log(balance.amount, balance.nanos);
19+
```
20+
21+
## Listing Transactions
22+
23+
Use {{ "getStarTransactions" |> m }} to get the current account's transactions.
24+
25+
```ts
26+
const { transactions } = await client.getStarTransactions("me", {
27+
limit: 10,
28+
});
29+
30+
for (const transaction of transactions) {
31+
console.log(transaction.id, transaction.amount.amount);
32+
}
33+
```

src/star-payment-refunds.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: Star Payment Refunds
3+
parent: /#walkthrough
4+
walkthrough:
5+
track: bot
6+
order: 17
7+
---
8+
9+
Bots can refund payments made with Telegram Stars.
10+
11+
## Refunding a Payment
12+
13+
Use {{ "refundStarPayment" |> m }} with the charged user's identifier and the `telegramPaymentChargeId` from the successful payment.
14+
15+
```ts
16+
await client.refundStarPayment(userId, telegramPaymentChargeId);
17+
```

0 commit comments

Comments
 (0)