【问题标题】:HTTP/1.1 405 Method Not Allowed Allow authorized.netHTTP/1.1 405 Method Not Allowed 允许 authorized.net
【发布时间】:2014-08-31 16:31:05
【问题描述】:

我正在magento中创建authorized.net的定期订阅。我成功创建了订阅。我添加了一个取消订阅并传递xml的选项,但它不接受。

                $loginname="******";
            $transactionkey="*******";
            $host = "apitest.authorize.net";

                    $content=
                    "<?xml version=\"1.0\" encoding=\"utf-8\"?>".
                    "<ARBCancelSubscriptionRequest xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\">".
                    "<merchantAuthentication>".
                    "<name>" . $loginname . "</name>".
                    "<transactionKey>" . $transactionkey . "</transactionKey>".
                    "</merchantAuthentication>" .
                    "<subscriptionId>" . 2179811  . "</subscriptionId>".
                    "</ARBCancelSubscriptionRequest>";

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

这是不允许的405方法。请帮助!

【问题讨论】:

  • 我还在调查中。请大家帮忙!

标签: xml magento authorize.net recurring-billing http-status-code-405


【解决方案1】:

最后我通过修改我的代码来解决它。基本上问题出在标题上

`public function cancelSubscriptionAction()
        {
                $xml_str ='<?xml version="1.0" encoding="utf-8"?>
                <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
                <soap:Body>
                <ARBCancelSubscription xmlns="https://api.authorize.net/soap/v1/">
                <merchantAuthentication>
                <name>******</name>
                <transactionKey>******</transactionKey>
                </merchantAuthentication>
                <subscriptionId>******</subscriptionId>
                </ARBCancelSubscription>
                </soap:Body>
                </soap:Envelope>';

                $headers = array( 
                'Content-Type: text/xml; charset="utf-8"', 
                'Content-Length: '.strlen($xml_str), 
                'Accept: text/xml', 
                'Cache-Control: no-cache', 
                'Pragma: no-cache', 
                ); 

                $remote_url = 'https://apitest.authorize.net/soap/v1/Service.asmx';
                $process = curl_init($remote_url);
                curl_setopt($process, CURLOPT_HTTPHEADER, $headers);
                curl_setopt($process, CURLOPT_HEADER, 1);
                curl_setopt($process, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
                curl_setopt($process, CURLOPT_TIMEOUT, 30);
                curl_setopt($process, CURLOPT_POST, 1);
                curl_setopt($process, CURLOPT_POSTFIELDS, $xml_str);
                curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
                $return = curl_exec($process);
                $finale = list ($resultCode, $code, $text, $subscriptionId) =parse_return($return);
                print_r($finale );
                curl_close($process);

        }`

【讨论】:

    猜你喜欢
    • 2021-01-21
    • 2017-07-05
    • 2021-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-12
    • 1970-01-01
    • 2015-01-20
    相关资源
    最近更新 更多