PayPal 错误:此交易无效。请返回收件人的网站,使用其常规结帐流程完成您的交易

发布于 2024-12-21 20:42:27 字数 2147 浏览 1 评论 0原文

我正在尝试实施贝宝支付网关。

但我收到错误:

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

在 Gem 文件中

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

在development.rb

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

我在控制器中使用的示例代码

  response = EXPRESS_GATEWAY.setup_purchase(10000,
    :ip                => request.remote_ip,
    :return_url        => new_order_url,
    :cancel_return_url => orders_url
  )
  p response
  p response.token
  redirect_to EXPRESS_GATEWAY.redirect_url_for(response.token)

O/p 响应:

#<ActiveMerchant::Billing::PaypalExpressResponse:0x007f90bbababa0 @params={"timestamp"=>"2011-12-17T21:41:21Z", "ack"=>"Failure", "correlation_id"=>"c152e1862f475", "version"=>"62.0", "build"=>"2271164", "message"=>"Security header is not valid", "error_codes"=>"10002", "Timestamp"=>"2011-12-17T21:41:21Z", "Ack"=>"Failure", "CorrelationID"=>"c152e1862f475", "Errors"=>{"ShortMessage"=>"Security error", "LongMessage"=>"Security header is not valid", "ErrorCode"=>"10002", "SeverityCode"=>"Error"}, "Version"=>"62.0", "Build"=>"2271164"}, @message="Security header is not valid", @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}>

o /p for response.token

  nil

所以我认为问题是response.token为零,

有什么建议为什么会发生这种情况吗?

I was trying to implement paypal payment gateway.

But I am getting an error:

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

In Gem File

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

In development.rb

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

Sample code I am using in my controller

  response = EXPRESS_GATEWAY.setup_purchase(10000,
    :ip                => request.remote_ip,
    :return_url        => new_order_url,
    :cancel_return_url => orders_url
  )
  p response
  p response.token
  redirect_to EXPRESS_GATEWAY.redirect_url_for(response.token)

O/p for response:

#<ActiveMerchant::Billing::PaypalExpressResponse:0x007f90bbababa0 @params={"timestamp"=>"2011-12-17T21:41:21Z", "ack"=>"Failure", "correlation_id"=>"c152e1862f475", "version"=>"62.0", "build"=>"2271164", "message"=>"Security header is not valid", "error_codes"=>"10002", "Timestamp"=>"2011-12-17T21:41:21Z", "Ack"=>"Failure", "CorrelationID"=>"c152e1862f475", "Errors"=>{"ShortMessage"=>"Security error", "LongMessage"=>"Security header is not valid", "ErrorCode"=>"10002", "SeverityCode"=>"Error"}, "Version"=>"62.0", "Build"=>"2271164"}, @message="Security header is not valid", @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}>

o/p for response.token

  nil

So I think the problem is response.token is nil

any suggestions why this is happening?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

诗笺 2024-12-28 20:42:27

您检查的第一件事可能是沙箱用户的登录名、密码和签名,而不是您自己的沙箱登录名。您需要登录沙盒用户帐户并从那里获取签名。

因此,当您登录 sandbox.paypal.com,然后转到“测试帐户”时,选择您想要详细信息的帐户,然后按“输入沙盒测试站点”。在新窗口中输入假用户的详细信息(应预先填写电子邮件)。登录后进入个人资料 -> API 访问并请求或查看 API 签名。

抱歉,如果您已经尝试过此操作,但我无法发表评论来询问;)

Probably the first thing you checked but are the login, password and signature the ones for the sandboxed user and not your own login to the sandbox. You need to log in to the sandboxed users account and the get the signature from in there.

So when you log into sandbox.paypal.com and then go to Test Accounts, select the one you want the details for and press Enter Sandbox Test Site. In the new window enter the details for the fake user (email should be prefilled). Once logged in go to Profile -> API Access and request or view the API signature.

Sorry if you've already tried this but I couldn't post a comment to ask ;)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文