在网站上授权Dot net ARB第二次付款通知

时间:2014-05-30 07:56:38

标签: php payment-gateway payment authorize.net authorize.net-arb

我使用授权点网络ARB创建了会员资格。我可以在运行ARB脚本时创建任何成员。但是第二次付款后怎么知道呢。还有其他任何方式排除电子邮件,授权点网将直接从Authrized Dot网络的ARB持续时间内发生每笔交易后直接抛出网址,并且我网站上的会员资格将在我的网站上自动续订。

这是我下载ARB代码和实施订阅的网址。

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

以下是HTML和PHP代码。

HTML表单

 <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 个答案:

答案 0 :(得分:1)

Silent Post *是Authorize.Net的Paypal IPN版本。无论何时付款,无论如何付款,都会通过无声邮件发送通知,通知商家付款。

*我是那篇文章的作者