Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Authorize.net Automatic Recurring Billing successful transaction response

Posted on 2011-10-10
7
Medium Priority
?
724 Views
Last Modified: 2012-05-12
I am building a simple PHP app where people can signup for an online subscription service.  I  used the Authorize.net API for AIM before, to process one time charges and it went really well.  But the code for AIM had a conditional statement at the end.
if ($response->approved) {  Then process the order... }

Open in new window


I don't see anything like that in their ARB API.  So I am stuck not knowing if the transaction was successful or not.  Below is the code that I'm using.  Any ideas on what the equivalent code would look like that would return a success or failure message for ARB?  I know that it doesn't actually charge the card at the time of transaction, so maybe that's the problem?  But it's my understanding that it's at least supposed to see if the funds, or credit is available.  I hope that makes sense?
require_once 'anet_php_sdk/AuthorizeNet.php'; // Make sure this path is correct.
define("AUTHORIZENET_API_LOGIN_ID", $loginname); 
define("AUTHORIZENET_TRANSACTION_KEY", $transactionkey);

$subscription = new AuthorizeNet_Subscription; 
$subscription->name = "World Trade Press Subscription"; 
$subscription->intervalLength = $duration; 
$subscription->intervalUnit = "months"; 
$subscription->startDate = $begin_date; 
$subscription->totalOccurrences = $occurrences;
$subscription->amount = $total; 
$subscription->creditCardCardNumber = $card_number; 
$subscription->creditCardExpirationDate= $exp_date; 
$subscription->creditCardCardCode = $card_code; 
$subscription->billToFirstName = $first_name; 
$subscription->billToLastName = $last_name; 
// Create the subscription. 
$request = new AuthorizeNetARB; 
$response = $request->createSubscription($subscription); 
$subscription_id = $response->getSubscriptionId();

Open in new window

0
Comment
Question by:mevin
  • 3
  • 2
  • 2
7 Comments
 
LVL 29

Assisted Solution

by:coreybryant
coreybryant earned 400 total points
ID: 36948634
I can't help you out on the code but I imagine you have checked out Authorize.Net Sample Code on Authorize.net website.  Another good article to read is Authorize.net PHP Recurring Billing API that might be able to help you.

Since you did say you are not posting a sale but a pre-auth - I just wanted to ask why.  Pre-auths are only good for a few business days and they will charge you a transaction fee twice (one for the pre-auth and once for the post-auth / sale).    (Maybe the code mentions pre-auth, and if it does, that is what you need to do)

The Quantum Gateway is a bit better are recurring billing - they don't charge for their gateway, recurring billing, a transaction fee or extra fraud features.  Plus it allows you to charge a higher (or lower) amount one month if necessary.  I just mention their gateway because if Authorize.net is still charging for their gateway and ARB, that was about $35 or so and that money could be saved.  
0
 
LVL 17

Accepted Solution

by:
nanharbison earned 1600 total points
ID: 36949870
Authorize.net sends you back code if the transaction was successful, you just have to grab it. I always use a class for ARB, by John Conde, you can find it as a link on this page, which is a tutorial in using it
http://www.johnconde.net/blog/tutorial-integrate-the-authorize-net-arb-api-with-php/
0
 
LVL 17

Expert Comment

by:nanharbison
ID: 36949887
And, by the way, if you happen to be using Godaddy as a host, they have a special set of cURL settings which must be used, or they used to. Try it first and if it doesn't work, let us know.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Author Comment

by:mevin
ID: 36950497
Thanks for the advice all around.  I didn't know that Authorize charges twice?  I'll have to look into that.  My company has all of it's ecommerce transactions going through them, so that may be something beyond my control.

I'm going to work through the John Conde tutorial and see if that solves my problem,  and then assign points accordingly.

Thanks,

Mark
0
 
LVL 29

Expert Comment

by:coreybryant
ID: 36951389
To answer the question re: charging twice, this is done because you are basically using the gateway twice - maybe Friday for the pre-authorization, and then Monday for the post-authorization / sale.  You can get around this by not verifying the funds, but of course you are taking the risk.  

(The link I provided should be the same - it was also written by Conde).
0
 
LVL 1

Author Comment

by:mevin
ID: 36952269
Corey,

Sorry, but I didn't look at the links you provided carefully enough.  I thought that what you linked to was just authorize.net documentation, else I would have given you more points.

My bad.  I'll be more careful next time.

Mark
0
 
LVL 29

Expert Comment

by:coreybryant
ID: 36952412
No worries, he just has a few different sites.  The main thing is you got it and hopefully you understand a bit more about the pre-auths.

Good luck!
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Original post  on Monitis Blog. Web performance monitoring is broken into two camps: passive and active. Passive monitoring is defined as looking at real-world historical performance by monitoring actual log-ins, site hits, clicks, requests for …
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question