Support

Home Forums Event Espresso Premium Moneris Payment Integeration

Moneris Payment Integeration

Posted: November 15, 2022 at 11:04 pm


Mark

November 15, 2022 at 11:04 pm

Hi Folks,
I have tried to connect Moneris with the EE with the help of the link you provided me here. I have used your payment integration skeleton and do some changes. I would like you to answer my multiple questions regarding my integration.
I have created the billing form + settings form
Now
1) How can I get the values of the fields of the settings? using get_option()?
2) Where do I have to write the Moneris integration code in the do_direct_payment() function?
3) How can I record a transaction detail in EE for that payment? means how can I save the response of Moneris in Transaction?

Please reply to me ASAP. Thanks for your cooperation as always.


Tony

  • Support Staff

November 16, 2022 at 4:18 am

Hi there,

Generally, we don’t walk through the steps to create a custom payment method on the forums. If you are unsure, I recommend taking a look at a similar payment method we’ve already created and compare with that.

For example, Moneris looks like it’s an ‘On-site’ payment method (where you enter your card details on your own site and it posts to the data to the Moneris Gateway to process. So try taking a look at another on-site payment method to compare how that works, for example, PayPal Pro is included within core and would give you a working example of this.

1) How can I get the values of the fields of the settings? using get_option()?

From where?

2) Where do I have to write the Moneris integration code in the do_direct_payment() function?

Depends on what the Moneris integration requires, but yes, likely the do_direct_payment() method.

3) How can I record a transaction detail in EE for that payment? means how can I save the response of Moneris in Transaction?

EE creates an EE_Payment object which is passed throughout the payment method, you would update that with the response. Again take a look at the PayPal pro payment method as it gives you a work example of this.


Mark

November 16, 2022 at 10:12 pm

From where?

From the settings form of the payment method.


Mark

November 16, 2022 at 10:18 pm

Could you please guide me to the PayPal pro directory? In event-espresso-core-master\payment_methods I can only see two Paypal Standard and Paypal express, which one is the pro one or none of them is Paypal pro?


Mark

November 16, 2022 at 10:23 pm

Ok, I think it is in the caffeinated directory.


Tony

  • Support Staff

November 17, 2022 at 3:01 am

From the settings form of the payment method.

I would assume you would not be asking how to get the values of a form, from within the form your working on… Right?

So, where are you wanting to pull these values of the settings form into?

Where in the payment method you are creating?

I can only see two Paypal Standard and Paypal express, which one is the pro one or none of them is Paypal pro?

Neither, those are PayPal standard and PayPal express.

Ok, I think it is in the caffeinated directory.

This is correct.


Mark

November 17, 2022 at 10:07 pm

I would assume you would not be asking how to get the values of a form, from within the form you working on… Right?

You are partially correct but I want to get the form fields value in the do_direct_payment function.

So, where are you wanting to pull these values of the settings form into?

Where in the payment method you are creating?

Yes Exactly


Mark

November 17, 2022 at 11:24 pm

I write code for integration but didn’t see any errors in the logs my ajax request got failed all the time and I can’t see any error in the error log. How can I see any error If I have one in my code written inside do_direct_payment?
The popup message says: This registration option can’t be completed now please try again.
Please guide me on this.
Thanks.


Tony

  • Support Staff

November 18, 2022 at 3:50 am

You are partially correct but I want to get the form fields value in the do_direct_payment function.

I don’t follow how that’s partially correct? do_direct_payment is not within the settings form, it’s within the onsite gateway class, the settings form is generated within the payment method class. Those are totally separate so are you not trying to pull in the values of the form, within the setting form as mentioned?

If you have the EE_Payment_method object for your current payment method (which you can get from the $transaction passed to do_direct_payment) then you can use $payment_method->get_extra_meta() to pull in specific values.

Yes Exactly

Seems to be some confusion on what I’m asking here.

I was asking for the location you are trying to pull in the settings form, you can do it differently depending ‘where’ in the code you are trying to pull those values.

The above doesn’t tell me anything other than within your payment method, but nothing about the location within that payment method. The reply above states do_direct_payment, so I’ve gone with that.

How can I see any error If I have one in my code written inside do_direct_payment?

They would show up in the PHP error logs as long as your site is configured to log errors.

Try using this snippet:

https://eventespresso.com/wiki/troubleshooting-checklist/#wpdebug

Within your site’s wp-config.php file to enable error logging, test the request again and check in /wp-content/debug.log for any details.


Mark

November 18, 2022 at 9:58 pm

So to avoid confusion I am trying to clarify the things:
I have built the settings form.
and now in the do_direct_payment function, I need those to form field values. How can I get that?

Try using this snippet:

https://eventespresso.com/wiki/troubleshooting-checklist/#wpdebug

Within your site’s wp-config.php file to enable error logging, test the request again and check in /wp-content/debug.log for any details.

I have done that but nothing seems to be logged in the file.
Thanks.


Tony

  • Support Staff

November 21, 2022 at 3:15 am

So to avoid confusion I am trying to clarify the things:
I have built the settings form.
and now in the do_direct_payment function, I need those to form field values. How can I get that?

You can use the method I mentioned above:

https://eventespresso.com/topic/moneris-payment-integeration/#post-337117

do_direct_payment() is passed the current payment object in $payment, use that to pull the payment method object:

$payment_method = $payment->payment_method();

Then you can pull in individual fields from the payment method settings using payment_method->get_extra_meta({field_name}); for example say you have a ‘validate_zip’ field within the settings form:

$payment_method->get_extra_meta('validate_zip', true)

$field = $payment_method->

$validate_zip = $payment_method->get_extra_meta('validate_zip', true);

Would return the value of that field.

I have done that but nothing seems to be logged in the file.

What response code are you getting from the ajax request?


Mark

November 21, 2022 at 10:27 pm



Here You can see the response in the ajax request
and this error is logging neither on the error log nor debug log.


Mark

November 21, 2022 at 10:28 pm

Reponse
Response1


Mark

November 21, 2022 at 10:39 pm

https://www.screenpresso.com/=5Srbb
https://www.screenpresso.com/=zYNGb


Tony

  • Support Staff

November 22, 2022 at 3:21 am

An ajax request is a standard request, it’s just a request sent in the background.

The fact you are getting error 500 return and the ‘critical error’ message, means it’s a PHP Fatal error and those should be stored within the server’s error logs, if they aren’t then your server isn’t set up to log errors.

Actually, scratch that, your site is logging the errors, I’ve just checked the debug.log.

Take a look in /wp-content/debug.log and you’ll see a Fatal from your custom payment method.


Mark

November 23, 2022 at 10:31 pm

No error in debug.log is logged related to the custom payment gateway.


Tony

  • Support Staff

November 24, 2022 at 2:50 am

There was when I checked the log on the 22nd but looks like the log file has now been deleted as all log entries are from the 24th.

Set the site to display errors and then view the response of the ajax request in dev tools, it should show up there.

You must be logged in to reply to this support post. Sign In or Register for an Account

Event Espresso