Ошибка PayPal: Эта транзакция недействительна. Пожалуйста, вернитесь на сайт получателя, чтобы завершить транзакцию, используя их обычный поток оформления заказа

Я пытался внедрить платежный шлюз paypal.

Но я получаю ошибку:

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

В Gem File

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 для 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 для response.token

  nil

Так что я думаю проблема в том, что response.token равен nil

любые предложения, почему это происходит?

5
задан Mohit Jain 21 December 2011 в 18:28
поделиться