Reply
Highlighted
Member
Posts: 6
Registered: ‎01-25-2012

ARB +AIM NEED HELP

Please help me with this :

 

I have few questions about ARB :

 

I am will sell some products through my web site and want the ARB. But not sure what ARB does .

 

1. Question : Does it charge the fist time then subscribe the recurring payment for the future date or only does the recurring billing .

 

2. How to cancel the subscription from the integrated website.

 

 

interme
Highlighted
Posts: 1,476
Topics: 33
Kudos: 34
Solutions: 126
Registered: ‎09-14-2009

Re: ARB +AIM NEED HELP

[ Edited ]

1.You should be using AIM to charge the first payment and then if that payment is successful use ARB to charge the future subscription payments. The first subscription payment is not processed until that evening at the earliest so it is never processed immediately. That's why you need to use AIM for the first payment to verify the payment is captured immediately and the credit card is valid before the subscription is established all while the user is still present on your website.

 

2. You can use the ARBCancelSubscriptionRequest API call to cancel the subscription through the website.


-------------------------------------------------------------------------------------------------------------------------------------------
John Conde :: Certified Authorize.Net Developer (Brainyminds) :: Official Authorize.Net Blogger

NEW! Handling Authorize.Net's Webhooks with PHP

Integrate Every Authorize.Net JSON API with One PHP Class (Sample code included)

Tutorials for integrating Authorize.Net with PHP: AIM, ARB, CIM, Silent Post
All About Authorize.Net's Silent Post
Highlighted
Member
Posts: 6
Registered: ‎01-25-2012

Re: ARB +AIM NEED HELP

Any one have a ARB
+AIM  sample

interme
Highlighted
Posts: 1,609
Topics: 15
Kudos: 201
Solutions: 121
Registered: ‎06-23-2011

Re: ARB +AIM NEED HELP

If using PHP, download the SDK:

http://developer.authorize.net/downloads/

 

Go into the doc folder inside that, look for the AIM.markdown and ARB.markdown files. They're fairly straightforward. Here's an example for silent post that I edited from one I'm using on a client site. Hopefully no syntax errors, note that you'll need to replace the database calls with whatever you use for interfacing with your database, and change the path on the log file.

 

<?php
require_once($_SERVER['DOCUMENT_ROOT'] . '/library/mysql.php');

$logfile = "{$_SERVER['DOCUMENT_ROOT']}/logs/callback.txt";
$handle = fopen($logfile, 'a');

// Eliminate fields I don't want to log
foreach (array('x_method', 'x_account_number', 'x_phone', 'x_fax', 'x_email', 'x_invoice_num', 'x_type', 'x_ship_to_first_name', 'x_ship_to_last_name', 'x_ship_to_company', 'x_ship_to_address', 'x_ship_to_city', 'x_ship_to_state', 'x_ship_to_zip', 'x_ship_to_country', 'x_tax', 'x_duty', 'x_freight', 'x_tax_exempt', 'x_po_num', 'x_cvv2_resp_code', 'x_cavv_response', 'x_test_request') as $key)
    unset($_POST[$key]);

fwrite($handle, print_r($_POST, true));

// --------------------------------------------

if ($_POST['x_response_code'] == 1 && $_POST['x_cust_id']) {
    if (!$link = db_connect()) {
        fwrite($handle, "Unable to connect to database.\n");
        exit;
    }

    // Log payment entry in database
    $query = queryMysql("
    INSERT INTO payments SET company = {company}, payment = {payment}, type = 'MONTHLY', paid = NOW()",
    array(
        company => $_POST['x_cust_id'],
        payment => $_POST['x_amount']
    ));

    if (!$result = mysql_query($query, $link))
        fwrite($handle, "ERROR: Unable to add payment record to database.\n");
    else
        fwrite($handle, "Payment record added to database.\n");

    $query = queryMysql("
    UPDATE companies SET payment_due = payment_due + INTERVAL 1 MONTH WHERE idn = {company}",
    array(
        company => $_POST['x_cust_id']
    ));

    if (!$result = mysql_query($query, $link))
        fwrite($handle, "ERROR: Unable to update company expiration date.\n");
    else
        fwrite($handle, "Company expiration date updated.\n");
}
else fwrite($handle, "ERROR: Bad response code and/or missing customer ID.\n");

// So I can see if it works when I call it myself
print 'Ran';
?>