cancel
Showing results for 
Search instead for 
Did you mean: 

Questions regarding transactions

Hello. I am writing a system for my company and I am needing to know the following.

 

1. Does unsettled means that the credit card is valid, but won't be charged until the end of the day? Or does it means that the card may or may not be valid and it will be checked and charged at the end of the day?

2. With subscriptions, if start date is specified as today and number of occurrances is 2 with once a month. Will it be charged today when every other transaction is settled, or will it be the next month that it is charged? I know you cannot set start date before today, so I am wondering.

3. For subscriptions, in order to know if it was successful or failed, do I have to use a Silent Post URL? Is there example code to parse the posts to the URL?

4. When a charge fails, would the Silent Post URL let me know of the faild transaction?

 

Thanks.

ACSC_Dev
Member
3 REPLIES 3

1. When you successfully capture a transaction, the transaction has been considered valid and is waiting for the next settlement batch run, whenever you've configured that (I believe you can change batch frequency, time of day).  So I believe the former. Not precisely sure if the money actually leaves their account on capture or on settlement, however, and this only applies to single charges, not ARB subscriptions (since you don't know if the card is going to work until the first charge goes through - could expire or have insufficient balance or whatever).

 

2. Depends on when the batch processing runs, vs what time of day it is now. If you're already past the processing time, it probably won't run until next month. Generally better to do the first charge with AIM if working with ARB, that way you have the first charge processed immediately and can be sure everything is working. Or better yet, use CIM with an automated process for successive charges.

 

3. Yes, if you want your web site to know automatically. Here's something to start from, though you'll need to add some way to distinguish ARB payments from AIM payments or payments processed manually through the control panel:

 

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

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

// Don't want some of these fields logged, for security reasons
// Others are unnecessary for my uses and clutter things up
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]);

// Log remaining $_POST info to file
fwrite($handle, print_r($_POST, true));

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

if (!$link = db_connect())
    fwrite($handle, "Unable to connect to database.\n");

elseif ($_POST['x_response_code'] == 1 && $_POST['x_cust_id']) {
    $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, "Bad response code and/or missing customer ID.\n");
?>

 4. It should. You could add code to the above to test for that and do something, like send the customer an email, though you should already receive an email yourself and Authorize.net -may- send them one already on failure. I'm not sure because I haven't had a subscription fail yet.

TJPride
Expert

Thanks for the response. I think I will do as you suggested and set the start date as the next months payment date and then charge their card using AIM before hand just to be sure we get the first payment. I have a test url post to send me an email with every variable available whenever authroize calls it. However I have not received it yet. I would guess it waits for it to be settlled, if not it must be certificates and I have contacted authorize at developer@authorize.net to ask about this. I wish there was a way to tell it send a test now rather than me waiting for something to settle or for a ARB to charge.

I don't think it waits for settlement, because AIM charges come through instantly. Just test with AIM, the output fields will be almost identical.