HI,
I finally didn''t use any plugin for amazon payment, & did with
Amazon
simple pay..
It offers a good ruby code, to create checkout button.
here is the code given by amazon for creating button. The Price,return
url can be dynamically changed.
require ''base64''
require ''openssl''
module PayNowWidgetUtils
def generate_signed_form(access_key, aws_secret_key,
form_params)
form_params[''accessKey''] = access_key
str_to_sign = ""
form_params.keys.sort.each { |k| str_to_sign +=
"#{k}#{form_params[k]}" }
digest = OpenSSL::Digest::Digest.new(''sha1'')
hmac = OpenSSL::HMAC.digest(digest, aws_secret_key,
str_to_sign)
form_params[''signature''] =
Base64.encode64(hmac).chomp
signed_form =<<-STARTFORM
<form
action="https://authorize.payments-sandbox.amazon.com/pba/paypipeline"
method="post">
STARTFORM
form_params.each do |key, value|
next unless key and value
signed_form +=<<-"FORMELEM"
<input type="hidden" name="#{key}"
value="#{value}" >
FORMELEM
end
signed_form +=<<-ENDFORM
<input type="image"
src="https://authorize.payments-sandbox.amazon.com/pba/images/amazonPaymentsButton.jpg"
border="0" >
</form>
ENDFORM
return signed_form
end
end
include PayNowWidgetUtils
ACCESS_KEY = ''<your amazon aws access key>''
SECRET_KEY = ''<your amazon aws secret key>''
print generate_signed_form(ACCESS_KEY, SECRET_KEY,
''amount'' =>
''USD 100'',
''description'' =>
''Test Button'',
''referenceId'' =>
''txn1102'',
''returnUrl'' =>
''http://localhost:3000/success'',
''abandonUrl'' =>
''http://localhost:3000/fail'')
For getting amazon aws account, sign up for its service here.
http://aws.amazon.com/
any help mail me,
Thanks,
http://srikanthjeeva.blogspot.com
http://srikanthj.co.nr
--
Posted via http://www.ruby-forum.com/.