This is a simple implementation of M-pesa Stk push in Ruby.
-
This piece of code is extracted from the Mpesa Gem.
-
Clone the repo
bundle install
- Add your env configuration
key="****************************"
secret="*************"
base_url="https://sandbox.safaricom.co.ke"
token_generator_url="/oauth/v1/generate?grant_type=client_credentials"
process_request_url="/mpesa/stkpush/v1/processrequest"
callback_url="******************************"
business_short_code="*******"
business_passkey="***********************************"
- Start the server
rails s
- Check out this repo for a complete implementation of the gem