3

I have a Laravel website which is using PayPal's webhooks to be notified when a payment is received. This was all working fine until we a 404 error was returned from the following API endpoint:

PayPal\Exception\PayPalConnectionException
Got Http response code 404 when accessing https://api.paypal.com/v1/notifications/verify-webhook-signature.

After some investigation this issue solved itself, I'm assuming a problem at PayPal. When reviewing the incident, its highlighted on PayPal's website and repositories that V1 of PayPal's API is depreciated. One of our initial thoughts was that PayPal could have turned off V1 of the API. But this ultimately wasn't the case.

I'm assuming the endpoint above is a V1 depreciated endpoint for the rest of this question. As it contains 'v1' in the URL.

To be safe, we felt it best to upgrade to use the V2 API. But with PayPal's documentation, this is proving to be harder than expected. To use webhooks I'm under the impression you need to verify the signature. We are doing this using VerifyWebhookSignature from the https://github.com/paypal/PayPal-PHP-SDK. This is also a depreciated repository.

Rough example here (depreciated), https://github.com/paypal/PayPal-PHP-SDK/blob/master/sample/notifications/ValidateWebhookEvent.php

So if you go to the PayPal developers API homepage, https://developer.paypal.com/docs/api/overview/ then scroll this page to 'Webhooks' it takes you to a V1 API page, https://developer.paypal.com/docs/api/webhooks/v1/.

So my question is should I still be using webhooks with PayPal if the V1 API is depreciated? are their alternative/better solutions?

Related: PHP verify Paypal webhook signature

alexmcfarlane
  • 1,016
  • 2
  • 13
  • 33

1 Answers1

2

The general-purpose PayPal-PHP-SDK deprecated. If you need an SDK for payments, use the Checkout-PHP-SDK (for the v2/checkout/orders API)

There is no supported SDK for Webhooks, integrate directly. Webhooks use a v1 URL, there is no v2 webhooks.


v1 endpoints in general are not deprecated, unless a newer version exists

v1/payments in particular is deprecated, because v2/payments and the functionality moved to v2/checkout/orders exist

Preston PHX
  • 27,642
  • 4
  • 24
  • 44
  • Thanks, I think that was what I was thinking. But to clarify, Webhooks use a v1 URL which is part of the v1 API therefore depreciated? so they no longer provide support for webhooks? – alexmcfarlane Jan 28 '21 at 14:11
  • 1
    The v1/payments API is deprecated. Other v1 APIs are their own thing – Preston PHX Jan 28 '21 at 14:25
  • That explains it (if not a bit confusing from PayPal's side). Do you want to clarify that in your answer 'v1/payments API is deprecated. Other v1 APIs are their own thing'? as I think that will answer my whole query fully and help other people. Then I can give you the accepted answer. – alexmcfarlane Jan 28 '21 at 14:47