suvo_/Example8BotPublic · Bot Template

AIThis bot implements a UPI payment gateway integration for Telegram, allowing users to pay ₹1 via UPI to unlock VIP access. The /start command checks if the user is already VIP and shows a payment button if not. The /pay command creates a payment session via an external UPI gateway API, displays a QR code and payment details, while /check_payment verifies the transaction status with signature validation before granting VIP membership. The bot uses HTTP requests, user properties for session tracking, and rich message formatting for payment UI.

Commerceupipaymentgatewayvipsubscriptionqr-code
ProfileTelegram
3 commands1 envUpdated 4d agoCreated Aug 5, 2026
Back to folder

commands/_pay.js

javascript · 116 lines

Raw
1/**#command2name: /pay3answer: 4keyboard: 5parse_mode: markdown6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12try {13  Api.deleteMessage({14    chat_id: chat.id,15    message_id: request.message.message_id16  });17} catch (err) {}18let msg = await Bot.sendMessage("⏳ Creating payment...");19 20let season = await HTTP.post({21  url: "https://upi-gateway-sstu.onrender.com/create",22  body: JSON.stringify({23    key: "dev_7f774018336f80872d41fa4d",24    project_id: "proj_845130c1",25    amount: 1,26    title: "Pay And Start The Bot ✅",27    note: "my bot payment receive",28    order_id: "optional_123"29  })30});31 32if (season.data.success) {33  let session_id = season.data.session_id;34  User.setProperty('session', session_id)35  let webUrl = season.data.web;36 37  const rich_message = {38    blocks: [{39        type: "heading",40        size: 1,41        text: "Payment Created Successfully!"42      },43      {44        type: "photo",45        photo: {46          type: "photo",47          media: season.data.qrUrl48        }49      },50       {51  type: "heading",52  size: 6,53  text: season.data.title || "Pay Now"54},55{56  type: "details",57  summary: "Payment Details",58  blocks: [59    {60  type: "blockquote",61  blocks: [62    {63          type: "paragraph",64          text: [65            "Amount: ",66            {67              type: "bold",68              text: `₹${season.data.amount}`69            }70          ]71        }72  ]73    },74      {75  type: "pullquote",76  text: {77    type: "italic",78    text: "Please scan the QR code to complete the payment. Once the payment is completed, click the Check Payment button. Otherwise, this payment will be automatically cancelled after 5 minutes."79  }80      }  81  ],82  is_open: false83},84             {85      type: "paragraph",86      text: ""87             },88      {89        type: "buttons",90        align: "center",91        buttons: [{92            text: `Pay ${season.data.amount}₹ Now`,93            style: "success",94            web_app: {95              url: webUrl96            }97          },98          {99            text: "Check Payment",100            style: "primary",101            callback_data: "/check_payment",102          }103        ]104      },105    ]106  };107 108  await Api.call("editMessageText", {109    message_id: msg.result.message_id,110    chat_id: request.from.id,111    rich_message112  });113 114} else {115  await msg.editText("❌ Failed to create payment!");116}