Reply
Highlighted
Member
Posts: 3
Registered: ‎08-14-2019

Register multiple webhooks for multiple application

Hi,

 

I am using Accept Host along with Webhook to update the customer's payments in two application. 

 

Both of webhooks in both projects are for "net.authorize.payment.authcapture.created" event.

 

My question is how AuthorizeNet will call back my two endpoints.  Is it going to call both webhooks on every "net.authorize.payment.authcapture.created" event. 

 

Is there any way I can distinguish these two?

 

Thanks

Highlighted
All Star
Posts: 727
Registered: ‎11-05-2018

Re: Register multiple webhooks for multiple application

@inchol

Webhooks work like this-

You set up an endpoint and enroll in events. Every single event that you enroll in will generate a webhook that will be sent to that endpoint. The events are tied to an auth.net account. So to answer your question, if the same auth.net credentials are tied to both endpoints and you enroll in that event twice, both endpoints will receive a webhook.

To distinguish the 2, one way is to have a separate auth.net account for each endpoint. That will put the separation on auth.nets end. This is probably not what you look to do. The other way is to pass something in your hosted form API call and then retrieve it with a getTransactionDetails method call. There are many fields you can use, including the invoice number, description, po number, merchant name, etc (double check me on retrieving the merchant name, never had to do that).

So you pass this in the API call, and when the webhook comes you pull the transaction. Say for instance you pass an invoice number. Invoice for application A will have an A at the beginning, say A12345 is the invoice number. Invoice for application B will have an invoice number of B12345.

Your authcapture event for application A will trigger an event to both endpoints. You write code on endpoint A to process any orders with invoice starting with A and disregard orders starting with B. You do vice-versa for endpoint B.