I am getting this error when I call this code.
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)
Error:
This transaction is invalid. Please return to the recipient's website to complete your transaction using their regular checkout flow.
To show I setup EXPRESS_GATEWAY correctly. code development.rb file.
config.after_initialize do
ActiveMerchant::Billing::Base.mode = :test
paypal_options = {
:login => '*****************************',
:password => '*************',
:signature => '*******************************************************'
}
::EXPRESS_GATEWAY = ActiveMerchant::Billing::PaypalExpressGateway.new(paypal_options)
end
Gem file
gem 'activemerchant', :require => 'active_merchant'
So the login, password, and sig. were created in the sandbox are of paypal. So they should be working.
What should I try to get this error fixed. Or is this Paypal's side? Is there something wrong in the ActiveMerchant gem?
UPDATE 1
After inspecting the response var, this is what I get.
#<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}>
Any feedback is appreciated.
UDPATE 2
Turns out after looking at that message above, it was the cancelURL that was invalid, so I fixed that and presto!
Thanks.
This error is shown when you are not properly logged into the sandbox account on paypal's site.
Login to http://sandbox.paypal.com/
Open your site and checkout
When sent to paypal, login as one of your buyer test accounts
Related
I used the below code to test my sandbox credentials but am getting the error mentioned please help in resolving the issue
> require 'activemerchant'
> #gateway = ActiveMerchant::Billing::PaypalGateway.new(
:login "abc.cc#gmail.com,
password: "weret43435ersdfdg",
signature: "ertygdfcf343333#####frfterg")
> purchase = #gateway.purchase((10* 100),
:ip => '198.16.43.574',
:currency => "USD",
:payer_id => "2",
:token => "dsfddgfdgfdgfdgdf")
When i use the above code in irb am getting the following error
ArgumentError: Missing required parameter: ip
enter image description here
If you check the source code of ActiveMerchant here, it is expecting 3 params.
def purchase(money, credit_card_or_referenced_id, options = {})
requires!(options, :ip)
commit define_transaction_type(credit_card_or_referenced_id), build_sale_or_authorization_request('Sale', money, credit_card_or_referenced_id, options)
end
First one is the amount of money, second one is the credit card or reference id and the third one is a option, where it is expecting a required ip. As in your method call you are not passing any credit card reference, it's missing the ip from the option hash.
I am building a client's ecommerce website. I'm at the latest stages, where I have to integrate the payment system. I signed up for a developer account for Authorize.net in order to test the system. I've ran into a roadblock here
I submitted my payment form, and found the following in my Development Logs
User authentication failed due to invalid authentication values
I set up my gateway as followed, based on my login information to Authorize.net
gateway = ActiveMerchant::Billing::AuthorizeNetGateway.new(
:login => "mylogin",
:password => "mypassword",
:test => false
)
Apparently, I'm missing something, but I'm not sure what it is. I watched the RailsCasts videos 144 and 145. I just substituted the gateway to AuthorizeNetGateWay.
Where am I going wrong here?
Here is my development.rb file
config.after_initialize do
ActiveMerchant::Billing::Base.mode = :test
::GATEWAY = ActiveMerchant::Billing::AuthorizeNetGateway.new(
:login => "mylogin",
:password => "mypassword",
#:signature => "AGjv6SW.mTiKxtkm6L9DcSUCUgePAUDQ3L-kTdszkPG8mRfjaRZDYtSu"
:test_requests => false
)
end
Could the problem be ActiveMerchant::Billing::Base.mode = :test considering this is my Development Environment file?
If you're using a developer account set test to true to use the developer server:
:test => true
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?
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 ;)
I am trying to get PayPal Gateway to work on a rails 3 app.
But I keep hitting this error "uninitialized constant ActiveMerchant::Billing::PayPalGateway (NameError)"
I've this in my development.rb:
ActiveMerchant::Billing::Base.mode = :test
::GATEWAY = ActiveMerchant::Billing::PayPalGateway.new(
:login => "API USERNAME ",
:password => "API PASSWORD",
:signature => "API SIGNATURE"
)
Please help!
Your capitalisation is wrong. Try:
ActiveMerchant::Billing::PaypalGateway
I have created a test account with Authorize.net and am using ActiveMerchant to process
credit card payments for a website. What error I always get is Error#*87 - "Transactions of this market type cannot be processed on this system" mentioned in ActiveMerchant documentations. Any suggestions how to resolve this error ?
Following is how i created my gateway. I also checked gateway.test? and it returns true.
gateway = ActiveMerchant::Billing::Base.gateway(:authorized_net).new(
:login =>'API Login ID',
:password =>'Transaction Key',
:test => true)
Try
gateway = ActiveMerchant::Billing::AuthorizeNetGateway.new(
:login => 'API Login ID',
:password => 'Transaction Key',
:test => true)