Showing results for 
Search instead for 
Did you mean: 

Membership Site (Recurring Payments) With ARB



In my site Recurring payment need to done. I have also used ARB for my last Projects for recurring payment.

But this time I need Payment amount like below.


For the 1st month  $99.95 will charge while signup for  that month. And later on means for the next month user will be going to charge the $79.95.


But I had not done this type of ARB transaction before with two differnt amount with signup.


Please some one will guide me for this.



Since ARB is usually combined with AIM anyway, can't you just charge $99.95 immediately using AIM, then start the ARB subscription next month at $79.95 per month? If that isn't sufficient, you should do a find in the ARB documentation for the words "trial period".


Hi TJPride,


Thanks I got the Triad period Variables and passed like as follows.


Amount: $79.95
Interval Length: 1
Interval Unit: months
Start Date: <30 days ahead of current-date>
Total Occurrences: 999
Trial Occurrences: 1
Trial Amount: $99.95


Now also I had upload it on server but I am getting below error:


Response Code: Error
Response Reason Code: E00027
Response Text: The test transaction was not successful. (79) The driver's license number is invalid.


I am using my Test Account details to Check this ARB transaction.

I am not understand why this error is occuring? Will u please let me know how do I resolve it.


Thanks ,

Sangeeta Gaikar



Post the exact code you're using to submit the transaction, using a code box (fourth option from the left in Rich Text mode). Change your login ID and transaction key to ****, of course.

Hi ,


I have not understood your reply.


Below is the code I am using. This is downloaded from Sample code form only. 


include ("data.php");
include ("authnetfunction.php");
#echo "<pre>"; print_r($_SESSION); echo "</pre>";exit;

$ord_qry = "SELECT MemFN ,MemLN ,MemEmail,MemCCType ,MemCCNo ,MemCVV ,MemCCName ,MemBillAdd ,MemBillCity ,MemBillState ,MemBillZip ,MemCCExpMonth ,MemCCExpYear ,MemDOB ,MemSOC ,MemSign ,MemSignupAmt ,MemDate ,MemStatus ,MemSubStartDate from ". TABLE_MEMBER ." where MemID='".$_SESSION['OrdMemID']."' Limit 1";
$order_rs= mysql_query($ord_qry);
$order_values = mysql_fetch_assoc($order_rs);

//define variables to send
$amount = '79.95';
$refId = 'REFFID'.$_SESSION['OrdMemID'];
$name = ' Work Fee';
$length = 1;
$unit = 'months';
$startDate = $order_values['MemSubStartDate'];
$totalOccurrences = 999;
$trialOccurrences = 1;
$trialAmount = $order_values['MemSignupAmt'];
$cardNumber = $order_values['MemCCNo'];
$expirationDate = $order_values['MemCCExpYear'].'-'.$order_values['MemCCExpMonth'];
$cardCode= $order_values['MemCVV'];
$firstName = $order_values['MemFN'];
$lastName = $order_values['MemLN'];
$address = $order_values['MemBillAdd'];
$city = $order_values['MemBillCity'];
$state = $order_values['MemBillState'];
$zip = $order_values['MemBillZip'];
$country = 'USA';

$loginname="87PW9rVqK"; //API_LOGIN_ID
$host = "";
$path = "/xml/v1/request.api";

echo "Results <br><br>";

//build xml to post
$content =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" .
"<ARBCreateSubscriptionRequest xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\">" .
"<name>" . $loginname . "</name>".
"<transactionKey>" . $transactionkey . "</transactionKey>".
"<refId>" . $refId . "</refId>".
"<name>" . $name . "</name>".
"<length>". $length ."</length>".
"<unit>". $unit ."</unit>".
"<startDate>" . $startDate . "</startDate>".
"<totalOccurrences>". $totalOccurrences . "</totalOccurrences>".
"<trialOccurrences>". $trialOccurrences . "</trialOccurrences>".
"<trialAmount>" . $trialAmount . "</trialAmount>".
"<cardNumber>" . $cardNumber . "</cardNumber>".
"<expirationDate>" . $expirationDate . "</expirationDate>".
"<cardCode>" . $cardCode . "</cardCode>".
"<firstName>". $firstName . "</firstName>".
"<lastName>" . $lastName . "</lastName>".
"<address>" . $address . "</address>".
"<city>" . $city . "</city>".
"<state>" . $state . "</state>".
"<zip>" . $zip . "</zip>".
"<country>" . $country . "</country>".

