The Relay Response sample code below shows how the merchant could respond upon receiving the transaction results from E-xact. In this Ruby on Rails example, the developer would change each merchant.com placeholder URL to the merchant's absolute URL equivalent.
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Receipt</title>
<script type="text/javascript" src="http://merchant.com/javascript.js" ></script>
<link rel="stylesheet" href="http://merchant.com/style.css" type="text/css" />
</head>
<body>
<h1>Merchant.com Online Store</h1>
<h2><%= h params[:x_response_reason_text]%></h2>
<% if params[:x_response_code] == '1' %>
<h2>Order Paid</h2>
<p>
Your payment was processed successfully.
Your order will be shipped in two business days.
Here is your receipt.
</p>
<pre>
<%= h params[:exact_ctr]%>
</pre>
<% unless params[:exact_issname].blank? # If INTERAC Online
payments are supported %>
<p>
Issuer: <%= h params[:exact_issname] %><br/>
Confirmation Number: <%= h params[:exact_issconf]%>
</p>
<% end %>
<p>
<% track_url = url_for(:controller=>'orders', :action=>'track', :order_id => params[:x_invoice_num], :only_path=>false %>
You can track it at <%= link_to track_url, track_url %>
</p>
<% end %>
<% if params[:x_response_code] == '2' %>
<p>
Your payment failed.
Here is your receipt.
</p>
<pre>
<%= h params[:exact_ctr]%>
</pre>
<% end %>
<% if params[:x_response_code] == '3' %>
<p>
An error occurred while processing your payment.
Please try again later.
</p>
<% end %>
<p>
Return to <a href="http://merchant.com/home">home</a>.
</p>
</body>
</html>
0 Comments