Well, I feel like a complete failure as a developer and I need some help. I am very very new to Authorize.net. and e-commerce as a whole on this level. My client that I am building a site for has an account with Authorize.net for the payment gateway and this is what I am to use to build the product pages, cart, and checkout.
I was hoping that it was going to be much easier to integrate and/or at least that there might be some step-by-step tutorials on "how to." I was wrong. I have been searching for answers, but have not found what I am looking for....thus this cry for help.
I have no idea what I am doing to integrate this and feel so overwheled with this product. It seems more complicated than it should be and I'm sure it's much simpler than I am making it out to be. Please bare with me, I feel stupid enough at this point and have a lot of questions.
Setting and Situation
Problem/Questions
Thank you so much for your help in advance! I very much appreciate it.
Humble Regards,
~Jedi
12-28-2011 06:06 AM
AIM is going to be the simplest to implement. You just call Authorize.net internally and the transaction either succeeds or fails. Only one small piece of code needed. Download the PHP SDK, look in the doc folder for a file called AIM.markdown. It will give you all the code examples you need.
If you want less in the way of PCI requirements, you could use DPM instead, which is essentially an upgraded form of SIM and allows you to keep the form on your site while having the data submit through Authorize.net. If you download the DPM documentation and look at the PHP section, it's relatively simple, though it does require multiple pages and is therefore slightly more complex than AIM.
http://www.authorize.net/support/DirectPost_guide.pdf
- The SIM SDK can be placed anywhere on your server as long as it's referenced correctly. It's just like any other code library. I generally prefer to place it in a Library folder inside my public_html along with all my other library files, but that's just personal preference, and I suppose it might not hurt anything to have it outside of the web folder, especially if you edit some of the defaults in the SDK (not a good idea probably, but still...)
- Not sure what you're asking about specific places. You just call the master SDK file at the top of your page and you're good to go. Nothing has to be at a specific place, though in the case of relay response, silent post, receipt URL's, etc., you do have to make sure those URL's are configured in your control panel to match the URL's you're using on your site.
- If you want the form to display on your site, and you're doing single payments only (as opposed to subscriptions), you want to use either AIM or DPM. See above. SIM isn't documented as simply and people fill out their credit card info on Authorize.net, which is probably not what you're looking for.
12-28-2011 10:15 AM
I am using DPM.., so could I use this for php as well? all I need to do is call the SDK
require_once 'anet_php_sdk/AuthorizeNet.php'; // The SDK
at the top of my php page also?
if so, what about using my form instead of the one in the sdk?
12-28-2011 10:27 AM
Correct. Every page that references Authorize.net should have that at the top. Except the path needs to be modified if you don't have the Authorize.net library in the same folder. For instance, if your page is in the root of your web folder, and the Authorize.net SDK is one level back from that, you'd need to use:
require_once '../anet_php_sdk/AuthorizeNet.php';
Where .. means you want to reference the parent directory of the current directory. Or if you have pages all over in various levels of directories and you don't want to have to constantly keep changing the path, you might use DOCUMENT_ROOT. Something like this, if I've worked it out correctly:
require_once "{$_SERVER['DOCUMENT_ROOT']}/../anet_php_sdk/AuthorizeNet.php";
Regarding using your own form, see my post in reply to this thread:
You should be able to take it from there, I hope.
12-28-2011 11:04 AM
Thanks!
12-28-2011 11:20 AM
Thanks for the reply TJPride!
Alright I will go with the AIM. I originally downloaded it, but wasn't sure that was the way to go (the "Advanced" part of the API was kind of intimidating, but I get where you are coming from).
So I just do the same as you responded below? Where ever I place the SDK I just call to the "require_once"?
Correct. Every page that references Authorize.net should have that at the top. Except the path needs to be modified if you don't have the Authorize.net library in the same folder. For instance, if your page is in the root of your web folder, and the Authorize.net SDK is one level back from that, you'd need to use:
require_once '../anet_php_sdk/AuthorizeNet.php';
Okay so just to make sure let me get this breakdown of the tree right...
From a product page with an add to cart button I have to create three additional pages:
Alright, this is all a bit overwhelming. I shall give that a shot for now. I am likely to have additional questions regarding this, but I will be looking forward to your response to make sure I am on the right path.
Thank you very much for your help!!!
~Jedi
12-31-2011 03:33 PM
To keep things simple, the cart should make any necessary updates and then forward to the payment page (passing some sort of ID for the cart record), where they'd fill out their payment info and then hit submit. On submit, an internal call is made to Authorize.net (yes, via authorizeAndCapture() ) , and the form is either displayed again with an error message (on failure), or a success message is displayed. I'd personally keep the success message on the same page, rather than forwarding to a receipt, since that way you have all the data right there.
Yes, that require_once should work from everywhere, assuming you explained your directory structure accurately. It can be placed anywhere on the page as long as it's above the Authorize.net code. I'm afraid I'm not familiar with Joomla, however, so I can't help you much there. I'm not sure if you're allowed to put PHP code into articles, or whether anything of that sort has to be coded elsewhere and then called via a template tag or whatever. My advice would be to create a simple article with <?php print "this works"; ?> and see what happens. If it prints properly rather than displaying the code, then you're good to go on inserting PHP.
12-31-2011 04:10 PM