payments.GetPaymentForm
Get a payment form
Example
const { Api, TelegramClient } = require("telegram");
const { StringSession } = require("telegram/sessions");
const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});
(async function run() {
await client.connect(); // This assumes you have already authenticated with .start()
const result = await client.invoke(
new Api.payments.GetPaymentForm({
invoice: new Api.InputInvoiceMessage({
peer: "username",
msgId: 43,
}),
themeParams: new Api.DataJSON({
data: "some string here",
}),
})
);
console.log(result); // prints the result
})();
import { Api, TelegramClient } from "telegram";
import { StringSession } from "telegram/sessions";
const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});
(async function run() {
await client.connect(); // This assumes you have already authenticated with .start()
const result: Api.payments.PaymentForm = await client.invoke(
new Api.payments.GetPaymentForm({
invoice: new Api.InputInvoiceMessage({
peer: "username",
msgId: 43,
}),
themeParams: new Api.DataJSON({
data: "some string here",
}),
})
);
console.log(result); // prints the result
})();
Parameters
Name | Type | Description |
---|---|---|
flags | # | Flags, see TL conditional fields |
peer | InputPeer | The peer where the payment form was sent |
msgId | int | Message ID of payment form |
themeParams | flags.0?DataJSON | A JSON object with the following keys, containing color theme information (integers, RGB24) to pass to the payment provider, to apply in eventual verification pages: bg_color - Background color text_color - Text color hint_color - Hint text color link_color - Link color button_color - Button color button_text_color - Button text color |
Result
Possible errors
Code | Type | Description |
---|---|---|
400 | MESSAGE_ID_INVALID | The provided message id is invalid. |
Can bots use this method?
No