gpt4 book ai didi

ruby-on-rails - Rails ActiveMerchant - Paypal 快速结帐错误

转载 作者:太空宇宙 更新时间:2023-11-03 16:11:52 26 4
gpt4 key购买 nike

调用此代码时出现此错误。

response = EXPRESS_GATEWAY.setup_purchase(order.price_in_cents,
:ip => request.remote_ip,
:return_url => url_for(:action => :create, :only_path => false),
:cancel_return_url => root_path
)

redirect_to EXPRESS_GATEWAY.redirect_url_for(response.token)

错误:

This transaction is invalid. Please return to the recipient's website to complete your transaction using their regular checkout flow.

为了展示我正确设置了 EXPRESS_GATEWAY。代码开发.rb文件。

config.after_initialize do
ActiveMerchant::Billing::Base.mode = :test
paypal_options = {
:login => '*****************************',
:password => '*************',
:signature => '*******************************************************'
}
::EXPRESS_GATEWAY = ActiveMerchant::Billing::PaypalExpressGateway.new(paypal_options)
end

gem 文件

gem 'activemerchant', :require => 'active_merchant'

登录名、密码和签名。在沙盒中创建的是 Paypal 。所以他们应该在工作。

我应该如何尝试修复此错误。或者这是Paypal的一面? ActiveMerchant gem 有问题吗?

更新 1

检查响应变量后,这就是我得到的。

#<ActiveMerchant::Billing::PaypalExpressResponse:0x00000102402790 @params={"timestamp"=>"2012-06-29T01:30:18Z", "ack"=>"Failure", "correlation_id"=>"d1cb5dbb30425", "version"=>"72", "build"=>"3067390", "message"=>"CancelURL is invalid.", "error_codes"=>"10472", "Timestamp"=>"2012-06-29T01:30:18Z", "Ack"=>"Failure", "CorrelationID"=>"d1cb5dbb30425", "Errors"=>{"ShortMessage"=>"Transaction refused because of an invalid argument. See additional error messages for details.", "LongMessage"=>"CancelURL is invalid.", "ErrorCode"=>"10472", "SeverityCode"=>"Error"}, "Version"=>"72", "Build"=>"3067390"}, @message="CancelURL is invalid.", @success=false, @test=true, @authorization=nil, @fraud_review=false, @avs_result={"code"=>nil, "message"=>nil, "street_match"=>nil, "postal_match"=>nil}, @cvv_result={"code"=>nil, "message"=>nil}>

欢迎任何反馈。

UDPATE 2

在查看上面的消息后发现,是 cancelURL 无效,所以我修复了它并很快!

谢谢。

最佳答案

当您没有正确登录到 paypal 网站上的沙盒帐户时,会显示此错误。

  1. 登录http://sandbox.paypal.com/
  2. 打开您的网站并结帐
  3. 当发送到 paypal 时,以您的买家测试帐户之一登录

关于ruby-on-rails - Rails ActiveMerchant - Paypal 快速结帐错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11250738/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com