OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Authorize.Net Payment Plugin

Are you responsible for making OCS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, michael, John

Forum rules
What to do if you have a technical problem with OCS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved. Please note that this FAQ is OJS-centric, but most issues are applicable to both platforms.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OCS Conference Support and Discussion subforum; if you have a development question, try the OCS Development subforum.

Authorize.Net Payment Plugin

Postby BVBAccelerate » Thu Apr 22, 2010 8:28 am

Hello,

I'm trying to develop an Authorize.Net payment plugin but I have a lot of questions. I feel like I'm gaining an understanding and only need a couple pushes in the right direction to figure this out. I'd like to provide this to the community as well so thanks in advance to anyone who is willing to help - you may be in turn helping everyone! Please feel free to correct me if I am wrong anywhere - I want to learn and contribute. I have tried to organize and make obvious my points that need consideration below.

I am basing this off of the paypal payment plugin and have also looked at a contributed plugin for Moneris for comparison. I'm experienced with PHP but I have not used the smarty template system and am not 100% with the MVC framework yet either. I am a fast learner though and if people here are willing to help me I'll take any and all advice.

First off, this plugin needs to give people the option to pay online using their credit card, or to pay offline. Right now I have an option via radio buttons to choose which way to pay. I figured that if they chose to pay offline I'd just handle that in the script that processes the payment to perform the same actions as if the Manual Payment plugin was chosen. Is this feasible?

Second, the online payment option needs to be hosted through this website and not lead to a hosted payment form, which is where I'm running into all of my problems. From examining the PayPal plugin it seems that their hosted form will send some type of notification based on if there is a success ('notify_url' below) or if there is a cancellation ('cancel_return' below) of payment (perhaps they are using a CURL request to send this notification). Also, they will return you to the OCS site based on the 'return' value below. I assumed this from lines 87-90 in PayPalPlugin.inc.php:
'notify_url' => Request::url(null, null, 'payment', 'plugin', array($this->getName(), 'ipn')),
'return' => $queuedPayment->getRequestUrl(),
'cancel_return' => Request::url(null, null, 'payment', 'plugin', array($this->getName(), 'cancel')),

I assume PayPal sends data back to /index.php/CONFERENCE/SCHEDULEDCONFERENCE/payment/plugin/Paypal/ipn OR /index.php/CONFERENCE/SCHEDULEDCONFERENCE/payment/plugin/Paypal/cancel depending on what the user does on the paypal payment page. Am I correct in assuming that this /ipn or /cancel parts of the path actually end up being the variable(s) passed to the handle($args) method as $args?

If that is the case, then I don't understand what line 132 in PayPalPlugin.inc.php is
curl_setopt($ch, CURLOPT_URL, $this->getSetting($schedConf->getConferenceId(), $schedConf->getId(), 'paypalurl'));

It looks to me like it's sending the payment and all of the post fields to the paypal URL defined in the settings. But I was under the impression that since it brought you to the paypal site it wouldn't need to do that.

If what I am trying to do is a possibility and if my understanding above is correct, I feel like I can make this work by making a CURL request to the authorize.net system and based on that make another CURL request to the plugin in the form (/index.php/CONFERENCE/SCHEDULEDCONFERENCE/payment/plugin/Authorize.Net/xxx) and that will allow the handle($args) function to process the payment according to the plugin rules. However, I would also need a confirmation page after people submit their payment, and from what I have come to understand the paymethod plugins only have the ability to display one page through the displayPaymentForm method, is this true?

I have posted my files as I have them so far. The only part that I still need help with is the handle($args) function which at this point remains much the same as the one in the PayPal Plugin.
Attachments
authorize.zip
Authorize.Net plugin without the actual functionality of processing the payment.
(18.16 KiB) Downloaded 41 times
BVBAccelerate
 
Posts: 33
Joined: Mon Apr 19, 2010 2:01 pm

Re: Authorize.Net Payment Plugin

Postby michael » Fri Apr 23, 2010 12:41 pm

Hi BVBAccelerate,

BVBAccelerate wrote:First off, this plugin needs to give people the option to pay online using their credit card, or to pay offline. Right now I have an option via radio buttons to choose which way to pay. I figured that if they chose to pay offline I'd just handle that in the script that processes the payment to perform the same actions as if the Manual Payment plugin was chosen. Is this feasible?


This may be a bit tricky. The payment plugin handling currently assumes that one and only one payment plugin is active (i.e. either manual *or* paypal *or* another payment plugin). Incoming payment requests are then handled based on the selected payment method. That being said, the manual payment plugin doesn't really do very much at this time (i.e. sends notification to Journal Manager of payment) so you should be able to handle similar functionality in your plugin.

BVBAccelerate wrote:Second, the online payment option needs to be hosted through this website and not lead to a hosted payment form, which is where I'm running into all of my problems. From examining the PayPal plugin it seems that their hosted form will send some type of notification based on if there is a success ('notify_url' below) or if there is a cancellation ('cancel_return' below) of payment (perhaps they are using a CURL request to send this notification).
<snip>
It looks to me like it's sending the payment and all of the post fields to the paypal URL defined in the settings. But I was under the impression that since it brought you to the paypal site it wouldn't need to do that.


The user is sent to PayPal for payment processing with return URLs to our application for common actions (e.g. payment completed, payment canceled, etc) that take place on the PayPal site. When one of these actions takes place at the PayPal site, PayPal redirects the user via these return URLs, which are then handled (like all other requests) by our application to process these actions on our end (e.g. in the case of a completed payment, we create a completed payment record in the db). In the case of a completed payment (i.e. ipn), we also use curl to post a confirmation response to PayPal to verify the details that we received from their site.

BVBAccelerate wrote:If what I am trying to do is a possibility and if my understanding above is correct, I feel like I can make this work by making a CURL request to the authorize.net system and based on that make another CURL request to the plugin in the form (/index.php/CONFERENCE/SCHEDULEDCONFERENCE/payment/plugin/Authorize.Net/xxx) and that will allow the handle($args) function to process the payment according to the plugin rules. However, I would also need a confirmation page after people submit their payment, and from what I have come to understand the paymethod plugins only have the ability to display one page through the displayPaymentForm method, is this true?


The landing page is set in OCSPaymentManager::createQueuedPayment and currently there is only one landing page (for registrations), but this can be modified/extended based on the type of purchase being made. You may want to have a look at OJS which uses different types of landing pages (OJSPaymentManager::createQueuedPayment).

Hope that helps.

Cheers,
Michael
michael
 
Posts: 404
Joined: Thu Mar 29, 2007 2:09 pm

Re: Authorize.Net Payment Plugin

Postby Salima » Thu Jun 10, 2010 10:59 am

We had a student helping us to set up our globally peer reviewed Journal of
Peace building and Development in OJS, and it is looking good.

We have finally been able to arrange for credit card payments on-line, and need
help (volunteer preferably, but if we need to scrape up some cash I think we can
do it) to develop the 'hooks' for the credit card process.

I hope this makes sense to somebody! As a self-published journal, we have not tech folks
on board. We have someone to put the Credit Card payment piece in place....but they
need the 'hooks'/'plugin' to be developed, as they are not familiar with OJS.

We are on an URGENT deadline....so hoping someone sees this and will contact me
at sitka@american.edu
Salima
 
Posts: 2
Joined: Wed Jun 09, 2010 4:07 pm


Return to OCS Technical Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron