2011-10-19 15 views
9

私の元の質問(以下)はおそらくあまりにも具体的なものでしたので、より一般的なものを尋ねます!アクティブな商人の統合(オフサイトの支払い)

は、誰もがoffsite payment gatewayをサポートするためのActive商人Integrationsを使用して、チュートリアル、例やドキュメントの方向に私を指すことができますか?

アクティブマーチャントのRDOCリストサポートオフサイト支払いゲートウェイとして、以下のすべてが、私はActiveMerchant::Billing::Integrations

  • 2アウト
  • バンカ・セッラGestPay
  • Chronopayを使用する方法上の任意のチュートリアルや例を発見していません
  • 直接eBanking
  • DirecPayの
  • ベリサイン
  • Moneybookersの
  • Nochex
  • ペイパルウェブペイメントスタンダード
  • SagePayフォーム
  • Valitor
  • 、彼らがかもしれ良いとしてWorldPayの

peepcoderailscastsは、ゲートウェイのみを考慮して、ではありません統合。

多くの感謝!

私の会社は、ペイパルエクスプレスチェックアウトからワールドペイビジネス ゲートウェイ(ホスティングペイメントページ)に移行しています。私たちはRailsとActive Merchantを使用しています。

  1. アクティブ商人はWorldPay Business Gateway(Hosted Payment Page)をサポートしていますか?私はそれがそうだと判断します。the rdoc
  2. ActiveMerchant :: Billing :: Integrations :: WorldPay.newに提供する必要がある引数は何ですか?

おかげ

+0

あなたはこれを解決するために管理していましたか? –

+0

いいえまだ何も見つかりませんでした – Mike

+0

オフサイト支払いを使用しているので、ワールドペイURLへの 'POST 'を行うことでプロセスを簡略化できますか?PaypalボタンAPIと同様です。 –

答えて

10

私はワールドペイとRails/Activemerchantためのオフサイト支払いは一緒に働くことができる方法を示すためにシンプルなアプリを作りました。

デモRailsのアプリケーション - 世界有料で https://github.com/daemonsy/Worldpay-Rails--Off-Site--Integration-Example

は基本的に自分の支払いURLへpostが必要とされ、支払いを開催しました。テストモードの場合はtest-をsecure.worldpay.comに追加してください。 WPには金額、通貨、インストールID、カートIDが必要です。

<form action="https://test-secure.worldpay.com/wcc/purchase" method=POST> 

<!-- This next line contains the testMode parameter - it specifies that the submission is a test submission --> 
<input type="hidden" name="testMode" value="100"> 

<!-- This next line contains a mandatory parameter. Put your Installation ID inside the quotes after value= --> 
<input type="hidden" name="instId" value="Your installation ID "> 

<!-- Another mandatory parameter. Put your own reference identifier for the item purchased inside the quotes after value= --> 
<input type="hidden" name="cartId" value="Your ID for the product "> 

<!-- Another mandatory parameter. Put the total cost of the item inside the quotes after value= --> 
<input type="hidden" name="amount" value="The cost of the product "> 

<!-- Another mandatory parameter. Put the code for the purchase currency inside the quotes after value= --> 
<input type="hidden" name="currency" value="currency code e.g. GBP, USD "> 

<!-- This creates the button. When it is selected in the browser, the form submits the purchase details to us. --> 
<input type=submit value=" Buy This "> 

出典:http://www.worldpay.com/support/kb/bg/htmlredirect/rhtml.html

これは、顧客がクレジットカードの詳細を入力して、購入を完了します世界支払うためにご注文を運ぶ簡単なbuttonを作成します。注文コントローラのshowページに上記のコードを埋め込んでいます。 e、g、<input type="hidden" name="amount" value="<%[email protected]"%>>。注文後にbuy thisをクリックすることができます。ワールドペイにPOSTを達成する方法はたくさんあります。

その後、World Payで買い物客の回答ページが表示され、payment responseなどが届きます。支払いの応答が機能するようにするには、コントローラの1つに支払いの応答callback URLを設定します。例えば=>http://mysite.com/payment-backend

これはPOSTのリクエストになりますので、コントローラで処理するように設定する必要があります。例えば、

class BackendsController < ApplicationController 
    include ActiveMerchant::Billing::Integrations 
    protect_from_forgery :except=>[:worldpay_return] 

    #in routes => match '/payment-backend'=>'backends#worldpay_return' 
    def worldpay_return 
    notification = WorldPay::Notification.new(request.raw_post) 

    order = Order.find(notification.item_id) 

    if notification.acknowledge 
     begin 
     if notification.complete? 
      order.status = 'success' 
     end 
     rescue 
     order.status = "failed" 
     raise 
     ensure 
     order.save 
     end 
    end 
    render :text =>"Order status for #{order.id} is #{order.status}" 

    end 

end 

Activemerchantキックだから通知オブジェクトがrequest.raw_postでのparamsを読んで、あなたが照会できるオブジェクトをそれらを設定する場所です。私はアクティブな商人のドキュメントが、それによってマップされる返品パラメータを伝えるのに役立つことを発見しました。

このコントローラは非常に粗末な例です。 World Payは、レスポンスを検証するためのいくつかの方法を提供しています。これはActive Merchantによってサポートされています。

WorldPayの上ActiveMerchantドキュメント::通知 http://rdoc.info/github/Shopify/active_merchant/master/ActiveMerchant/Billing/Integrations/WorldPay 世界ペイ決済応答ドキュメント http://www.worldpay.com/support/kb/bg/paymentresponse/payment_response.html

+0

ありがとう。近い将来にut! – Mike

+0

いいえ問題=)。私は世界の給料が大好きですが、しばらくは、ちょっと面白いホストされたページを改善してほしいです。 –

+0

ありがとう..クールな答え、私はこれを別の支払いプロセッサに適応しようとします – Orlando

関連する問題