TELEGRAM BLOG
Платежи через ботов в телеграм
Обновление Telegram v.4.0 включает в себя две другие основные функции в дополнение к платежам. Не пропустите новый сервис видео сообщений — телескоп и Instant View Platform !
Представьте себе мир, где вы можете заказать пиццу, заплатить за пару обуви, такси, или заплатить и тут же войти в метро — все в несколько нажатий кнопок прямо в телеграмм.
Для того, чтобы создать этот мир, сегодня мы запускаем Bot платежи. Теперь боты могут принимать платежи от своих пользователей по всему миру:
Если у вас установлена Телеграмм 4.0 (или более поздняя версия), то вы можете заказать товары или услуги от ботов и тут же оплатить их если бот предоставил кнопку оплаты. При нажатии кнопки оплаты, вам будет предложено заполнить данные вашей кредитной карты и подтвердить платеж. Вуаля! И всё это не выходя из любимого мессенджера!
Если ваша учетная запись защищена 2-двухэтапной авторизацией, то вы можете сохранить вашу карту для будущих покупок.
Оплатить прямо сейчас
Попробуйте наш демо @ShopBot, чтобы получить пример счёта на оплату (этот демо — продает машины времени, которые не существуют) . Если вы хотите, проверить реальный процесс оплаты с реальными деньгами, то попробуйте нашего @TelegramDonate бота.
Телеграмм является открытой платформой, так что разработчики ботов могут смело внедрять необходимые интерфейсы и принимать платежи от пользователей прямо сейчас, без длительных процедур утверждения платежных систем. Если вы разработчик бота, посмотрите документацию и приступайте!
В настоящее время большинство платежей обрабатывается системой stripe.com, но Bot Pay — это платформа для оплаты поставщиков услуг по всему миру, поэтому при приеме платежа от пользователя, разработчик бота может предоставить ему выбор между всеми доступными платежными системами (например выбрав один уже используемый покупателем метод оплаты или с наименьшей комиссией)
Stripe — это только начало. В ближайшие дни, бот-платежи будут доступны для разработчиков в Индии через RazorPay, в Нигерии, Кении, Ганы, Южной Африки и Уганды через FlutterWave, и в более чем 190 других странах через Paymentwall.
Наберитесь терпения, так как вскоре Yandex.Money и Qiwi также будут доступны для оплаты из России и Payme из Узбекистана будут подключены чуть позже. Следите за обновлениями нашего канала @Tblog, чтобы первыми узнать о подключении новых способов оплаты.
Если вы являетесь платежной системой или поставщиком оплаты (особенно в развивающихся странах), то нажмите здесь, чтобы узнать, как попасть на борт Telegram Payments.
Как происходит оплата в Телеграм
Телеграмм при приёме платежей выступает в качестве посредника между плательщиком-пользователем, разработчиком бота, и выбранной платежной системой. Пользователь отправляет свои данные кредитной карты непосредственно к платежной системе. После чего ответ платежной системы и необходимые технические данные, введенные пользователем, передаются разработчику бота, так что они могут обработать и завершить заказ.
Телеграм не участвует напрямую в проведении платежей, поэтому любые спорные платежи возлагаются на ответственность разработчиков ботов, провайдеров платежных систем и банков, которые участвовали в заказе. Телеграм лишь будет выступать в роли шерифа — стрелять плохих роботов и награждать хороших значком. Мы уверены, что хороших ботов будет больше.
Поскольку Телеграмм не обрабатывает платежи, мы не храним и не можем получить доступ к любым конфиденциальным данным. Мы также не берем комиссию с платежей и не получаем прибыль от этих сделок.
- … один из наших прекрасных пользователей, то вскоре ты увидишь, какие чудо боты появятся на свет благодаря нашим разработчикам, используя эту новую платформу. В то же время, уже сейчас Вы можете попробовать демо @ShopBot, чтобы получить представление о том, что будет происходить при оплате или попробуйте потратить реальные деньги через @TelegramDonate.
- … разработчик бота, ознакомьтесь с Введением в платежи и PAYMENT API , чтобы увидеть то, что вы можете создать на этой платформе.
- … провайдер платежей, то узнайте, как попасть на борт Телеграм.
Вас по какой-то странной причине не оказалось в списке указанном выше ? Не расстраивайтесь, присоединяйтесь к Телеграм сейчас!
Удачных покупок всем, и до скорых обновлений!
Май 18, 2017
Телеграмм команда
Источник
Payments for Bots
UPD 2021: For up-to-date information about Payments on Telegram, see Payments 2.0 and the Payments Documentation.
Imagine a world where you can order pizza, pay for a pair of shoes, hire a cab, or refill your subway pass — all in a few button taps on Telegram.
To make this world possible, we are launching Bot Payments today. Bot developers can now accept payments from their users around the world, just like that:
If you have Telegram 4.0 (or newer) installed, you can order goods or services from bots that offer them. These bots may now add a Pay button to their messages. When you tap Pay, you’ll be asked to fill in your credit card and shipping information and confirm the payment. Then you get what you paid for. Voila!
If your account is protected by 2-Step Verification, you can save your card for future purchases. If you do that, ordering stuff from bots will only take two taps. Bot Payments also support Apple Pay for a completely frictionless experience.
Try our demo @ShopBot to get a taste of what’s coming. (Note: Our demo bot thinks it sells time machines, but they’re not a part of what’s coming. Sadly.) If you’re looking to test a real payment with actual money, stop by our @TelegramDonate bot.
Telegram is an open platform, so bot developers can implement the necessary APIs and accept payments from users starting right now, without lengthy approval dramas. If you’re a bot developer, check out the docs immediately!
At launch, most of the payments were handled by Stripe, but Telegram Bot Payments are a platform for payment providers all over the world. When accepting a payment from a user, the bot developer can choose between all available payment providers, selecting the one already used by the buyer or the one with the lowest commission.
UPD, 14.06.2017: Bot developers can now process payments from more than 200 countries via the global payment provider Paymentwall.
UPD, 02.06.2017: Yandex.Money and Payme are now also available as payment providers.
UPD, 01.09.2017: Rave by Flutterwave is now available, which is especially helpful for developers in Nigeria, Kenya, Ghana, South Africa, and Uganda.
This is just the beginning. In the next few days, payments will become available to developers in India via Razorpay, in Russia Qiwi will be joining the club a little later.
Follow our @BotNews channel to be the first to know about new providers joining.
If you’re a payment provider (especially in a developing country), click here to learn how to get on board.
Telegram acts as a messenger (pun intended) between the paying user, the bot developer, and their chosen payment system. The user sends their credit card details directly to the payment system. Then the payment system’s response and the shipping details entered by the user are passed to the bot developer so that they can process the order.
Due to this structure, it is impossible for Telegram to handle complaints or cashbacks – any disputed payments are the responsibility of the bot developers, payment providers, and banks that participated in the exchange.
Since Telegram doesn’t process the payments, we don’t store and can’t access any sensitive data. We also don’t take any commission from payments and don’t profit from these transactions.
Instead, we just do what every sheriff has to do with strangers passing through their turf: shoot the bad bots and award the good ones with a badge. We’re sure there’ll be plenty of good ones.
- …one of our lovely users, wait and see what wonders Telegram bot developers will soon bring your way using this new platform. Meanwhile, try our demo @ShopBot to get an idea of what’s coming or try spending some real money via @TelegramDonate.
- …a bot developer, check out our Introduction to Payments and Payments API to see what you can build.
- …a payments provider, learn how to get on board.
And if you’re none of the above for some weird reason, be a user, do the right thing. Happy shopping, everyone!
May 18, 2017
The Telegram Team
Источник
Bot Payments API
Telegram Bot Payments are a free and open platform that allows sellers to accept payments for goods and services from Telegram users. Telegram doesn’t collect payment information and takes no commission.
Note: This article is intended for bot developers and store owners. If you’re looking for a general overview of Telegram Payments, check out the Telegram blog.
If you are new to Telegram bots and would like to learn how to create and set up a bot, please consult our Introduction to Bots and Bot FAQ.
Payments 2.0 were added in April 2021 with Bot API v.5.2. New features:
- Send invoices to any chat, including to groups and channels.
- Create invoices that can be forwarded and used by multiple buyers to order things.
- Use inline mode to help users show your goods and services to their friends and communities.
- Allow tips from users with preset and custom amounts.
- Accept payments from users on mobile or desktop apps.
- Try @ShopBot to create a test invoice – or start a message with @ShopBot . in any chat for an inline invoice.
- Check out Demo Shop for an example of a Telegram Channel used as virtual storefront.
Users need to update to Telegram 7.7 or higher to use Payments 2.0 (for Telegram Desktop, 2.7.2 or higher). Older mobile apps released after May 2017 support basic payments in chats with bots.
You create a bot that offers goods and services to Telegram users. Merchant bots can send specially formatted invoice messages to users, groups or channels. If your bot supports inline mode, users can also send invoices to other chats via the bot, including to one-on-one chats with other users.
Invoice messages feature a photo and description of the product along with a prominent Pay button. Tapping this button opens a special payment interface in the Telegram app. In this interface, users can choose a tip amount (if allowed by the merchant) and enter additional details like shipping info, phone number, or email address.
The bot can offer several shipping options for physical goods based on the delivery address. When ready, users enter their credit card info or choose a saved card — and pay for the product. Telegram also supports Apple Pay and Google Pay. Once the transaction is done, the merchant bot can send a receipt message with payment details, shipping and delivery information.
Telegram does not process payments from users and instead relies on different payment providers around the world. It is the payment providers that handle and store all sensitive information, like credit card details. Neither Telegram nor the bot developers have access to it.
For the moment we support payments from more than 200 countries via the the following payment providers:
We continue expanding this list, follow @BotNews for updates.
If you work for a company that provides services similar to standalone accounts in Stripe Connect, please let us know via @BotSupport (include the hashtag #paymentsprovider in your message).
This section explores payments via Telegram’s Bot API in more detail.
To start accepting payments, you need a Telegram bot. Use BotFather to create a bot if you don’t have one already.
Now you have a merchant bot that can offer goods or services to Telegram users. Let’s call it @merchantbot in this document. The first stop is to choose and connect a payment provider, you can find the list of supported providers above.
- Use the /mybots command in the chat with BotFather and choose the @merchantbot that will be offering goods or services.
- Go to Bot Settings > Payments.
- Choose a provider, and you will be redirected to the relevant bot.
- Enter the required details so that the payments provider is connected successfully, go back to the chat with Botfather.
- The message will now show available providers. Each will have a name, a token, and the date the provider was connected.
- You will use the token when working with the Bot API.
You will find the necessary methods for building your payment implementation in the Payments Section of the Bot API Manual.
While you’re still developing and testing payments for your bot, use the “Stripe TEST MODE” provider. When in this mode, you can make payments without actually billing any accounts. Real cards can’t be used in test mode, but you can use test cards like 4242 4242 4242 4242 (full list here). You can switch between test mode and live mode as many times as you want, but please see the live checklist before you go live.
See Bot API: Payments for the complete list of available methods and objects.
The user contacts @merchantbot and requests to purchase something. The bot forms an invoice message with a description of the goods or service, amount to be paid, and requested shipping info. There are two ways of creating an invoice:
Use the sendInvoice method to generate an invoice and send it to a chat. The provider_token parameter is where you put the token value that you’ve obtained earlier via Botfather. It is possible for one merchant bot to use several different tokens for different users or different goods and services.
As of Payments 2.0, invoice messages with a pay button can be sent to chats of any type: private chats with the user, groups, or channels. The resulting invoice message will look like this:
If @merchantbot supports inline mode, you can use inputInvoiceMessageContent to allow users to share invoices for your goods and services to their one-on-one chats with friends, or to their groups and channels. These invoices will have a Pay button that can be used multiple times.
As of Payments 2.0 there are two ways for handling forwarded copies of your invoices, controlled by the parameter start_parameter in the sendInvoice method.
- A. Multi-chat invoice. Forwarded copies show a Pay button, which multiple users can press and attempt to pay for the goods or services. Inline invoices are always multi-chat invoices.
- B. Single-chat invoice. Invoice can only be paid from the chat to which it was sent, forwarded copies show a URL button with a deep link to the bot. The deep link can be used to generate a similar invoice in the chat with the bot, to show an error message, or for other purposes. More info on Deep Linking »
If a single-chat invoice is sent to the chat with @merchantbot , it can only be paid once. If a single-chat invoice is sent to any other chat, it can be paid many times by many users.
To get a better understanding of how this works, try toggling the “Pay from Forwards” parameter when creating invoices with our demo @ShopBot.
Regardless of whether or not the Pay button is available in an invoice, the merchant bot always has the power to decide whether or not to accept new payments for a particular invoice.
If the max_tip_amount parameter is set to above 0 , users can add a tip to their payment. You can use the parameter suggested_tip_amounts to suggest particular amounts that you feel will be relevant for the invoice.
The user specifies shipping information or other info requested by the bot. This could be the user’s full name, an email address, a phone number in international format, or a full postal address for delivery.
If a shipping address was requested and you included the parameter is_flexible, the Bot API will send an Update with a shipping_query field to the bot. The bot must respond using answerShippingQuery either with a list of possible delivery options and the relevant delivery prices, or with an error (for example, if delivery to the specified address is not possible).
Tip: It is recommended that the merchant bot confirms availability of the goods/services at this step – to let the user know in case they are no longer available. This is especially important if you are using multi-chat, inline or single-chat, multi-use invoices.
The user selects a delivery option from the list (the overall amount to be paid may change at this point) and proceeds to checkout.
Choose Delivery Option
The user enters their payment information and presses the final pay button. At this moment the Bot API sends an Update with the field pre_checkout_query to the bot that contains all the available information about the order. Your bot must reply using answerPrecheckoutQuery within 10 seconds after receiving this update or the transaction is canceled.
The bot may return an error if it can’t process the order for any reason. We highly recommend specifying a reason for failure to complete the order in human readable form (e.g. «Sorry, we’re all out of rubber ducks! Would you be interested in a cast iron bear instead?»). Telegram will display this reason to the user.
Warning: As of Payments 2.0, it is critical to make sure your bot only accepts multiple payments when the order can be processed correctly. This is especially important if you are using multi-chat, inline or single-chat, multi-use invoices.
In case the bot confirms the order, Telegram requests the payment provider to complete the transaction. If the payment information was entered correctly and the payment goes through, the API will send a receipt message of the type successful_payment from the user. Once your bot receives this message, it should proceed with delivering the goods or services purchased by the user.
If the invoice message was sent in the chat with @merchantbot , it becomes a Receipt in the UI for the user — they can open this receipt at any time and see all the details of the transaction:
If the message was sent to any other chat, the Pay button remains and can be used again. It is up to the merchant bot whether to actually accept multiple payments.
Once you’ve tested everything and confirmed that your payments implementation works, you’re ready to switch to LIVE MODE. To do this, go to BotFather > /mybots > select @merchantbot > Bot Settings / Payments and enable Stripe LIVE MODE. You will get a token that has the string :LIVE: in the middle, e.g. 123:LIVE:XXXX . Do not give this token to any third parties!
Before your merchant bot goes into live mode, please ensure the following:
- We highly recommend turning on 2-step verification for the Telegram account that controls your bot.
- You as the bot owner have full responsibility in case any conflicts or disputes arise. You must be prepared to correctly process disputes and chargebacks (in the case of Stripe, see here and here).
- To prevent any misunderstandings and possible legal issues, make sure your bot can respond to a /terms command (or offers a similarly easy way of accessing your Terms and Conditions). Your Terms and Conditions should be written in a clear way and easy to understand for your users. The users must confirm that they have read and agree to your terms before they make the purchase.
- Your bot must provide support for its customers, either by responding to a /support command or by some other clearly communicated means. Users must have a clear way of contacting you about their purchases and you must process their support requests in a timely fashion. You must notify your users that Telegram support or bot support will not able to help them with purchases made via your bot.
- Make sure that your server hardware and software is stable. Use backups to make sure that you don’t lose data about your users’ payments.
- Make sure that you have completed the live checklist for your selected payments provider as well as this one.
If you work for a company that provides services similar to standalone accounts in Stripe Connect, please let us know via @BotSupport (kindly include the hashtag #paymentsprovider in your message).
Telegram does not charge any commission for using the Payments API. Note though, that most payment providers will have their own commissions. For example, Stripe in the US charges 2.9% + 30¢ per successful card charge (see the Stripe website for more details on pricing).
Yes. If you are not a developer, you will need to either hire someone to make a bot for you (recommended), or use a bot created by a third-party company. We advise extreme caution when using services of bots that process payments for you – Telegram doesn’t maintain any such bots and doesn’t endorse any of the third-party bots offering these services.
Telegram does not impose any limits on what products or services your bot can offer. But please note that you must comply with the rules of the payments provider you choose in our system. E.g., Stripe has a special page for prohibited businesses – you may want to consult that one before you start selling harvested organs.
Special Note: Due to Apple’s limitations, bot developers are currently not allowed to accept payments for digital goods and virtual services from iOS users.
Telegram acts as a messenger between the paying user, the bot developer, and their chosen payment system. The user sends their credit card details directly to the payment system. Then the payment system’s response and the shipping details entered by the user are passed to the bot developer so that they can process the order.
Since Telegram doesn‘t process the payments, we don’t store and can‘t access any sensitive data. Due to this structure, it is impossible for Telegram to handle complaints or cashbacks – any disputed payments are the responsibility of the bot developers, payment providers, and banks that participated in the exchange.
Telegram payments currently support the currencies listed below (here’s a JSON version in case you need it).
If you’re using Stripe as the payments provider, supported currencies may vary depending on the country you have specified in your Stripe account (more info).
The minimum and maximum amounts for each of the currencies roughly correspond to the limit of US$ 1-10000 . The amount must be expressed in 12 digits or less, so the maximum value will be correspondingly lower for some lower-value currencies. Note that for each currency except USD these limits depend on exchange rates and may change over time (plan ahead for this when you implement limits in your code).
Источник