【问题标题】:How to configure Authorize.Net webhooks如何配置 Authorize.Net webhook
【发布时间】:2017-02-19 15:55:06
【问题描述】:

我已经为我的客户要求配置了 Authorize.net接受托管 付款方式,除了交易响应之外,一切正常。根据 Authorize.net,响应仅来自以下任一方式,webhooksCommunicatorUrl。 CommunicatorUrl 不适用于我的代码。所以,选择了 webhook。下面是我的代码。请给我一些建议。

我的疑问是:

  1. 我的代码在调用可用 webhook 列表时显示此错误

    { "status": 405, "reason": "Method Not Allowed", "message": "The requested resource does not support http method 'POST' for given parameters.", "correlationId": "ff90ee25-0ba7-4006-bb1e-225ea64897e3" }

  2. 我应该在商户面板的任何位置配置 webhook

  3. 如何使用 webhook 获得交易响应

      <?php
      $login_transKey = 'xxx:xxx'; //Login and Transaction Key of Authorize.net
      $jsonObj = '{
        "name": "Get WebHooks",
        "request": {
            "url": "http://localhost:81/hosted_payment_form/webhookstwo.php",
            "method": "GET",
            "header": [
                {
                    "key": "Content-Type",
                    "value": "application/json",
                    "description": ""
                },
                {
                    "key": "Authorization",
                    "value": "'.$login_transKey.'",
                    "description": ""
                }
            ],
            "body": {
                "mode": "formdata",
                "formdata": []
            },
            "description": ""
        },
        "response": []
    }';
    $jsonObj = json_encode($jsonObj);
    $url = "https://apitest.authorize.net/rest/v1/eventtypes";      
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonObj);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, false );
    $content = curl_exec($ch);
    echo '<pre>'; print_r($content); die();
    curl_close($ch);
    ?>
    

请告诉我更多信息。

【问题讨论】:

  • 您的 URL 不能使用 localhost。 Authorize.Net 无法访问它。
  • 可能是。但我已经在我的本地系统中使用“接受托管”,通过重定向到提到的本地 url,它执行得很好,我保留了 $_REQUEST 和一些设计。设计显示很好。但没有数据进入 $_REQUEST。虽然,我尝试将代码上传到服务器但没有结果。除了 webhooks 的概念,我已经通过了“iCommunicator.html”的代码,其中 event-Listener 可用于名为“message”的事件。但我不知道该事件“消息”是如何被触发的。

标签: php webhooks authorize.net php-curl authorize.net-webhooks


【解决方案1】:

您需要在 authorize.net 帐户中指定 webhook URL。

您还需要在设置页面中选择事件。

请确保 Web-hook URL 始终返回 HTTP 200 响应。 否则会自动变为Inactive状态。

【讨论】:

    猜你喜欢
    • 2019-03-08
    • 2017-05-12
    • 2019-12-14
    • 2021-07-31
    • 1970-01-01
    • 2018-01-15
    • 1970-01-01
    • 1970-01-01
    • 2017-08-01
    相关资源
    最近更新 更多