An e-commerce Telegram mini app with payment gateway, which can be launched from a Telegram bot
/server folder of this repo contains code for listening to webhook events (which you need to set using setWebhooks) and payment invoice generation API (/invoice-link
route in /server/index.js)
BOT_TOKEN=1341437044:AAEnJflnTJCaUWCkLv0oxip4pFNISMVpneX
PAYMENT_TOKEN=9744372395:TEST:6daf8f15f74fdb831521
CLIENT_APP_URL=https://tgcart-server.vercel.app
BOT_TOKEN - the unique token that is given when your bot is created, you can also get it from botfather
PAYMENT_TOKEN - the unique token that is given after configuring your bot payment gateway
CLIENT_APP_URL - a url value where you going to deploy the client side of this repo (/client folder)
run npm install
inside the /server folder, this will install all the necessary packages
run npm run start
inside the /server folder, this will start the server in port 5000 ( you can also configure this by adding PORT variable in .env file)
/client folder of this repo contains a react app which will render the e-commerce mini app, it also uses the Telegram web app API library (which brings the core APIs to interact with the Telegram bot and app) in client/index.html which will load the Telegram.WebApp module in window object
<script src="https://telegram.org/js/telegram-web-app.js"></script>
VITE_APP_BACKEND_URL=https://tgcart.vercel.app
VITE_APP_NAME=TGCart
VITE_APP_BACKEND_URL - url where your server is running (/server folder of this same repo)
VITE_APP_NAME - name of your telegram mini app
run npm install
inside the /client folder, this will install all the necessary packages like react, tailwind, vite, etc
run npm run dev
inside the /client folder, this will start the dev server which is configured using vite js
live demo of this app can be found at https://t.me/tgcart_miniapp_bot, you can launch the mini app either by clicking the Menu button or by sending any message to this bot like in this video
video6109624432060272772.mp4
client side is served from - https://tgcart.vercel.app
server side is server from - https://tgcart-server.vercel.app