Annastacia-dev / daraja-test

Implementing m-pesa stk push and query
18 stars 6 forks source link
mpesa mpesa-api mpesa-payments mpesa-sdk rails rails-api ruby

Implementing M-pesa STK push and STK push query APIs in Rails API

Setup

Daraja

Ngrok

Rails

gem 'rack-cors'
gem 'rest-client'

Configurations

Environment variables

Implementing the code

Stk Push Request

Stk Query Request

end

- Your routes.rb should look like this.
```ruby
Rails.application.routes.draw do
    post 'stkpush', to: 'mpesas#stkpush'
    post 'stkquery', to: 'mpesas#stkquery'
end

That's it for this tutorial. I hope you found it helpful. If you have any questions, feel free to reach out to me on email: annetotoh@gmail.com. THANK YOU!