मैं प्रदर्शित करने के लिए कैसे परोक्ष WORLDPAY और रेल/Activemerchant के लिए भुगतान साथ काम कर सकते एक सरल अनुप्रयोग बनाया है।
डेमो रेल अनुप्रयोग - https://github.com/daemonsy/Worldpay-Rails--Off-Site--Integration-Example
विश्व वेतन के लिए भुगतान की मेजबानी की, मूल रूप से उनके भुगतान यूआरएल के लिए एक post
की आवश्यकता है। परीक्षण मोड के लिए सुरक्षित.worldpay.com पर test-
जोड़ें। WP को ग्राहक को पृष्ठ प्रस्तुत करने के लिए राशि, मुद्रा, स्थापना आईडी और कार्ट आईडी की आवश्यकता होती है।
<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
पृष्ठ में एम्बेड किया है। ई, जी, <input type="hidden" name="amount" value="<%[email protected]"%>>
। तो आप आदेश सबमिट करने के बाद buy this
पर क्लिक कर सकते हैं। विश्व वेतन में POST
प्राप्त करने के कई तरीके हैं।
जिसके बाद, विश्व वेतन एक दुकानदार प्रतिक्रिया पृष्ठ दिखा सकता है, आपको payment response
आदि भेज सकता है। काम पर भुगतान प्रतिक्रिया के लिए, आप अपने नियंत्रकों में से एक को भुगतान प्रतिक्रिया callback URL
सेट कर सकते हैं। जैसे =>http://mysite.com/payment-backend
यह POST
अनुरोध होगा ताकि आपको इसे नियंत्रित करने के लिए अपने नियंत्रक को सेटअप करना होगा। यह वह जगह है जहां में Activemerchant
किक। उदाहरण के लिए,
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
तो अधिसूचना वस्तु request.raw_post
में पैरामीटर पढ़ सकते हैं और उन्हें एक वस्तु जहां क्वेरी कर सकता है की स्थापना की जाएगी। मैंने सक्रिय व्यापारी दस्तावेज़ों को यह बताने में उपयोगी पाया कि रिटर्न पैराम मैप किए गए हैं।
ध्यान दें कि यह नियंत्रक एक बहुत ही क्रूड उदाहरण है। विश्व वेतन प्रतिक्रिया को सत्यापित करने के लिए आपके लिए कुछ विधियां प्रदान करता है और यह सक्रिय व्यापारी द्वारा समर्थित है।
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
आप इस को हल करने के प्रबंधन कैसे किया? मुझे स्विचिंग में भी परेशानी हो रही है :( –
नहीं। अभी भी कुछ भी नहीं मिला है। – Mike
चूंकि आप ऑफसाइट भुगतान का उपयोग कर रहे हैं, तो क्या आप विश्वव्यापी यूआरएल में 'POST' कर कर प्रक्रिया को सरल बना सकते हैं? पेपैल बटन एपीआई की तरह। –