When using postman to make a #stkpush, I have encountered an error (as shown below), so I got into debug mode;
Processing by MpesasController#stkpush as /
Parameters: {"phoneNumber"=>"2547**", "amount"=>"1", "mpesa"=>{"phoneNumber"=>"2547****", "amount"=>"1"}}
Consumer Key:
Consumer Secret:
Encoded Userpass: Og==
Request Headers: {:Authorization=>"Bearer Og=="}
Completed 500 Internal Server Error in 15224ms (ActiveRecord: 1.9ms | Allocations: 5450)**
It's quite clear consumer key and consumer secret ,for lack of a better term, 'hazionekani'. Why? You have the following code in your config/application.rb;
config.before_configuration do
env_file = File.join(Rails.root, 'config', 'local_env.yml')
YAML.load(File.open(env_file)).each do |key, value|
ENV[key.to_s] = value
end if File.exist?(env_file)
end
because of this line _env_file = File.join(Rails.root, 'config', 'localenv.yml' consumer key and consumer secret hazionekani, you should move the local_env.yml from root and have it inside the config folder.
@kefahwambai The local_env.yml file is already located inside the config folder. See this from the README.mdInside the config folder create a file called local_env.yml under Environment Variables
When using postman to make a #stkpush, I have encountered an error (as shown below), so I got into debug mode;
Processing by MpesasController#stkpush as / Parameters: {"phoneNumber"=>"2547**", "amount"=>"1", "mpesa"=>{"phoneNumber"=>"2547****", "amount"=>"1"}} Consumer Key: Consumer Secret: Encoded Userpass: Og== Request Headers: {:Authorization=>"Bearer Og=="} Completed 500 Internal Server Error in 15224ms (ActiveRecord: 1.9ms | Allocations: 5450)**
It's quite clear consumer key and consumer secret ,for lack of a better term, 'hazionekani'. Why? You have the following code in your config/application.rb; config.before_configuration do env_file = File.join(Rails.root, 'config', 'local_env.yml') YAML.load(File.open(env_file)).each do |key, value| ENV[key.to_s] = value end if File.exist?(env_file) end because of this line _env_file = File.join(Rails.root, 'config', 'localenv.yml' consumer key and consumer secret hazionekani, you should move the local_env.yml from root and have it inside the config folder.