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">
 <script type="text/javascript" src="http://merchant.com/javascript.js" ></script>
 <link rel="stylesheet" href="http://merchant.com/style.css" type="text/css" />
<h1>Merchant.com Online Store</h1>

<h2> <%= Request.Form('x_response_reason_text') %></h2>
 Select Case ResponseCode
 Case "1" %>

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

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

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

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

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

<% End Select %>


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 atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article