My original question (below) was perhaps too specific, so I'm going to ask something more general!
Can anyone point me in the direction of a tutorial, example or documentation on using Active Merchant Integrations to support an offsite payment gateway?
Active Merchant's rdoc lists all of the following as supported offsite payment gateways but I haven't found any tutorials or examples on how to use ActiveMerchant::Billing::Integrations
- 2 Checkout
- Banca Sella GestPay
- Chronopay
- Direct-eBanking
- DirecPay
- HiTRUST
- Moneybookers
- Nochex
- PayPal Website Payments Standard
- SagePay Form
- Valitor
- WorldPay
As good as they may be, peepcode and rails casts only consider gateways, not integrations.
Many thanks!
My company is moving from PayPal Express Checkout to WorldPay Business Gateway (Hosted Payment Page). We're using Rails and Active Merchant.
- Does Active Merchant support WorldPay Business Gateway (Hosted Payment Page)? I think it does, judging by the rdoc
- What arguments must I supply to ActiveMerchant::Billing::Integrations::WorldPay.new ?
Thanks
I made a simple app to demonstrate how off-site payments for Worldpay and Rails/Activemerchant can work together.
Demo Rails App- https://github.com/daemonsy/Worldpay-Rails--Off-Site--Integration-Example
For World Pay hosted payment, basically a
post
to their payment URL is required. Addtest-
to secure.worldpay.com for testing mode. WP requires amount, currency, installation ID and cartId to render the page to the customer.Source: http://www.worldpay.com/support/kb/bg/htmlredirect/rhtml.html
This creates a simple
button
that carries your order to World Pay where the customer will enter credit card details and complete the purchase. I've embedded the above code in theshow
page of an orders controller. e,g,<input type="hidden" name="amount" value="<%[email protected]"%>>
. So you can clickbuy this
after submitting the order. There are many ways to achieve aPOST
to World Pay.After which, World Pay can show a shopper response page, send you
payment response
etc. For payment response to work, you can setup the payment responsecallback URL
to one of your controllers. e.g. =>http://mysite.com/payment-backendThis will be a
POST
request so you have to setup your controller to handle it. This is whereActivemerchant
kicks in. For example,So the Notification object will read the params in
request.raw_post
and set them up the an object where you can query. I found the active merchant docs useful in telling what return params are mapped by it.Note that this controller is a very crude example. World Pay provides a few methods for you to validate the response and this is supported by Active Merchant.
ActiveMerchant Docs on WorldPay::Notifications http://rdoc.info/github/Shopify/active_merchant/master/ActiveMerchant/Billing/Integrations/WorldPay World Pay Payment Response Docs http://www.worldpay.com/support/kb/bg/paymentresponse/payment_response.html