environment:-
ruby 1.9.2
rails 3.2.8
gem 'activemerchant' 1.34.1
i want use paypal recurring payment option auto-renewal option.
for this, using paypal payment option goes paypal website allowing user login , confirm payment , process.
it working fine normal payment (not recurring payment). normal payment, used:-
in class :-
activemerchant::billing::base.mode = :test
@@paypal_express_gateway = activemerchant::billing::paypalexpressgateway.new(
:login => 'my_login_id@domail.com',
:password => 'password',
:signature => 'signature'
)
in 'express_checkout' method :-
setup_response = @@paypal_express_gateway.setup_purchase(@@amount,
:ip => request.remote_ip,
:return_url => url_for(:action => 'confirm', :only_path => false),
:cancel_return_url => url_for(:action => 'new', :only_path => false)
)
redirect_to @@paypal_express_gateway.redirect_url_for(setup_response.token)
in 'confirm' method :-
details_response = @@paypal_express_gateway.details_for(params[:token])
then details_response returns success method true or false. , send complete or error page. that want in recurring payment.
for recurring payment paypalexpresscheckout, used following:-
in class:-
activemerchant::billing::base.mode = :test
@@paypal_express_gateway = activemerchant::billing::paypalexpressgateway.new(
:login => 'my_login_id@domail.com',
:password => 'password',
:signature => 'signature'
)
in 'express_checkout' method :-
setup_response = @@paypal_express_gateway.setup_purchase(@@amount,
:ip => request.remote_ip,
:return_url => url_for(:action => 'confirm', :only_path => false),
:cancel_return_url => url_for(:action => 'new', :only_path => false)
)
redirect_to @@paypal_express_gateway.redirect_url_for(setup_response.token)
in 'confirm' method :-
details_response = @@paypal_express_gateway.recurring(@@amount, "", options = {
:token => params[:token],
:period => "month",
:frequency => 3,
:start_date => time.now,
:description => "checking recurring auto-renewal"
})
now getting error undefined method "add_credit_card" #<activemerchant::billing::paypalexpressgateway:0x00000006c831a0>
the recurring method defined here (active merchant) return profile_id.
so want use paypalexpressgateway (not paypalgateway) recurring payment developer can't send credit_card details recurring method payment done on paypal website.
then why *credit_card* parameter being used in case of paypalexpressgateway. , method "build_create_profile_request(options)" called recurring method should not check credit_card not passing parameter 'credit_card' in options.(see line no 127 in given link)
please check code , let me know wrong. if can provide me prepared code, more useful.
i tried many blogs , solutions not succeed. please give me solution asap.
thanks in advanced.
i have recurring paypal payments working using activemerchant. need pass nil rather empty string second parameter (which kind of object representing credit card object don't think implemented activemerchant's paypal express checkout integration) recurring method.
details_response = @@paypal_express_gateway.recurring(@@amount, nil, { :token => params[:token], :period => "month", :frequency => 3, :start_date => time.now, :description => "checking recurring auto-renewal" })
Comments
Post a Comment