How to link a webhook to an action (API request)?

HTMHell
Contributor
Contributor

I would like to determine if a webhook is linked to my API request, so I can avoid duplicated actions.

 

For example, if I made a partial refund via API, I immediately update that in my database.

Later, I will receive a webhook that notifies me about a refund. How can I know if that's an additional refund, or the one I created?

 

If I completely ignore webhooks, then if for example a refund is issued through PayPal, and not with my API request, then my system will not know about it.

And if I will only listen to changes with webhooks, everything will be delayed.

 

Is there any way to know?

I'm using Payments API v1 throguh PayPal-PHP-SDK

Login to Me Too
2 REPLIES 2

MTS_Chiranjeevi
Moderator
Moderator

Hi @HTMHell,

 

Thank you for contacting PayPal community.

 

Our sincere apologies for the inconvenience caused.

 

I request to please use "transaction_id" unique identifier to identify the webhooks.

 

For example, when you process a refund via API call please track the transaction ID in your internal database and once you receive PayPal webhooks event notification use the "transaction_id" to compare.

 

Detailed guide link for reference.

 

Thank you for understanding and patience.

 

Sincerely,
Chiranjeevi

PayPal, Inc.


If this post or any other was helpful, please enrich the community by giving kudos or accepting it as a solution.

 
Login to Me Too

HTMHell
Contributor
Contributor

Thanks for the reply!

I don't have a transaction_id parameter in the webhook request being sent to me.

Do you mean resource.id?

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.