php - OAuth signature_invalid error using PesaPal API with Ruby -


i'm having real nightmare trying pesapal api work me using ruby...

i appreciate it's not commonly used api if there's online here has more experience using oauth, and/or php experience offer fresh pair of eyes i'd appreciate it.

so pesapal developer site here: http://developer.pesapal.com api docs don't give away many clues how use oauth site , don't understand php enough sure i've read php sample correctly.

here's attempt @ implementing in ruby:

require 'oauth' require 'uri'  key = '<my sandbox key>' sec = '<my sandbox secret>'   api_domain = 'https://demo.pesapal.com'  # xml string of param data include our request raw_xml  = %{<?xml version=\"1.0\" encoding=\"utf-8\"?><pesapaldirectorderinfo xmlns:xsi=\"http://www.w3.org/2001/xmlschemainstance\" xmlns:xsd=\"http://www.w3.org/2001/xmlschema\" amount=\"12.34\" description=\"bob test 1\" type=\"merchant\" reference=\"808\" firstname=\"bo\" lastname=\"tester\" email=\"bodacious@bodacious.com\" xmlns=\"http://www.pesapal.com\" />}  # escape xml @post_xml = uri.escape(raw_xml)  # create new oauth consumer @consumer = oauth::consumer.new(key, sec, {   site: api_domain,    scheme: :query_string })  # signed request object @signed_request  = @consumer.create_signed_request('get', "#{api_domain}/api/postpesapaldirectorderv4")  # join pesapal_request_data , oauth_callback '&' valid url params @params = {    oauth_callback: uri.escape('http://localhost:3000'),   pesapal_request_data: @post_xml, }.map { |k,v| "#{k}=#{v}" }.join('&')  # url should redirect puts redirect_url = "#{@signed_request.path}&#{@params}" 

when try visit url returned code, get: problem: signature_invalid | advice: > | api.

can think of i'm doing wrong here?

thanks

check out pesapal rubygem here ... https://rubygems.org/gems/pesapal ... handles stuff you.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -