Twocheckout Error

Twocheckout Error

by Jorge Gomez -
Number of replies: 9

Everything seems to work OK. Transaction goes through, except that when the payment is completed and the student clicks to go back to the course, he receives the following message:

"Error while trying to insert valid transaction for order: XXXXXXX"

Then when the students tries to go back to the course again, they are send back to the payment page.

I spoke with 2checkout tech support. They told me they can see the transaction, and everything is OK on their end and the problem is probably on the return.php page.

He also said that the two fields he saw were:

Moodle User ID and Moodle Course ID

I am not sure what this mean.

Any ideas what is happening?

Thanks

Average of ratings: -
In reply to Jorge Gomez

Re: Twocheckout Error

by Alan Barrett -

It seems that the Moodle database did not get upgraded properly during the plugin install (this is part of step (3) in README.txt).
The extra enrol_twocheckout table did not get added.

What version of Moodle are you running?
What date did you download the plugin?
And from where exactly? (http://download.moodle.org/download.php/plugins/enrol/twocheckout.zip ?)
What database are you running? (MySQL?)
Just for completeness what OS/Web Server/PHP versions are you running?

The upgrade logs in moodledata/upgradelogs should have contained an entry "CREATE TABLE mdl_enrol_twocheckout". I assume it does not because of the error you got, but could you check?

The "Moodle User ID" and "Moodle Course ID" that you mention are the expected parameters, so no problem there.

However, there is probably a simple fix. The database table is not really necessary. It is mainly just for logging. (Although it does provide a check for a duplicate transaction.)

You can bypass the error by commenting out line 80 in return.php in the twocheckout folder.
To do this, change that line FROM:
    error("Error while trying to insert valid transaction for order: $order_number");
TO:
//  error("Error while trying to insert valid transaction for order: $order_number");

I suspect that everything will work after that, because the transaction has been validated by that stage, the next step in enrolment in the course.

Please let me know how you get on?

    Alan.

In reply to Alan Barrett

Re: Twocheckout Error

by Alan Barrett -

I worked with Jorge to resolve his problem and I would like to report here on the results for the benefit of other users.

- The initial problem was caused by incorrect install. The database table was not installed because he had not gone to Site Administration and clicked on Notifications. This was caused because he was using Notepad to read the README.txt, WordPad displays the file correctly.

- He then encountered errors because the 2Checkout people had disabled payments to his account pending some extra security checks. Apparently this has happened to others and can be easily fixed once you know by creating a refund policy and a privacy policy. See http://forum.virtuemart.net/index.php?topic=33373.msg100210 for info on other people who have had this problem.

- There was also a bug caused by the require_login() in return.php. This, under some circumstances, was redirecting the user back to return.php after a login causing a missing parameter error. I have taken out the function, which is not needed and put in a simple notice() which brings the user back to the desired course after payment.

Additionally I have added Spanish translations (thanks to Jorge) and a translated README.txt (also thanks to Jorge).

Also, if Moodle uses a Spanish UI, I request 2Checkout to display a Spanish UI as well.

I also would like to note that all testing has been done with "Direct Return" set to NO. I would be happy to test with "Direct Return" set to YES, but I do not have access to a non production 2Checkout account with that setting. In theory that would lead to a more robust setup. I would be happy to work with anyone who wishes to use that setting to test and fix any issues that might appear.

More info in the download (http://download.moodle.org/download.php/plugins/enrol/twocheckout.zip) in README.txt.

    Alan.

In reply to Alan Barrett

Re: Twocheckout Error

by alan murtagh -

Hi Jorge,

Thanks a million for the advice.

My problem is that it installed fine and worked really well initially (i.e. 4 weeks ago)

I haven't changed anything at all in my setup but for some reason it's no longer working. 

I'm beginning to wonder if its a problem on the 2checkout side but I'll keep working on it.

Thanks again

Alan

In reply to alan murtagh

Re: Twocheckout Error

by Alan Barrett -

This is Alan (not Jorge)... It is confusing that we have the same name.

I am not sure how long it was before 2Checkout temporarily turned off his account, it might have been as long as four weeks, but possibly not. In any case you should probably contact them.

Is the error being returned when you go to 2Checkout? Because "parameter error" is the error that Jorge got, and had to get 2Checkout to re-enable his site.

If the error is coming from 2Checkout they should be able to help (otherwise I can look into any errors coming from Moodle related code).

    Alan.

In reply to Alan Barrett

Re: Twocheckout Error - another problem

by alan murtagh -

Hi there,

I was just wondering if anybody else was having any problems with twocheckout.  Everything was working well for me up to the last day or two.

I've tried adding  a new course and have done everything exactly the same as before but now I get a parameter error message.

Many thanks

alan

In reply to alan murtagh

Re: Twocheckout Error - another problem

by Alan Barrett -

A few possibilities...

- Assuming that the Parameter Error is coming from 2Checkout and not my Plugin, and also assuming that you have only recently installed the plugin. It may be that 2Checkout have put your account on some sort of hold until you fill out some security info. See http://moodle.org/mod/forum/discuss.php?d=101553#p452769 for a link to a discussion on that.

- Another possibility is that your Course idnumber does not match the 2Checkout Product ID.

- If it is a new Moodle installation your secret world also has to match, but if your are just adding a new product this unlikely to be the problem

- If the error is happing after payment, then there are other settings that might be an issue (but I get the impression that your error is happening on referral to 2Checkout).

- Also if the error is happening after payment you may want to upgrade to the latest plugin which was release 24th July 2008.

- I am willing to help you if none of the above sort you out.

    Alan.

In reply to Alan Barrett

Re: Twocheckout Error - another problem

by Alan Barrett -

I should have said that the enrol_twocheckoutbusiness setting (in course enrolment settings) needs to match your 2Checkout vendor Account number, but is unlikely to be wrong if you are just adding a new course/product.

    Alan.

In reply to Alan Barrett

Re: Twocheckout Error - another problem

by alan murtagh -

Hi Alan,

THanks a million for all your help with this.  Got it sorted -was a problem with the 2checkout side of things.  THeir customer support is impressive (so far)

Once again thanks

alan

In reply to alan murtagh

Way to list 2Checkout Enrolments

by Alan Barrett -

Great... By the way, I have added a stand alone utility called listenrolments.php to the plugin, which allows administrators to list students who have enrolled via 2Checkout along which some payment data and user information.

    Alan.