cancel
Showing results for 
Search instead for 
Did you mean: 

Calling list of available webhook events displaying an error

Hi. I have configured Authorize.net, accept hosted payment method for my client requirement, where everything is happening fine, except Transaction response. I am using webhook event but which is displaying an error when i make request for list of available webhook events.


My doubts are:

 

  • My Code displaying this error when calling list of available webhooks

   

`{
  "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"
}`
  • Should i configure webhook anywhere in my Merchant Panel
  • How would i get my transaction response using webhook

 

Following is my code

 

 <?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);
        ?>

Please, let me know if you need anymore information.

 

ravuriauth200
Member
13 REPLIES 13

Hi Aaron,

 

I am back with good news. Everything is working fine. I deleted all additional webhooks configuration, using delete of curl functions. At moment kept two webhooks in active state, one for my custom URL, and another for requestb.in, to check immediately, if any issue comes in. 

 

I have had hardtime in tracking correct trasaction response, as there are 4 succesful trasactions at a time. so, unable to track, which trasaction id is responsible for which trasaction, because, there is no invoice id in transaction response to track. But which i got it done by Get Transaction Details function, by passing transaction ID and getting all transaction reponse and storing in database, and i have kept that same code in custom URL page, which i linked to webhook. so, trasaction data will be stored immediately after the trasaction response comes by setup webhook.

 

Currently i am working on one issue. I do not want to show up receipt page after trasaction. I wanted to redirect user to my site automatically after transaction, and i will show receipt page on my site. For that, i setup like this in xml "showReceipt":false under hostedPaymentReturnOptions, and given redirect url also. You will find my xml code in previous post in this chain. I would be more happy, if you help me with this.

 

Once again. Thank you very much Aaron. I would have not been done this unless you helped me. Thank you very much.

 

Hi @ravuriauth200,

 

The ability to suppress the receipt is only available when you're hosting the payment form in an iframe. If you're redirecting to the payment form or opening it a new window/tab, you have to use our receipt. Sorry about that.

 

That would be a useful enhancement to Accept Hosted, however, so you're welcome to post this as a new feature using our Ideas forum. This will allow others to vote on and make suggestions to improve the request.

Hi,

 

Calling https://apitest.authorize.net/rest/v1/eventtypes to get event types in java, but i am getting bad request, can you please anyone help me on this issue.

 

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;


//import com.sun.org.apache.xml.internal.security.utils.Base64;

//import org.json.simple.JSONObject;


public class webhooksrestapi {
 public static void main(String[] args) {

    try {
     String authorizationval = "";
     String loginId="***";
     String transkey="**";
     if (loginId != null && transkey != null) {
              authorization = loginId + ":" + transkey;
          }

   URL url = new URL("https://apitest.authorize.net/rest/v1/eventtypes");
   HttpURLConnection conn = (HttpURLConnection) url.openConnection();
   conn.setDoOutput(true);
   
   if (authorization != null) {
              String encodedBytes;
              encodedBytes = Base64.encode(authorization.getBytes(),0);
              authorizationheader = "Basic " + encodedBytes;
              conn.setRequestProperty("Authorization", authorization); 
   }
   

   conn.setRequestProperty("Content-Type", "application/json");
   conn.setRequestProperty("Authorization", authorizationheader);
   OutputStream os = conn.getOutputStream();
   BufferedReader br=null;
   if(conn.getResponseCode() >= 400)
   {
     br = new BufferedReader(new InputStreamReader(
      (conn.getErrorStream())));
   }
   else
   {
     br = new BufferedReader(new InputStreamReader(
     (conn.getInputStream())));
   }

   String output;
   System.out.println("Output from Server .... \n");
   while ((output = br.readLine()) != null) {
    System.out.println(output);
   }

   conn.disconnect();

    } catch (MalformedURLException e) {

   e.printStackTrace();

    } catch (IOException e) {

   e.printStackTrace();

   }

  }

}

Hi @brameshatos

 

See if this repo is helpful

 

https://github.com/dns12345/AuthNet.WebHooks

 

Thanks

Anurag





Send feedback at developer_feedback@authorize.net