我已经配置了Authorize.net,接受我的客户要求的托管付款方式,除了交易响应之外,一切都很好。根据 Authorize.net,响应只能通过webhook或CommunicatorUrl这两种方式中的一种。CommunicatorUrl 不适用于我的代码。所以,选择了 webhook。下面是我的代码。请给我一些建议。
我的疑问是:
我的代码在调用可用 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" }
我应该在商家面板的任何地方配置 webhook
我如何使用 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); ?>
请让我知道更多信息。