"No token passed" activemerchant paypal 快速结账错误
"No token passed" error with activemerchant paypal express checkout
我一直在关注这个教程
http://railscasts.com/episodes/146-paypal-express-checkout?autoplay=true
我已将 paypal 按钮放入购物车页面
<%= link_to(image_tag("https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif"), express_checkout_path) %>
我的快速结帐方法如下所示
def express_checkout
response = EXPRESS_GATEWAY.setup_purchase(1000,
ip: request.remote_ip,
return_url: cart_item_index_path,
cancel_return_url: cart_item_index_path,
currency: "USD",
allow_guest_checkout: true,
items: [{name: "Order", description: "Order description", quantity: 1, amount: 1000}]
)
puts "printing token #{response.token}"
redirect_to EXPRESS_GATEWAY.redirect_url_for(response.token)
end
当我打印 response.token 时,它会打印空字符串。此外,当我 运行 应用程序并单击贝宝按钮时,它会重定向到
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=
出现以下错误
No token passed
我在 rails 中使用 activemerchant gem。
好的。 byebug 挽救了局面。
我检查了响应对象中的错误,发现 return url 和取消 url 是无效路径。
所以我改变了
response = EXPRESS_GATEWAY.setup_purchase(1000,
ip: request.remote_ip,
return_url: cart_item_index_path,
cancel_return_url: cart_item_index_path,
currency: "USD",
allow_guest_checkout: true,
items: [{name: "Order", description: "Order description", quantity: 1, amount: 1000}]
)
至
response = EXPRESS_GATEWAY.setup_purchase(1000,
ip: request.remote_ip,
return_url: cart_item_index_url,
cancel_return_url: cart_item_index_url,
currency: "USD",
allow_guest_checkout: true,
items: [{name: "Order", description: "Order description", quantity: 1, amount: 1000}]
)
成功了!谢谢 byebug!
我一直在关注这个教程
http://railscasts.com/episodes/146-paypal-express-checkout?autoplay=true
我已将 paypal 按钮放入购物车页面
<%= link_to(image_tag("https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif"), express_checkout_path) %>
我的快速结帐方法如下所示
def express_checkout
response = EXPRESS_GATEWAY.setup_purchase(1000,
ip: request.remote_ip,
return_url: cart_item_index_path,
cancel_return_url: cart_item_index_path,
currency: "USD",
allow_guest_checkout: true,
items: [{name: "Order", description: "Order description", quantity: 1, amount: 1000}]
)
puts "printing token #{response.token}"
redirect_to EXPRESS_GATEWAY.redirect_url_for(response.token)
end
当我打印 response.token 时,它会打印空字符串。此外,当我 运行 应用程序并单击贝宝按钮时,它会重定向到
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=
出现以下错误
No token passed
我在 rails 中使用 activemerchant gem。
好的。 byebug 挽救了局面。
我检查了响应对象中的错误,发现 return url 和取消 url 是无效路径。
所以我改变了
response = EXPRESS_GATEWAY.setup_purchase(1000,
ip: request.remote_ip,
return_url: cart_item_index_path,
cancel_return_url: cart_item_index_path,
currency: "USD",
allow_guest_checkout: true,
items: [{name: "Order", description: "Order description", quantity: 1, amount: 1000}]
)
至
response = EXPRESS_GATEWAY.setup_purchase(1000,
ip: request.remote_ip,
return_url: cart_item_index_url,
cancel_return_url: cart_item_index_url,
currency: "USD",
allow_guest_checkout: true,
items: [{name: "Order", description: "Order description", quantity: 1, amount: 1000}]
)
成功了!谢谢 byebug!