Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Todd Thornton -
Number of replies: 48

In the past 24 hours, when a student clicks to pay for a course they see an "undefined error" message and are not enrolled in the course, but the Authorize.net payment is being processed. In other words, the payment is being processed but automatic enrollment into the course is not completed even if the payment goes through. Does anyone have any suggestions on what might have caused this or more importantly how to fix? I went in and already changed the Authorize transaction ID thinking it might have an unknown to me expiration date, but I still get the same behavior. I'm moving to 2.3 in 6-8 weeks, but I really need to go ahead and fix this now.


Todd

Average of ratings: Useful (1)
In reply to Todd Thornton

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Jeff Jones -

Thanks Todd for posting this as we started having the same problem yesterday afternoon on Friday (8/25/2012).   We are using: Moodle 1.9.15+ (Build: 20111201)

Hopefully someone has a solution to this.

Jeff

In reply to Todd Thornton

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Glen Keune -

Same thing here... might be something to do with the response codes from Authorize.net.

Still investigating.

 

Glen

In reply to Glen Keune

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Sabuson George -

Same here too. Authorize.net is closed for weekend.

In reply to Todd Thornton

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Jared Wolthuis -

Just wanted to add to the list of people experiencing this problem. My guess is that Authorize.net has changed their response codes in a way that moodle can no longer process them properly. Of course this would happen on our busiest weekend of the year. I had to void a ton of bad transactions.

In reply to Jared Wolthuis

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Todd Thornton -

Yesterday, I asked someone via online chat at Authorize.net if they had changed anything on their end (security settings, etc.) that could explain the enrollment issue and they flatly said no. Granted the person may/may not know what they've changed or may not even think a change they made would impact enrollments.

I'm not saying it's not happening in other programs, but in the past couple of days I don't see any other online reports of Authorize.net enrollments/subscriptions that have stopped working for things like Wordpress/Buddypress, Joomla, etc.

Granted it happened Friday and maybe other reports will come in on Monday, but I would agree that whatever was changed at Authorize is only affecting Moodle installs because of some specific way in which Moodle is actually trying to process the verified enrollments.

On a slightly off topic note, does anyone have any updates on Authorize.net in 2.3? Before this recent problem appeared, I didn't know it wasn't included in core. I know there was an older plugin someone made available that seemed to allow things to still work, but it's very concerning Authorize.net is not built into core.

I feel for the person for whom this is their busiest weekend as I've only had to void 4-5 transactions so far, but for those that charge for individual courses, automating the payment/enrollment option is obviously a critical function for any LMS they use.

I understand PayPal can be used in Moodle 2+ and it may be the defacto/default form of payment in certain parts of the world and they have pending deals with McDonalds/Discover to expand their mobile presense, but there are a variety of valid reasons one might choose not to use PayPal as their default payment method. 

Todd

In reply to Todd Thornton

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Doug Swenson -

Has anyone had any luck in figuring out what has changed with the Authorize.net response? We have yet to get a response from Authorize concerning any changes. The transactions are approved and the users credit cards are in fact charged the correct amount before the error is returned.

If we get the response from Authorize, we will post the solution here - others please do the same.

Doug

In reply to Doug Swenson

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Jeff King -

We have a Moodle 1.9x client experiencing the same problems as of a few days ago too. Add me to the list.

In reply to Jeff King

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Brent Lancaster -

Someone posted a possible solution to John' s post on the Authorize.net forum: 

http://community.developer.authorize.net/t5/Integration-and-Testing/AIM-Moodle-integration-is-now-broke-as-of-8-26/td-p/29168

