Support

Home Forums Event Espresso Premium Gateway troubles

Gateway troubles

Posted: April 22, 2015 at 2:13 pm


Joël van de Pol

April 22, 2015 at 2:13 pm

I’m having trouble writing a custom offline gateway for EE3 and I hope you can help. Sometimes it works as it should, but sometimes the returned registration id will be confirmed with a registration id that belongs to a previous order, which of course will result in the error “There was a problem finding your Registration ID”. Let me walk you through.

The payment provider requires a return url and a notification url for every request. I generate these with:

$return_url = home_url() . '/?page_id=' . $org_options['return_url'] . '&r_id=' . $payment_data['registration_id']. '&type=sofort';
$notification_url = home_url() . '/?page_id=' . $org_options['notify_url'] . '&r_id=' . $payment_data['registration_id']. '&type=sofort';

The generated urls seem to be correct. The gateway takes me to the payment page, I put in my data and I’m redirected to the EE site. The url looks like this: mydomain.com/?page_id=5&r_id=1-5537f8e5bf761&type=sofort

My function to get the attendee id looks like this.

function espresso_transactions_sofort_get_attendee_id($attendee_id) {
	if (!empty($_REQUEST['r_id'])) {
		$attendee_id = $_REQUEST['r_id'];
	}
	return $attendee_id;
}

The returned $attendee_id matches the r_id in the url and the registration id in the database. Now, with some orders the security matching of the registration ids in payment_page.php and process_payment.php is succesful and the order is processed correctly with the gateway. But more often than not, the registration ids don’t match and I get the error “There was a problem finding your Registration ID”.

I changed the error message to display the variables that are being compared ($payment_data[‘registration_id’] and espresso_return_reg_id()). I noticed that the former contains the registration id of a previous test order. This even happens after clearing the browser cache.

I’m at a loss here, and I’d appreciate any hint to a solution.


Joël van de Pol

April 23, 2015 at 2:31 am

I figured it out by myself. But I’m missing one last piece of the puzzle. I’m using $org_options[‘return_url’] as the return url and $org_options[‘notify_url’] as the notification url. The payment is processed correctly by the notify page, but when the customer is being redirected to the return url, the thank you/return payment page shows the payment status ‘incomplete’. Only after a reload it is correctly shown as ‘completed’. Is there a way to make it display the completed status immediately?


Tony

  • Support Staff

April 23, 2015 at 2:56 am

Hi there,

Apologies for the delay but I’m glad you figured it out.

What you are describing we usually see with PayPal and happens when the user is returned to the thank you page before the IPN has been processed.

So basically:

1. User registers and is directed to the offsite gateway.
2. User pays using offsite gateway.
3a. An IPN is sent from the gateway to your site which Completes the registration.
3b. User loads the thank you page which shows as Complete.

When the IPN is slow 3a and 3b and reversed, meaning the user loads the thank you page (IPN hasn’t been received yet) and it ‘corectly’ shows Incomplete (because EE doesn’t know the payment has been made)

After the user loads the thank you page, the IPN is received which updates the registration to complete.

User reloads the page and the updated details are displayed.

Can you run through the steps here:

https://eventespresso.com/wiki/how-to-set-up-paypal-ipn/#troubleshooting

Try using the simplified transaction template on your notify_url page, this allows the IPN to be processed as quickly as possible (it removes ALL theme styling for that page)


Joël van de Pol

April 23, 2015 at 3:15 am

Thanks for your answer. I already installed the stripped down template. I’ll probably just add another variable to the return url so that a message will be displayed that notifies the customer of a possible delay.


Jonathan Wilson

April 27, 2015 at 3:47 pm

Since this topic is resolved, I am going to close it. If you have anymore questions or issues, please start a new topic and we will be happy to help there. 🙂

The support post ‘Gateway troubles’ 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.

Event Espresso