//send the xml via curl
$response = send_request_via_curl($host,$path,$content);
//if curl is unavilable you can try using fsockopen
$response = send_request_via_fsockopen($host,$path,$content);

//if the connection and send worked $response holds the return from
if ($response)
a number of xml functions exist to parse xml results, but they may or may not be avilable on your system
please explore using SimpleXML in php 5 or xml parsing functions using the expat library
in php 4
parse_return is a function that shows how you can parse though the xml return if these other options are not avilable to you
list ($refId, $resultCode, $code, $text, $subscriptionId) =parse_return($response);

echo " Response Code: $resultCode <br>";
echo " Response Reason Code: $code<br>";
echo " Response Text: $text<br>";
echo " Reference Id: $refId<br>";
echo " Subscription Id: $subscriptionId <br><br>";
echo " Data has been written to data.log<br><br>";
echo $loginname;
echo "<br />";
echo $transactionkey;
echo "<br />";
echo "amount:";
echo $amount;
echo "<br \>";

echo "refId:";
echo $refId;
echo "<br \>";

echo "name:";
echo $name;
echo "<br \>";

echo "amount: ";
echo $HTTP_POST_VARS[amount];
echo "<br \>";
echo "<br \>";
echo $content;
echo "<br \>";
echo "<br \>";

$fp = fopen('data.log', "a");
fwrite($fp, "$refId\r\n");
fwrite($fp, "$subscriptionId\r\n");
fwrite($fp, "$amount\r\n");

echo "Transaction Failed. <br>";


Ick. My guess is you're giving the fields out of order somehow - order matters with XML. What you should do, however, rather than going the painful route and submitting XML requests, is use the PHP API that sits on top of the XML. Makes life a lot easier. Look in your PHP SDK in the folder doc for a file called ARB.markdown. That will give you some sample code to get started with. Here's a somewhat expanded example for creating a subscription, though you will of course need to edit the code to fill in your values:


$authorize = new AuthorizeNetARB(
    $GLOBALS['_authorize_id'], $GLOBALS['_authorize_key']);

$subscription = new AuthorizeNet_Subscription;

$subscription->customerId = $idn;

$subscription->billToFirstName = $_POST['first'];
$subscription->billToLastName = $_POST['last'];
$subscription->billToCompany = $_POST['company'];
$subscription->billToAddress = $_POST['address'];
$subscription->billToCity = $_POST['city'];
$subscription->billToState = $_POST['state'];
$subscription->billToZip = $_POST['zip'];
$subscription->billToCountry = 'US';

$subscription->customerPhoneNumber = $_POST['phone'];
$subscription->customerEmail = $_POST['email'];

$subscription->name = "{$_POST['type']} Subscription";
$subscription->orderDescription = 'Put your description here.';
$subscription->amount = $_POST['price'];

$subscription->startDate = $_POST['payment_due'];
$subscription->intervalLength = '1';
$subscription->intervalUnit = 'months';
$subscription->totalOccurrences = '9999';

$subscription->creditCardCardNumber = $_POST['card_number'];
$subscription->creditCardExpirationDate = sprintf('%04d-%02d', $_POST['card_exp_year'], $_POST['card_exp_month']);
$subscription->creditCardCardCode = $_POST['card_ccv'];

$result = $authorize->createSubscription($subscription);

if ($result->xml->messages->resultCode != 'Ok') {
    // Generate error
else {
    // Add subscription to database