School is a twelve-year jail sentence where bad habits are the only curriculum truly learned.
John Taylor Gatto
New forum topics
Recent comments
- Thanks for the article.
2 weeks 2 days ago - This is because IE is running
2 weeks 2 days ago - The System76 Starling with
3 weeks 18 hours ago - How to name file for theming
4 weeks 2 days ago - "Fatal error: Call to
4 weeks 3 days ago - I put Apache as the front
6 weeks 3 days ago - I'm not using this setup
6 weeks 4 days ago - Nice tutorial.
And how have
6 weeks 4 days ago - Hmm... I tried altering my
7 weeks 20 min ago - I fixed line 35 but still
7 weeks 2 days ago
John Conde was the first one coding a PHP class for the recently launched Authorize.net Automated Recurring Payments API (ARB), he was also the guy who told me this so much wanted API was coming a few weeks ago.
His code was PHP 5 only so I made a few changes a have just finished my first version, which runs in both PHP 5 and PHP 4.
Download arb2.zip and let me know how it works for you.
I'm still testing and could find some small bugs which need to some polish, I'll update this post and code if needed.
You will need to have an ARB enabled Authorize.net account, of course.
You can test the class with the following sample code:
<?php
require_once("AuthnetARB.class.php");
$login = 'cnpdev4289'; $transkey = 'SR2P8g4jdEn7vFLQ'; $test = TRUE;
$arb = new AuthnetARB($login, $transkey, $test);
$arb->setParameter('interval_length', 1); $arb->setParameter('interval_unit', 'months'); $arb->setParameter('startDate', date("Y-m-d")); $arb->setParameter('totalOccurrences', 12); $arb->setParameter('trialOccurrences', 0); $arb->setParameter('trialAmount', 0.00);
$arb->setParameter('amount', 1.00); $arb->setParameter('refId', 15); $arb->setParameter('cardNumber', '5424000000000015'); $arb->setParameter('expirationDate', '2009-05');
$arb->setParameter('firstName', 'Joe'); $arb->setParameter('lastName', 'Doe'); $arb->setParameter('address', 'Casa 1872'); $arb->setParameter('city', 'City'); $arb->setParameter('state', 'FL'); $arb->setParameter('zip', '33619'); $arb->setParameter('country', 'us');
$arb->setParameter('subscrName', 'The Test Account'); $arb->createAccount();
echo 'isSuccessful: ' .$arb->isSuccessful() . '<br />';
if ($arb->isSuccessful()) { echo 'cool, it worked! <br />'; } else { echo 'error in payment <br />'; }
echo 'isError: ' .$arb->isError() . '<br />'; echo 'getSubscriberID: ' .$arb->getSubscriberID() . '<br />'; echo 'getResponse: ' .$arb->getResponse() . '<br />'; echo 'getResultCode:' .$arb->getResultCode() . '<br />'; echo 'getString: ' .$arb->getString() . '<br />'; echo 'getRawResponse: ' .$arb->getRawResponse() . '<br />'; ?>
Enjoy.