I am not a programmer (I'm a teacher) so i wouldn't know where to begin on this.  Has anyone tested this solution? Any updates would be great.

In reply to Todd Thornton

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by John Anderson -

Want to let it known I am having this same trouble with Authoize.net as of today Aug 27. Has run flawless for over a year.

using Moodle 1.9.5 (Build: 20090515)

Hope we can get some answers soon.

 

In reply to John Anderson

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by John Anderson -

I have tried a transaction with max debug on and captured a little more information. I made a captivate movie using BadBoy testing browser and post that in a bit after cleanup...

 

Notice: Undefined offset: 2 in E:\Inetpub\wwwroot\*******.org\enrol\authorize\authorizenetlib.php on line 360

unknown error
Stack trace:
  • line 1664 of lib\deprecatedlib.php: call to debugging()
  • line 93 of enrol\authorize\enrol.php: call to error()
  • line 103 of course\enrol.php: call to enrolment_plugin_authorize->print_entry()
In reply to John Anderson

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Renu Kumar -

Hi All, we are running into the same issue.  The screen shows 'unknown error' but the transaction is going through and the course is also seems to enrolling the user...


Renu

In reply to Renu Kumar

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Pavel Gonzalez Garcia -

Hi All, we are running into the same issue. 

The screen shows 'unknown error' but the transaction is going through but the student is not enrolled to the course.

Help.


Pavel

In reply to Todd Thornton

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by John Anderson -

Here is my video test. It seems like Authorize is only POSTing back:

username
password
testcookie=1

Does that mean it's in test mode somehow?

Also, seems like you would need the course id, transaction id and all the regular good stuff one would expect 

In reply to John Anderson

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Sabuson George -

That is interesting. Authorize.net claims they have not made any change.

I get the following string when debugging the $data variable in authorizenetlib.php

Array

{

[0] = Expires: Thu, 01 Jan 1970 00:00:00

}

In reply to Todd Thornton

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Brent Lancaster -

I contacted Authorize.net and they are aware of the issue but say it is a Moodle problem.  They told me their response codes have not changed and that Moodle was having trouble connecting to them.  I have no idea where to begin solving this issue. 

 

Who within the Moodle community can I contact?

In reply to Todd Thornton

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by John Anderson -
In reply to John Anderson

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Jeff King -

I think the authorize.net forum thread nails it: the Moodle plugin isn't processing the response from authorize.net properly. It worked in the past but now there are some extra lines which is confusing the Moodle plugin.

Likely it's the authorize_action() function in authorizenetlib.php, where it grabs the response and does an explode() on a delimiter and processes it.

Would be interesting to see the raw response from authorize.net and figure out how to parse it better.

In reply to Jeff King

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by John Anderson -

Well found today that transactions are in fact are good. also wnated to share I get this email error from out site :

North Carolina Collaborative Training Institute: Transaction failed.

unknown error

Array

(

    [paymentmethod] => cc

    [refundinfo] => 6643

    [ccname] => Serenity Counseling

    [courseid] => 2

    [userid] => 2468

    [status] => 0

    [settletime] => 0

    [transid] => 0

    [timecreated] => 1346162747

    [amount] => 45.00

    [currency] => USD

    [id] => 9038

)

Well, I don't know how to ignore the extra lines, if that's the case. But looking at authorize_action() now...

Has anyone tried test mode? switch the account into test mode?

In reply to Todd Thornton

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Mike Wood -

Happened to us twice yesterday and still happening. No clue yet as to what to do. Gonna have to tell the boss, he's gonna blow a gasket.

In reply to Mike Wood

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Mike Wood -

Called Auth.net and the rep said all was fine on their end and nothing looks odd at all. In and out is fine as far as he can see. They have changed nothing.

I changed the AVS settings nope, changed transaction key in authorize.net panel and Moodle still get the error. 

Called auth.net again and the rep I spoke to said that it appears to be something in the headers on their end and though a rare issue they have been getting calls. We tried a card that would flunk and same error message as a good card. 

He said their engineers are working on it and should be resolved today or tomorrow. Crossing fingers!!!! So it appears to be something they think they can fix which would be nice.

Ok this is interesting. I looked in the payment manager of my moodle and it's listing all the errored transactions as a test.

Payment Method: Credit Card
OrderID: 509
TransactionID: 0
Amount: USD 1.00
Course: MSD
Status: Tested
Name on Card: Mike Wood
Time: Tuesday, 28 August 2012, 01:31 PM
Settlement Date: Not settled

Several of them and a couple from earlier this month.

In reply to Mike Wood

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by John Anderson -

Whew thanks for sharing! Fingers crossed. Ironically I tried to buy something last night at home grown online pet shop and my order get messed up. Got a call today from the shop and I think they are using A.net too, having problems.

 

 

In reply to Mike Wood

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Todd Thornton -

Authorize has posted they changed the date format slightly yesterday afternoon to try and accomodate the basic implementations/header issue, but just thought I'd post that I tested Moodle again and it doesn't work. I have no idea if Authorize is planning on making additional changes, but it sounds like the Moodle code change is working although I have not tried yet. (Was waiting to see if Authorize could adjust things on their end)


Todd

In reply to Todd Thornton

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Roger Leeper -

Jeff's fix is in and working!

Are other, newer versions of Moodle having the same issue? TIA

--

Roger

In reply to Roger Leeper

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Jeff King -

The Authorize.net plugin isn't a part of the core Moodle 2.x package, however a contrib plugin was recently released I believe, tracker linkhere: http://tracker.moodle.org/browse/MDL-27477

I don't know if it is experiencing the same issue as I haven't had a chance to try it out yet. However a quick glance at the code shows it's using the Authorize.net PHP libraries, which means it's using CURL to send it's messages, and therefore probably won't experience this problem as it's able to deal with the response more easily (headers will already be split from the response).

In reply to Jeff King

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Jeff,
yes, using cURL should be safe with headers. I've taken a look at it too, at the time of your opening the issue, just to be quite sure that it doesn't affect 2.x versions.

BTW, if you look at the git repo, the code is already in the main stream - 2.4, 2.3, 2.2, 2.1, 2.0 - but MDL-28466 says that it "is no longer maintained" and it should be removed: it seems that the 58 votes in MDL-27477 let the code be there and hopefully with maintenance.

HTH,
Matteo

In reply to Roger Leeper

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by todd vainisi -

I don't see Jeff's fix?  Can you post pls?

In reply to Todd Thornton

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Jeff King -

Hi Everyone,

I think I may have a fix. Authorize.net now seems to be sending back more headers than in the past, and the Moodle plugin wasn't built to deal with it.

I added just 1 line of code which will keep reading data until it finds the blank line which indicates the end of the headers.

Edit file: /enrol/authorize/authorizenetlib.php

Edit line 279 from :

fgets($fp, 4096);

To be:

$data = fgets($fp, 4096);

Then insert this line:

while (!empty($data) && $data=trim(fgets($fp, 4096))); //get any remaining headers (fix to accommodate extra headers)

So this line would be directly before the $data = fgets($fp, $length); line.

I have only tested this in test mode, but I assume it should work for production since the bug was happening in test mode as well. 

Let me know if this works for you.

In reply to Jeff King

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Sabuson George -

Thanks for sharing this fix! Working fine in non-test mode.

In reply to Jeff King

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Jeff Jones -

Many Thanks!  We incorporated it into our live site and it works perfectly.  Hopefully someone at Moodle will incorporate this into future downloads.

In reply to Jeff Jones

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Jeff,
I kindly suggest you to file an issue into the Tracker: this will help the Moodle Community (Developers first) to take care of it and you to "track" that process wink. More info at http://docs.moodle.org/dev/Tracker_guide.

HTH,
Matteo

In reply to Matteo Scaramuccia

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Jeff King -

Hi Matteo,

I will definitely do that, I was just checking out the tracker today. 

In reply to Jeff King

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Jeff,
TNX! One more thing: could you post here the id of the filed issue, when available? This will help other people, being able to access and watch that issue.

TIA,
Matteo

In reply to Matteo Scaramuccia

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Jeff King -

Thanks, I just posted the link to the issue. I have my code listed as a workaround, not sure if I should attach a patch. First time submitting to the tracker, so still figuring it out.

In reply to Jeff King

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by John Anderson -

You found and fixed it Jeff - Thank so many times !!!

Our site was tested just now still in live mode and the transaction and enrolment all went smooooth as it should.

And thanks to everybody keeping it alive and going.  big grin

In reply to Jeff King

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by scott brill -

Thanks Jeff!  Your fix seems to be working for us.

In reply to Jeff King

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Mike Wood -

Thanks Jeff! That worked like a charm!

In reply to Todd Thornton

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Jeff King -
In reply to Jeff King

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Jeff,
well done!

If you're able to play with git, you could post there a patch (hosted e.g. in GitHub) using a brand new branch named as the issue ID - plus a short description, no spaces - with just the commit containing the patched file and, if the Core Developer will positively review your commit, the fix will be integrated into Moodle preserving you as the initial commit author.
Otherwise a simple attached Unified Diff file will be fine and it will help in merging and quickly test your patch proposal too.

Matteo

In reply to Matteo Scaramuccia

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Jeff King -

Thanks for the guidance. I got setup on github and commited the patch, and updated the tracker issue... hopefully I did that correctly.

In reply to Jeff King

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Jeff,
simply perfect, branch naming included smile. It will be reviewed according to their schedule (time, priority, backlog, ...).

Thanks for your efforts,
Matteo

In reply to Jeff King

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Tom Reid -

I'm glad Jeff's fix is working for others.

We tried it last night in our 1.9.9 and we still have the same "unknown error" behavior. One of our team is trying to get help from AuthorizeNet now. I'd welcome any ideas why jeff's fix did not work for us, and what might work for us.

In reply to Tom Reid

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Tom Reid -

We found our error in implementing Jeff's fix.. The fix is working. Thank you Jeff and all.

In reply to Tom Reid

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Jeff King -

Glad you got it working, Tom.

In reply to Todd Thornton

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by John Anderson -

Wondering if any one from this thread is seeing a new round of Authorize.net issues ? Started having dropped enrollments. 

Sorry, I know this is old.


In reply to John Anderson

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Glen Keune -

Hi John, yes, I'm having issues with my 1.9 site. The payment goes through, but Moodle doesn't recognize the successful payment and the student doesn't get enrolled. I've spent the last day investigating, but haven't made any progress on discovering the issue.


Glen


In reply to Glen Keune

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Muhammed Memon -

Hi,

My site starting having the same issue couple of weeks back.  I am not a programmer, were either one of you able to find the fix for this issue?  Any help will be highly appreciated.


Regards,

Muhammed

In reply to Glen Keune

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Muhammed Memon -

Glen,


Were you able to find a solution to your issue?  I will really appreciate if you can share the fix.


Regards,

Muhammed

In reply to Muhammed Memon

Re: Authorize.Net Payment No Longer Enrolling in Moodle 1.9+

by Glen Keune -

Muhammed,

Unfortunately, no... I've tried getting PayPal to work as an alternative, and am having no luck with that either. Sadly (for me), I'm having to manually process and enroll our students.

I'm going to try the latest build of Moodle and see if that fixes things with PayPal payments and enrollments.

Glen