我使用了paymill页面上的示例来获取令牌,没有任何问题。我正在使用ajax调用传递令牌。但是我不能使用API来进行最后的调用。我想做的只是一笔简单的付款。没有订阅,就没有用户。只是一笔信用卡付款。下面是我的控制器中的代码:
token = params[:token]
params = {'amount' => '#{@@amount}', 'currency' => 'EUR', 'token' => '#{token}', 'description' => 'description'}
https = Net::HTTP.new('api.paymill.de', 80)
https.use_ssl = false
https.start do |connection|
url = "/v2/transactions"
https_request = Net::HTTP::Post.new(url)
https_request.basic_auth(Paymill.api_key,"")
https_request.set_form_data(params)
@response = https.request(https_request)
end
puts @response.body
puts @response.header
render :action => "confirm"回应是
<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>nginx</center>
</body>
</html>
#<Net::HTTPFound:0x00000004a98400>我不知道出了什么问题。几周前我还不知道ajax是什么.有人能帮上忙吗?
发布于 2013-01-17 15:50:05
我不是rails专家但是..。
..。您在未使用SSL的情况下通过端口80连接到我们的API。我们只允许对api的SSL请求,因此您必须使用端口443进行连接,并启用SSL。
希望这能解决你的问题。
https://stackoverflow.com/questions/14369021
复制相似问题