Join the conversation
cURL timesout
I am getting an error where the curl_exec($ch); command times out so completely that the php script stops running.
Suggestions?
If using on GoDaddy
First, thanks for the code! Second, if using this with GoDaddy, you will need to specify the use of an SSL Proxy.
GoDaddy shows the proxy info here:
http://help.godaddy.com/article.php?article_id=288&topic_id
You can paste the following right after the curl_init(); in the class (about line 57)
//required for GoDaddy
curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt ($ch, CURLOPT_PROXY,"http://proxy.shr.secureserver.net:3128");
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_TIMEOUT, 120);
//required for GoDaddy
Not Getting Respons Variables
For some reason I'm not getting a response from auth.net, When I try to do a live subscription I get:
isSuccessful: 1
cool, it worked!
isError:
getSubscriberID: 1390463
getResponse: Successful.
getResultCode:Ok
getString:
BUT when I log in to auth.net it doesn't exist... I am in live mode, but its just not registering.. anybody else have this problem?
Also, how would on utilize the update and delete record functions?
THANKS SO MUCH FOR YOUR HELP
I've spent about 7 hours today working on this lol
I'm an idiot
Ok, I'm an idiot.. I was updating the WRONG auth.net account!!
However, I still was wondering how to use the delete record and update record functions with this script.
THANKS
Invalid authentication values
I have been tryign everything on this but get "User authentication failed due to invalid authentication values."
The api login id and transaction key i use is correct, and the authorize staff have confirmed that ARB is activated in my account.
Any ideas ?
Thanks
Gaurav
Having same issue
I am having the same issue... I doubt it's related to this class because I get it regardless... However I is giving me an E007 error message which is Invalid User Authentication...
I know I have the right login id and transaction key. I have also created new transaction keys just to make sure and using them unveils the same results..
Ne ideas?
User authentication failed explanation and fix
The reason you're experiencing user authentication errors is because you're running the script against the developer test url:
https://apitest.authorize.net/xml/v1/request.api
while using your real authorize.net login id and transaction key.
By "real", I mean the credentials you'd actually use in a live, business environment. Those credentials will only work with the production url:
https://api.authorize.net/xml/v1/request.api
The developer test url is only for those who registered for a free authorize.net developer test account. Your real, live authorize.net account login id and transaction key won't work with the 'apitest.authorize.net' url.
It's silly that Authorize.Net doesn't allow developers to perform 'test' requests against the 'production' url. It's funny that their developers weren't able to tell you the reason why your requests were being rejected. Maybe it was just too obvious.
So you have two ways to deal with this:
1) Register for a authorize.net developer account to get a login id and transaction key to use against the "test" url. Click the "Request a test account" link near the bottom of this page:
http://developer.authorize.net/
2) Just use the existing developer login id and transaction key that's already included with the script. Yes, they are real and do work.
query regarding Automated Recurring Billing(ARB )
Hello
i am developing a website where Automated Recurring Billing is required.
Here i want to update database whenever payment will happen. in time of subscription i am able to update database.can you please inform me how can i call my php script for updating database in time of next occurrence of payments for the subscription?
Alexis Rocks!
Thank you sooooo much for posting this example. After two weeks of off and on struggles with Authroize.net's sample php code without success, I plugged John's sample code in and within 5 minutes I had tested successfully with my developers account. After another 15 minutes, I had this solution implemented on my site and have tested two transactions of my own, without fail!!
Thanks for the post.
Sam
P.S. The godaddy code is an important piece if you are hosted on godaddy. Don't forget that!
Recurring Billing Control for Authorize.Net
FYI: My company has just released I-Bill IT, a library/control that offers a rich object-model for interfacing with Authorize.net. It is written in C#/.NET, but is also callable from any COM/scripting language on Windows platforms (ASP/vbscript, PHP, etc.). There is sample code for PHP on our website.
As far as I know, it is the only library currently out there that supports Authorize.net's Automated Recurring Billing (ARB) feature as well as Advanced Integration Method (AIM). As I said above, it offers a rich object model over the Authorize.net services, making it much easier and faster to add such functionality to your application.
Also, we worked closely with Authorize.net during the development of the control and it is certified by them for both AIM and ARB.
Details
Download Url: http://www.itdevworks.com/download.aspx
Online documentation: http://www.itdevworks.com/Documentation/iBillit/1.0/
If you download the control without a purchased license, it will run in "trial" mode, where you can either submit payments to Authorize.net's test gateways, OR you can submit transactions to the live gateways, but in test mode. There is no timeout on the trial version.
To purchase a license, the cost is $99.00 per server/installation.
I hope this helps someone out.
David Parker
President
IT DevWorks, LLC
http://www.itdevworks.com
Thank but what am I missing?
This class was very useful. It seems to work fantastically when we were in test mode, but when we switched to live mode it validates everything no matter what you enter.
I've seen heated arguments around over the whole ARB not being an actual processor and what have you. Fair enough. I don't really care. All I want is to be able to validate the card before creating an account. By the looks of this API, it would appear as though the validation is handled within this API and this class. Otherwise, why would you even need to submit card info and not just the refId of the account to set up ARB for?
At this point, thanks to authorize.net not having any useful information on this issue nor any reasonable support for integration, I don't care what process I have to go through to get subscriptions working. If anyone has an idea of why I can create an account with bunk info, I'd like to know why and how I might be able to fix the issue.
Thanks for the class!
-Kai
I changed test to false and
I changed test to false and entered our production login and transkey and can still get test card numbers to work but not real transactions. Anyone know what I'm doing wrong? I guess this is the same problem Kai is having.
Validating cards when using ARB
This is in response to Kai's post.
I have encountered this situation with a few clients. More specifically, in cases where an ARB subscription grants access to premium parts of a website, it is not completely validated until sometime later when Authorize.net's servers run their batch jobs to process ARB transactions. If the user enters invalid information, whether maliciously or accidentally, they still gain access to the premium parts of the site. Furthermore, Authorize.net does not notify you in any clear way (that I have seen) that the transaction failed. It probably is included with the end-of-day reports you get, but you would have to explicitly look at every one each day for the failure then go in and manually revoke that user's rights, which is both time consuming and terrible for customer relations.
The solution I have come up with is to submit the first payment as a normal payment transaction through the AIM API so you get an immediate response on the validity of the billing information. Then, if it goes through okay, set up your ARB subscription to start at the next billing cycle, rather than immediately. If the AIM transaction fails, you can inform the user immediately and therefore never give them access in the first place, or perform whatever notification and/or processing your system needs to do.
I hope this helps.
David Parker
President
IT DevWorks, LLC
http://www.itdevworks.com
Problem with CIM
When i use the CIM method for transaction iam getting the error "E00009
The payment gateway account is in Test Mode. The request cannot be processed.".
My account is in test mode but i cant test transaction can some one help
Thanks!
Thanks for the code. Very nice and it works much better than Authorize's own "sample" code. At least yours can be made to work!
For those guys needing more information, the guide is here: http://www.authorize.net/support/ARB_guide.pdf
I sure appreciate it. Now I'm off to customize it!
Start Date must not occur before the submission date.
Hello Everybody,
This example(sample code) was just running well but siddenly its showing me the error as
isSuccessful:
error in payment
isError: 1
getSubscriberID:
getResponse: Start Date must not occur before the submission date.
getResultCode:Error
getString:
Can anybody tell me what is the reason of that?
Thanks,
Srikanta
It is date error
Hey
I wonder if you have given proper dates in the start date field..because I faced the same error before and I fixed it..check it twice anyway
ARB Validation
(in response to Kai)
The ARB system is not an on demand system. If you want to know that a card validates as real and has enough funding to pay for your subscription, then you must run a manual AIM request using
AUTH_ONLYfor the amount you wish to charge. Then if this comes back successful, run your ARB request with the same data. The reason for this is that Authorize.net processes ARB requests in batch form.The time at which Authorize.net processes your ARB requests may vary but it's usually been around 3:00AM for me. You can setup what is called the silent postback URL. This URL is a script that you write that lives on a server you control. When ARBs are processed in the wee hours of the morning, the result of each ARB is sent to your silent postback URL. The data sent to your script will indicate whether an ARB request was actually successful or not. If the ARB request was denied then you can take the appropriate actions to disable that member's account.
Probably the best idea is to do a full
AUTH_CAPTURErequest for the first subscription period and then setup an ARB with the same data to start on the next period. For example, charge the customer's card with AIM for the first month, and make an ARB request that starts next month. If you're doing a free trial period then the first part is free anyway, so it doesn't really matter, you can just use the regular ARB API.ARB occurrence
i am using AUTH_ONLY for card validation after that creating ARB and set silent post url.But i have some problem it does'not give me x_subscription_id for updation ARB when user card expire
test
hello,
anybody can help me on this error below:
isSuccessful:
error in payment
isError: 1
getSubscriberID:
getResponse: You have submitted a duplicate of Subscription 316606. A duplicate subscription will not be created.
getResultCode:Error
getString:
Outgoing Parameters
interval_length 1
interval_unit months
startDate 2008-07-23
totalOccurrences 12
trialOccurrences 0
trialAmount 0
amount 1
refId 15
cardNumber 5424000000000015
expirationDate 2009-05
firstName Joe
lastName Doe
address Casa 1872
city City
state FL
zip 33619
country us
subscrName The Test Account333
recurring
how to chek the recurring is work fine on the given date
Recurring billing for eChecks
Have you tried using ARB for eChecks? I get an error that says that the documented field (under the node in the XML) is not recognized. IE, I replaced the node and children with the node and its children, but Authorize.net API doesn't seem to like the node under for some reason. Anyone else tried this or gotten the recurring billing for eChecks to work?
Database updation
Hi, first of let me thank you for the code and also for the all the comments put. It all really helped me alot.
Now, can u tell me how can i update my database regularly, and also how can i manage the database when the subscription is cancelled?
Once again thanks so much.........
When I try to do a test
When I try to do a test subscription I get:
isSuccessful: 1
cool, it worked!
isError:
getSubscriberID: 335320
getResponse: Successful.
getResultCode:Ok
getString:
Outgoing Parameters
interval_length 1
interval_unit months
startDate 2008-09-01
totalOccurrences 12
trialOccurrences 0
trialAmount 0
amount 1
refId 15
cardNumber 5424000000001500
expirationDate 2009-05
firstName Joe
lastName Dany
address Casa 1872
city City
state FL
zip 33619
country us
subscrName The Test Account
getRawResponse: HTTP/1.1 100 Continue Server: Microsoft-IIS/5.0 Date: Mon, 01 Sep 2008 09:57:32 GMT X-Powered-By: ASP.NET HTTP/1.1 200 OK Server: Microsoft-IIS/5.0 Date: Mon, 01 Sep 2008 09:57:32 GMT X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 Cache-Control: private Content-Type: text/xml; charset=utf-8 Content-Length: 409 OkI00001Successful.335320
BUT when I log in to auth.net it doesn't exist... I am in test mode, but its just not registering.. need help
RE: When I try to do a test
When your Authorize.net account is in TEST mode, no transactions are registered. However, if you take it out of test mode and submit a live transaction, you can log in to your Authorize.net account, look at the "Unsettled Transactions" to see it, and then void it so you are not actually charged.
David Parker
President
IT DevWorks, LLC
http://www.itdevworks.com
Hey Really Cool!!! The code
Hey Really Cool!!! The code works like anything. Thanks a Lot :)
Nice work.
Hello Everybody, This
Hello Everybody,
This example(sample code) was just running well but siddenly its showing me the error as
isSuccessful:
error in payment
isError: 1
getSubscriberID:
getResponse: User authentication failed due to invalid authentication values.
getResultCode:Error
getString:
Outgoing Parameters
interval_length 1
interval_unit months
startDate 2008-12-04
totalOccurrences 1
trialOccurrences 0
trialAmount 0
amount 1
refId 15
cardNumber 4111111111111111
expirationDate 1111
firstName Joe
lastName Doe
address Casa 1872
city City
state FL
zip 33619
country us
subscrName The Test Account
Can anybody tell me what is the reason of that?
Thanks,
Balu
what about 15 day trial on a 3 month occurrence ARB?
Hi i need to offer 15 day trial for an ARB that will be charged every 3 months. so here is how i set it up:
$arb->setParameter('interval_length', 3); ----------> put 3
$arb->setParameter('interval_unit', 'months');--------------> put months
$arb->setParameter('startDate', date("Y-m-d"));
$arb->setParameter('totalOccurrences', 1200);
$arb->setParameter('trialOccurrences', 1);----------------> i put 1 here but i know it is wrong
$arb->setParameter('trialAmount', 0.00);
$arb->setParameter('amount', 59.97);
$arb->setParameter('refId', '1');
$arb->setParameter('cardNumber', $_POST['number']);
$arb->setParameter('expirationDate', $expdate);
can someone help ? thanks!
How to Update and Delete Account Subscription & Post back URL
Hi Dudes,
Please let me know, How to Update and Delete Subscription Account...?
How to use Post back url ( For example : after one month duration ) recurring.php from Authorize.net? How to get response at that time?
How to Update DB Info for next time payment occurance happen...?
Its Very Critical time for me,
How to Update DB Info for next time payment occurance happen...?
Hello, anybody know how to
Hello, anybody know how to assign 15 days trial period in ARB?
"Fatal error: Call to
"Fatal error: Call to undefined function curl_init() in D:\xampp\htdocs\jjshop\AuthnetARB.class.php on line 57"
i don't know how to fit it !
thanks man