Handling relay response using ASP

Created by Richard Moore, Modified on Wed, 12 Apr, 2023 at 12:02 PM by Richard Moore

The Relay Response sample code below shows how the merchant could respond upon receiving the transaction results from E-xact.  In this ASP example, the developer would change each merchant.com placeholder URL to the merchant's absolute URL equivalent.


<% Response.Expires = 0
Dim ResponseCode
Dim TrackUrl

' Process Post parameters
ResponseCode = Trim(Request.Form("x_response_code"))
%>

<!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> <%= Request.Form('x_response_reason_text') %></h2>
<%
 Select Case ResponseCode
 Case "1" %>

   <p>
     Your order was processed successfully. Here is your receipt.
     Your order will be shipped in two business days.
   </p>
   <pre>
     <%= Request.Form("exact_ctr")%>
   </pre>

   <% If not(isNull(Request.Form("exact_issname"))) Then %>
     <p>
       Issuer:     <%= Request.Form("exact_issname")%><br/>
       Confirmation Number:     <%= Request.Form("exact_issconf")%>
     </p>
   <% End If %>

   <p>
     <% TrackUrl = "http://merchant.com/order_tracking/" & Request.Form("x_invoice_num") %>
     You can track it at <%= TrackUrl %></a>.
   </p>

<% Case "2" %>
   <p>
     Your payment failed.
     Here is your receipt.
   </p>
   <pre>
     <%= Request.Form("exact_ctr") %>
   </pre>

<% Case Else %>
   <p>
     An error occurred while processing your payment.
     Please try again later.
   </p>

<% End Select %>

</body>
</html>

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article