この問題について:ActiveMerchant + PaypalExpressCheckout + Rails 3.2
Rails3.2アプリでPaypalExpressCheckoutを構築しようとしています。そこにあるチュートリアルのほとんどは時代遅れなので、私はいくつかに従って、PaypalExpressCheckout統合ガイドを読みました。Sandobxとペイパルの情報はすでに設定しています。
ビューから[今すぐ購入]リンクをクリックして支払いを処理しようとすると、次のようになります。
<%= link_to image_tag('http://img36.imageshack.us/img36/249/buttonpaypal.png'),
action: 'checkout', controller: 'orders'%>
次のエラーが発生します。
This transaction is invalid. Please return to the recipient's website to complete
you transaction using their regular checkout flow.
Return to merchant
At this time, we are unable to process your request. Please return to and try
another option.
---私のコントローラー:
class OrdersController < ApplicationController
include ActiveMerchant::Billing
def checkout
setup_response = ::GATEWAY.setup_purchase(2000,
:ip => request.remote_ip,
:return_url => url_for('confirm'),
:cancel_return_url => url_for(root_path)
)
redirect_to ::GATEWAY.redirect_url_for(setup_response.token)
end
end
---私のイニシャライザーActiveMerchant.rb:
ActiveMerchant::Billing::Base.mode = :test
::GATEWAY = ActiveMerchant::Billing::PaypalExpressGateway.new(
:login => "I_PUT_MY_EMAIL_HERE",
:password => "I_PUT_MY_PASS_HERE",
:signature => "I_PUT_MY_SIGNATURE_HERE",
:allow_guest_checkout => true
)
---私のルート:routes.rb:
resources :orders do
# Im not sure why 'get :checkout' by itself doesn't work.
get :checkout, :on => :new
get :confirm
get :complete
end
「ページ/インデックス」を取得
これが要点です:https ://gist.github.com/11be6cef6a97632343b9
誰かが私に「最近の」チュートリアルを教えてもらえますか、または私がここで間違っていることを理解するのを手伝ってくれますか?