cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Need Explanation about how relay response works with custom receipt

I am confused somewhat about how ANET implements the relay response using the SIM.  I am getting the POST data via the relay response (most of the data that I send to them with the order), I do some database stuff, send out an e-mail and then write a custom receipt to the page.  The database stuff and the e-mail execute as expected (on my server), but the content that I write to the page is displayed on their server, and it seems that I don't have access to SESSION variables on my response page (I could see why if it is executed on their server).  Are they using a header redirect or some other method so that the output displays on their server?  I would prefer that the custom receipt display on my server.  As it is, it is working because I pass data and they pass that back to me, so I can parse the POST data and do what I need to do, but there are some SESSION variables that would be nice to have access to.  

 

I am actually using some of the shipping keys to pass data to them that I want to get back, but it isn't shipping data, it is some information about the order.  It would be nice if they had some custom fields, e.g. x_custom_1, x_custom_2, x_custom_n that you could pass to them with the POST to their form and have those passed back in the relay response, which is what I am doing with the shipping keys since we are not using them.

 

I would prefer to use SIM rather than AIM or direct since I would rather have them process the CC data instead of having to collect that on our site, although I guess we could use another method (i.e. collect the CC information on our site) if that would allow displaying a custom receipt on our site rather than theirs.  The way I have it, the receipt displays on their site and I have buttons to return back to our home page.

 

What I have works, but I'm not sure if it is implemented the way it was intended.  

 

Thanks.

sscotti
Member
1 ACCEPTED SOLUTION

Accepted Solutions

They are call Merchant-Defined Fields

http://www.authorize.net/support/merchant/wwhelp/wwhimpl/js/html/wwhelp.htm#href=3_IntegrationSettin...

 

About Session, it will be loss once it go thru the relay response process as it proabaly will be a different session.

View solution in original post

7 REPLIES 7

http://community.developer.authorize.net/t5/The-Authorize-Net-Developer-Blog/Relay-Response-Basics-a...

 

Just like the name said it "relay" your page to the customer. It running on ANET server so you will have no access of the session information.

 

And you could use custom fields, just don't use x_???

 

DPM don't collect it on your server. the customer browser post it to authorize.net.

http://developer.authorize.net/api/howitworks/dpm/

RaynorC1emen7
Expert

So are you saying you can submit POST name value pairs that don't include a x_ to the ANET credit card form?  Will they send those back to you in the relay response?  If not, what happens with those?

 

If I use a custom receipt passed back to ANET via the relay response, are their business, regulatory requirements about what needs to be included on the receipt.  As it is, I would prefer to suppress the e-mail receipt from ANEX and use are own custom receipt.

 

I am still a little confused about the SESSION issue.  I get the relay from ANEX and store some information in a database and send out an e-mail.  That part executes on my server fine..  (I do not generate any output to the page until after that is all taken care of.  If I put the output in a PHP variable and don't write to the page until I've captured all of the information that I want would I have access to data in my SESSION.

They are call Merchant-Defined Fields

http://www.authorize.net/support/merchant/wwhelp/wwhimpl/js/html/wwhelp.htm#href=3_IntegrationSettin...

 

About Session, it will be loss once it go thru the relay response process as it proabaly will be a different session.

Thank you, that is helpful regarding the Merchant Defined fields.  As it is, I was using the x_ shipping info to pass some data about the order.  So you are saying if I use custom_arrival_date, custom_arrival_time, custom_arrival_airline, custom_arrival_flightnumber, etc., that they will get posted if I post them in my form, and they will be passed back to me in the relay response?

 

The SESSION this is still a little confusing to me because guess I don't understand how the redirect works.  What I actually write to my page is essentially included on the page on their server.  

 

However, I have:

 

session_start();
include 'config.php';  // for my database credentials

 

at the top of my page and later on I am inserting data into my database using what I get back from the relay response, not SESSION data, but the database INSERT is executing on my server.

 

$insert_row = $mysqli->query("INSERT INTO BuyerTable
(buyerFirstName, buyerLastName, buyerEmailAnet, phone, transactionID, authorizationCode, itemAmount,itemDesc,departureDate, departureTime,departureAirline,departureFlightNumber,arrivalDate,arrivalTime,arrivalAirline,arrivalFlightNumber, orderDate)
VALUES ('$buyerFirstName', '$buyerLastName','$buyerEmailAnet','$buyerPhoneAnet', '$transactionID', '$authorizationCode', '$ItemPrice', '$ItemDesc' ,'$departureDate', '$departureTime', '$departureAirline', '$departureFlightNumber', '$arrivalDate', '$arrivalTime', '$arrivalAirline', '$arrivalFlightNumber','$orderDate')");

Thank you, that is helpful regarding the Merchant Defined fields.  As it is, I was using the x_ shipping info to pass some data about the order.  So you are saying if I use custom_arrival_date, custom_arrival_time, custom_arrival_airline, custom_arrival_flightnumber, etc., that they will get posted if I post them in my form, and they will be passed back to me in the relay response?

Yes

 

at the top of my page and later on I am inserting data into my database using what I get back from the relay response, not SESSION data, but the database INSERT is executing on my server.

As long as it not from the Session data that you set before it go to authorize.net. it would work fine.

The custom fields, without the x_ works for my purposes.  I am still curious about how the relay response works.  I am not familiar without all server technology, mostly front end stuff, some PHP and MySQL.  However, it seems like the ANET server is doing something similar to an AJAX call (jQuery POST via AJAX) such that the script on my site gets executed, which explains why the store to database and e-mail sending execute, but the output to the page is being return to their server and they are displaying it on their page on their server.  This makes sense to me.  Perhaps it is a business requirement that if you use SIM the receipt for the purchase has to be displayed on their server.

 

However, I would still rather display the receipt on our server.  If I try a javascript redirect on my relay response page, I think the output still appears on their server, just from a different page of my server.  I take it there is no way to accomplish what I want unless I used a different integration method ?

However, it seems like the ANET server is doing something similar to an AJAX call (jQuery POST via AJAX) such that the script on my site gets executed, which explains why the store to database and e-mail sending execute, but the output to the page is being return to their server and they are displaying it on their page on their server.

Yes, something like that.

 

This makes sense to me.  Perhaps it is a business requirement that if you use SIM the receipt for the purchase has to be displayed on their server.

I think is a security reason, making sure it is getting the response to the relay url.

 

However, I would still rather display the receipt on our server.  If I try a javascript redirect on my relay response page, I think the output still appears on their server, just from a different page of my server.  

on the relay page, do your saving data to mySQL, then on the page do javascript redirect to your receipt page. Since the javascript run on your customer web browser, it will redirect the url.