1

在授权点网 ARB 上付款成功后,如何添加第二次直接邮寄方式。让我详细说明

假设用户订阅会员,网站也会要求捐款。在 ARB(XML 版本)上支付会员费后,我如何通过 Authorized dot net 再次支付一次捐款。我尝试使用 ARB 并得到重复输入错误。让我在此处粘贴代码以获取更多详细信息。

我使用的 ARB 代码

        $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")
                        {}
                    }                           

                }



            }
        }

这是我在两次尝试 ARB 脚本以第二次支付时使用的代码,但我认为这不是正确的过程,所以我收到重复输入的错误。谁能帮我提供 Direct Post 方法的 XML CUrl 代码,例如我使用的 ARB XML Curl。经过大量搜索,我没有找到任何合适的例子。

4

0 回答 0