dtdfl62844 2014-10-18 11:26
浏览 6

ARB过程后XML上的授权点网简单结账方法

How can I add the 2nd time Direct Post method after payment is getting succeeded on Authorized Dot Net ARB. Let me elaborate

Suppose an user will subscribe for membership and the website will ask for donation too. After payment of Membership on ARB(XML version) how may I pay again for donation one time through Authorized dot net. I tried to use ARB and got duplicate entry error. Let me paste the code here for more details.

ARB Code I used

        $SubscrName = $FirstName." ".$LastName; 
        $length = 12;
        $unit = "months";


        $totatltenure = $CardExpYear-date("Y");

        $start_date = date("Y-m-d");
        $totalOccurrences = 1*$totatltenure;
        $trialOccurrences = 0;
        $trialAmount = 0;
        $expirationDate = $CardExpYear."-".$CardExpMonth;

$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>" . $SubscrName . "</name>".
                    "<paymentSchedule>".
                        "<interval>".
                            "<length>". $length ."</length>".
                            "<unit>". $unit ."</unit>".
                        "</interval>".
                        "<startDate>" . $start_date . "</startDate>".
                        "<totalOccurrences>". $totalOccurrences . "</totalOccurrences>".
                        "<trialOccurrences>". $trialOccurrences . "</trialOccurrences>".
                    "</paymentSchedule>".
                    "<amount>". $TotalCosting ."</amount>".
                    "<trialAmount>" . $trialAmount . "</trialAmount>".
                    "<payment>".
                        "<creditCard>".
                            "<cardNumber>" . $CardNumber . "</cardNumber>".
                            "<expirationDate>" . $expirationDate . "</expirationDate>".
                            "<cardCode>".$CVV_Code."</cardCode>".
                        "</creditCard>".
                    "</payment>".
                "<billTo>".
                        "<firstName>". $CardFirstName . "</firstName>".
                        "<lastName>" . $CardLastName . "</lastName>".
                        "<address>" . $CardStreet . "</address>".
                        "<city>" . $CardCity . "</city>".
                        "<state>" . $CardState . "</state>".
                        "<zip>" . $CardZip . "</zip>".
                    "</billTo>".
                "</subscription>".
            "</ARBCreateSubscriptionRequest>";

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

            list ($refId, $resultCode, $code, $text, $subscription_id) =parse_return($response);
            if($resultCode == "Ok")
            {


                if($_SESSION['willdonate'] == 'donated' && $_SESSION['donateammount'] != '')
                {

                    $SubscrName = $FirstName." ".$LastName; 
                    $length = 2;
                    $unit = "months";

                    $totatltenure = 1;

                    $start_date = date("Y-m-d");
                    $totalOccurrences = 1;
                    $trialOccurrences = 0;
                    $trialAmount = 0;
                    $expirationDate = date("Y-m");

                    $TotalCosting = $_SESSION['donateammount'];


                    $contentDonation =
                    "<?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>" . $SubscrName . "</name>".
                            "<paymentSchedule>".
                                "<interval>".
                                    "<length>". $length ."</length>".
                                    "<unit>". $unit ."</unit>".
                                "</interval>".
                                "<startDate>" . $start_date . "</startDate>".
                                "<totalOccurrences>". $totalOccurrences . "</totalOccurrences>".
                                "<trialOccurrences>". $trialOccurrences . "</trialOccurrences>".
                            "</paymentSchedule>".
                            "<amount>". $TotalCosting ."</amount>".
                            "<trialAmount>" . $trialAmount . "</trialAmount>".
                            "<payment>".
                                "<creditCard>".
                                    "<cardNumber>" . $CardNumber . "</cardNumber>".
                                    "<expirationDate>" . $expirationDate . "</expirationDate>".
                                    "<cardCode>".$CVV_Code."</cardCode>".
                                "</creditCard>".
                            "</payment>".
                        "<billTo>".
                                "<firstName>". $CardFirstName . "</firstName>".
                                "<lastName>" . $CardLastName . "</lastName>".
                                "<address>" . $CardStreet . "</address>".
                                "<city>" . $CardCity . "</city>".
                                "<state>" . $CardState . "</state>".
                                "<zip>" . $CardZip . "</zip>".
                            "</billTo>".
                        "</subscription>".
                    "</ARBCreateSubscriptionRequest>";



                    $responseDonation = send_request_via_curl($host,$path,$contentDonation);

                    if ($responseDonation)
                    {

                        var_dump($responseDonation);
                        exit;
                        list ($refId, $resultCodeDonation, $code, $text, $subscription_id) =parse_return($responseDonation);
                        if($resultCodeDonation == "Ok")
                        {}
                    }                           

                }



            }
        }

Here is the code I have used where I tried ARB Script two times to pay 2nd time but I think this is not the right process so I get an error of Duplicate entry. Can anyone help me providing XML CUrl code of Direct Post method like ARB XML Curl I used. I didn't find any suitable example after searching a lot.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 CSAPPattacklab
    • ¥15 一直显示正在等待HID—ISP
    • ¥15 Python turtle 画图
    • ¥15 关于大棚监测的pcb板设计
    • ¥15 stm32开发clion时遇到的编译问题
    • ¥15 lna设计 源简并电感型共源放大器
    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
    • ¥15 Vue3地图和异步函数使用