Last active
October 24, 2016 12:30
-
-
Save ikiugu/23fa36347266989ff7fd525471fc5973 to your computer and use it in GitHub Desktop.
PesaController
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def order | |
pesapal = Pesapal::Merchant.new(:development) #declare a variable | |
pesapal.order_details = { #pass the info to order_details array | |
:amount => params[:amount], | |
:description => params[:description], | |
:type => 'MERCHANT', | |
:reference => '808-808-606', | |
:first_name => 'first_name', | |
:last_name => 'last_name', | |
:email => '[email protected]', | |
:phonenumber => '+254722123456', | |
:currency => 'KES' | |
} | |
session[:pay_info] = pesapal.order_details | |
@order_url = pesapal.generate_order_url #generate the url | |
render 'pesapal' | |
end | |
def callback | |
#declare a variable | |
pesapal = Pesapal::Merchant.new(:development) | |
#@payment_status_array = session[:pay_info] | |
#@reference = @payment_status_array['reference'] | |
#@payment_status = pesapal.query_payment_status("808-808-606") | |
render plain: pesapal.query_payment_status("AtM9FlNfOi").inspect | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Your implementation is missing a few things (I think) ...
I mean something like this ...
I think either I don't understand your use-case or you misunderstand how Pesapal works. Please read this simplified step-by-step.