Payfort in Ruby On Rails Application

…衆ロ難τιáo~ 提交于 2019-12-25 17:27:09

问题


I wish to implement the payfort gateway with my rails application.But I am very much novice to api. I am having a look at the this docs. But i am not clear with where to start? Is there any gem for it?

Any help will be appreciated. Thanks in advance :)


回答1:


There's no Gems for sorry , but api is rest so you can implement what you want easily. But the best thing is to start with creating your own Gateway with Active Merchant.




回答2:


1-Sort all PayFort requests parameters in an ascending alphabetical order based on the parameters names as follow: 

params={access_code=stbbRGM7K1rHXliCQeNwtk,
amount=250,
command=PURCHASE,
currency=QAR,
customer_email=test@gmail.com,
customer_ip=103.43.154.34,
language=en,
merchant_identifier=YRssfesdsd,
merchant_reference=REFRRSERRFFE4444,
token_name=6RTD55DVVVBDSCCVVCFCCV}
params = params.sort.to_h
string = params.to_query(nil)
string = Digest::SHA256.hexdigest string
  params.store 'signature',string 
  uri = URI.parse("https://sbpaymentservices.payfort.com/FortAPI/paymentApi")
  header = {'Content-Type': 'application/json'}
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true
  request = Net::HTTP::Post.new(uri.request_uri, header)


来源:https://stackoverflow.com/questions/42432826/payfort-in-ruby-on-rails-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!