Home Forums Event Espresso Premium FirstData E4 [Error] Invalid x_relay_url. Must be the same as configured for the

FirstData E4 [Error] Invalid x_relay_url. Must be the same as configured for the

Posted: June 26, 2013 at 10:24 am

Justin Hilles

June 26, 2013 at 10:24 am


Im trying to setup FirstData E4 Settings.  I have created my payment page, set my transaction ID.  They copied response url to payment page settings in FirstData.

But when i click on button to pay it gives me an error:

The following error was found:

x_relay_url : Invalid x_relay_url. Must be the same as configured for the payment page

I know the url is exactly the same, but im wondering if i copied it to right place.

Can anyone help?



Justin Hilles

June 26, 2013 at 10:25 am

WordPress Version:3.5.1PHP Version:5.3.3MySQL Version:5.1.69Event Espresso Version:


  • Support Staff

June 26, 2013 at 3:07 pm

Hi Justin,

Did you copy the URL that’s highlighted in the yellow box under “Relay Response URL” inside the FirstData E4 settings in Event Espresso>Payment settings?

Justin Hilles

June 26, 2013 at 3:09 pm

Yep copied exactly, double and triple checked i got the right one.  I did notice  its coming in as a query and not a pretty link /?type=firstdata_e4&page_id=89

Is this how its suppose to be, when i go to the link , it changes to /thanks?type=firstdata_e4


  • Support Staff

June 26, 2013 at 3:42 pm

Hi Justin,

There might be something to this. Normally it wouldn’t redirect like that. You could try changing the URL in the First Data account settings to use the pretty URL. I’ve seen a few cases (one being a site hosted on WPEngine) where the payment page was getting redirected to use the custom permalink.

Justin Hilles

June 26, 2013 at 4:36 pm

Updated all links in FirstData admin to pretty link and no joy.

Is there anyway to statically set the relay link in Espresso?


  • Support Staff

June 26, 2013 at 5:43 pm

Yeah, you can replace what’s on line 40 of event-espresso/gateways/firstdata_e4/e4_vars.php.

Justin Hilles

June 27, 2013 at 10:05 am

Hey Josh,

I messed with some of the parameters a bit and i think im starting to connect the dots. I noticed there was a relay response section in my admin for which im not using.

So i changed the code to completely remove x_relay_url and removed TRUE from x_relay_response

<code>	$myE4-&gt;addField(&#039;x_relay_response&#039;, &#039;&#039;);
	if ($firstdata_e4_settings[&#039;force_ssl_return&#039;]) {
		$home = str_replace(&quot;http://&quot;, &quot;https://&quot;, home_url());
	} else {
		$home = home_url();
	//$myE4-&gt;addField(&#039;x_relay_url&#039;, $home . &#039;/?type=firstdata_e4&amp;page_id=&#039; . $org_options[&#039;return_url&#039;]);</code>

Do you see any problems with this? Im not sure why those would be passed all the time unless they are needed for something which concerns me if this broke anything else?



Justin Hilles

June 27, 2013 at 10:06 am

<pre class="brush: php; gutter: true; first-line: 1; highlight: []; html-script: false">
$myE4->addField('x_relay_response', '');
if ($firstdata_e4_settings['force_ssl_return']) {
$home = str_replace("http://", "https://", home_url());
} else {
$home = home_url();
//$myE4->addField('x_relay_url', $home . '/?type=firstdata_e4&page_id=' . $org_options['return_url']);

Here is the readable version

Justin Hilles

June 27, 2013 at 12:50 pm

Hi Guys,

So disabling that does get the payment to process but when it redirects back to the thanks page, it cant find the registration. Looking through the code i noticed two things:

1. In the admin it was returning variables as GET and your code is looking for $_POST. So i simply updated that in the admin of FirstData Payment Page.
2. You are looking for the var $_REQUEST[‘registration_id’] when they get sent back to process payment and this is not included at it all in the initial request to FirstData. So i added

$myE4->addField(‘registration_id’, $registration_id); to e4_vars.php

With that the payment gets processed sucessfully

So im wondering if all this looks ok and if the code needs to be updated at all?



Sidney Harrell

June 27, 2013 at 9:37 pm

We are actually setting the $_REQUEST[‘registration_id’] in firstdata_e4/init.php:

$temp_array = explode(' ', $_REQUEST['x_reference_3']);
	$_REQUEST['registration_id'] = $temp_array[0];

Can you clarify where you see us looking for $_POST variables?

Justin Hilles

June 28, 2013 at 11:19 am

This is in /event-espresso/gateways/firstdata_e4/FirstDataE4.php, Line 94-96 in the validateIpn method.

public function validateIpn() {
foreach ($_POST as $field => $value) {
$this->ipnData["$field"] = $value;

Justin Hilles

June 28, 2013 at 11:24 am

Also that example you showed, the code was never making it to that. The thanks page was never finding the registration and getting stopped at i beleive event-espresso\includes\process-registration/payment_page.php. It wasnt finding a $REG_ID on line 372 which would send it into Line 383 and then do the wp_die at line 390

Sidney Harrell

July 1, 2013 at 5:53 pm

The init.php file used to get loaded when the function in payment_page.php ran, and it worked then. It looks like the init.php files are now getting loaded in a function added to the plugins_loaded hook. By the time it gets to the init hook, the values we added to the $_REQUEST variable are gone. I moved that code into the function espresso_transactions_firstdata_e4_get_attendee_id in e4_ipn.php, and it’s working again.

Edit: This fix has been added to the 3.1.34-BETA version. the full fix I’ve put into this gist, for anyone who wants to add the fix to their copy of 3.1.33:


The support post ‘FirstData E4 [Error] Invalid x_relay_url. Must be the same as configured for the’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3 Documentation for Event Espresso 4

Status: closed

Updated by  Sidney Harrell 7 years ago ago

Topic Tags


This topic is:
Do NOT follow this link or you will be banned from the site!