Authorized Dot net ARB 2nd time payment notification on website

319 views Asked by At

I have created a membership with Authorized dot net ARB. I am able to create any member while running ARB script. But how may I know after 2nd time payment. Is there any other way excluding email by which Authorized dot net will directly throw an url after every transaction happen during ARB duration from Authrized Dot net directly and the membership on my site will be renewed automatically on my website.

This is the URL from where I downloaded ARB Codes and implemented subscription.

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

Here is the HTML and PHP code as follows.

HTML Form

 <form method="post" action="subscription_create.php">
            <table width="35%" border="0">
                <tr>
                    <td>
                        <b><font size="2" face="arial">Create Subscription</font><br>
                        <br></b>
                    </td>
                    <td></td>
                </tr>
                <tr>
                    <td>
                        <font size="2" face="arial">Reference Id</font>
                    </td>
                    <td>
                        <input type="text" name="refId" value=''> <font size="1" face="arial">MAX = 20 chars</font>
                    </td>
                </tr>
                <tr>
                    <td>
                        <font size="2" face="arial">Subscription Name</font>
                    </td>
                    <td>
                        <input type="text" name="name" value=''>
                    </td>
                </tr>
                <tr>
                    <td>
                        <font size="2" face="arial">Subscription Length</font>
                    </td>
                    <td>
                        <input type="text" name="length" value=''> <font size="1" face="arial">1 - 12 or 7 - 365</font>
                    </td>
                </tr>
                <tr>
                    <td>
                        <font size="2" face="arial">Subscription Unit</font>
                    </td>
                    <td>
                        <input type="text" name="unit" value=''> <font size="1" face="arial">months or days</font>
                    </td>
                </tr>
                <tr>
                    <td>
                        <font size="2" face="arial">Start Date</font>
                    </td>
                    <td>
                        <input type="text" name="startDate" value=''> <font size="1" face="arial">YYYY-MM-DD</font>
                    </td>
                </tr>
                <tr>
                    <td>
                        <font size="2" face="arial">Total Occurrences</font>
                    </td>
                    <td>
                        <input type="text" name="totalOccurrences" value=''> <font size="1" face="arial">MAX = 9999</font>
                    </td>
                </tr>
                <tr>
                    <td>
                        <font size="2" face="arial">Trial Occurrences</font>
                    </td>
                    <td>
                        <input type="text" name="trialOccurrences" value=''> <font size="1" face="arial">0 = None. MAX = 99</font>
                    </td>
                </tr>
                <tr>
                    <td>
                        <font size="2" face="arial">Amount</font>
                    </td>
                    <td>
                        <input type="text" name="amount" value=''>
                    </td>
                </tr>
                <tr>
                    <td>
                        <font size="2" face="arial">Trial Amount</font>
                    </td>
                    <td>
                        <input type="text" name="trialAmount" value=''> <font size="1" face="arial">0 = None</font>
                    </td>
                </tr>
                <tr>
                    <td>
                        <font size="2" face="arial">Credit Card Number</font>
                    </td>
                    <td>
                        <input type="text" name="cardNumber" value=''>
                    </td>
                </tr>
                <tr>
                    <td>
                        <font size="2" face="arial">Expiration Date</font>
                    </td>
                    <td>
                        <input type="text" name="expirationDate" value=''> <font size="1" face="arial">YYYY-MM</font>
                    </td>
                </tr>
                <tr>
                    <td>
                        <font size="2" face="arial">First Name</font>
                    </td>
                    <td>
                        <input type="text" name="firstName" value=''>
                    </td>
                </tr>
                <tr>
                    <td>
                        <font size="2" face="arial">Last Name</font>
                    </td>
                    <td>
                        <input type="text" name="lastName" value=''>
                    </td>
                </tr>
                <tr>
                    <td>
                        <br>
                        <input type="submit" name="submit" value="Submit"><input type="reset" name="reset" value="Reset">
                    </td>
                    <td></td>
                </tr>
            </table>
        </form>

Php Code

 include ("authnetfunction.php");

    $amount = $_POST["amount"];
    $refId = $_POST["refId"];
    $name = $_POST["name"];
    $length = $_POST["length"];
    $unit = $_POST["unit"];
    $startDate = $_POST["startDate"];
    $totalOccurrences = $_POST["totalOccurrences"];
    $trialOccurrences = $_POST["trialOccurrences"];
    $trialAmount = $_POST["trialAmount"];
    $cardNumber = $_POST["cardNumber"];
    $expirationDate = $_POST["expirationDate"];
    $firstName = $_POST["firstName"];
    $lastName = $_POST["lastName"];

    $loginname = [LOGIN-NAME];
    $transactionkey = [TRANSACTION-KEY];

    echo "Results <br><br>";


    $content =
            "<?xml version=\"1.0\" encoding=\"utf-8\"?>" .
            "<ARBCreateSubscriptionRequest xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\">" .
            "<merchantAuthentication>".
            "<name>" . $loginname . "</name>".
            "<transactionKey>" . $transactionkey . "</transactionKey>".
            "</merchantAuthentication>".
            "<refId>" . $refId . "</refId>".
            "<subscription>".
            "<name>" . $name . "</name>".
            "<paymentSchedule>".
            "<interval>".
            "<length>". $length ."</length>".
            "<unit>". $unit ."</unit>".
            "</interval>".
            "<startDate>" . $startDate . "</startDate>".
            "<totalOccurrences>". $totalOccurrences . "</totalOccurrences>".
            "<trialOccurrences>". $trialOccurrences . "</trialOccurrences>".
            "</paymentSchedule>".
            "<amount>". $amount ."</amount>".
            "<trialAmount>" . $trialAmount . "</trialAmount>".
            "<payment>".
            "<creditCard>".
            "<cardNumber>" . $cardNumber . "</cardNumber>".
            "<expirationDate>" . $expirationDate . "</expirationDate>".
            "</creditCard>".
            "</payment>".
            "<billTo>".
            "<firstName>". $firstName . "</firstName>".
            "<lastName>" . $lastName . "</lastName>".
            "</billTo>".
            "</subscription>".
            "</ARBCreateSubscriptionRequest>";



    $response = send_request_via_curl($host,$path,$content);




    if ($response)
    {
        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 \>";

    }
    else
    {
        echo "Transaction Failed. <br>";
    }

enter image description here

1

There are 1 answers

2
John Conde On

Silent Post* is Authorize.Net's version of Paypal's IPN. Whenever a payment is made, regardless of how it was made, a notification will be sent via Silent Post to notify the merchant of the payment.

*I am the author of that article