Skip to content

This is a Telegram bot to facilitate STK payments through the Tinypesa API

Notifications You must be signed in to change notification settings

johnnzamba/telepesa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TINYPESA PAYMENT INTEGRATION IN TELEGRAM BOT

The script is an integration of tinypesa api service for payments in a bot. The code is in ruby; so you'll need the gems. Have a go!

Codecov

GENERAL WORKFLOW

This is a one of a kind integration of a telegram bot and TinyPesa Mobile Payment API service. Once the user chooses to make a payment; an STK push is made and the user prompted to make a payment. After successful payment(s) the transaction details are logged into the JSON file. However, what the script does is that once an STK push has been made, an external reference_no is generated to it. This ref_no is then used to get a transaction(s) status once the STK timeout. The 1ˢᵗ response is logged into the JSON file, then the 2ⁿᵈ response is logged if the MPESA transaction is complete.

Actual Bot Demo



Payment Simulation




Installation

For Starters go to telegram and speak to the father of bots 😅 @botFather and register a new bot 🤖 . After creating a bot, you'll receive personal details. Save the new <TELEGRAM_BOT_TOKEN> for use in our script.

The necessary instructions for API's are here.

Then to now access the script:

git clone https://github.com/johnnzamba/telepesa.git
cd telepesa

⚠️ IF YOU'VE NOT SET-UP RUBY

Ensure you have RVM (Ruby Version Manager)in order to set up ruby. If not, visit this link

Now to check if RUBY is set up correctly:

ruby --version
gpg --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable --ruby

Additionally, we'll need to set-up bundler essential in managing dependencies & deploying 🚀 in Ruby.

gem install bundler

Now in the Project Directory; the Gemfile contains necessary gems for the project. Run the following command to install the necessary gems:

bundle install

Usage

Now the scripts can be run locally or on a server; To execute the script locally, run the following command:

bundle exec ruby tinypesa.rb

Please Note that the required APIs and Tokens are to be replaced in the file.

Acknowledgement

I want to acknowledge that this project is solely owned by me. All rights, including intellectual property rights, are retained by the original owner. The code, design, and any associated content are proprietary. For any inquiries, Please contact me here 👉 @.

Thank you for your understanding and respect for the intellectual property rights associated with this project.

License

Unless attributed otherwise, everything is under the MIT License (see LICENSE for more info).

About

This is a Telegram bot to facilitate STK payments through the Tinypesa API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages