Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
442 views
in Technique[技术] by (71.8m points)

php - Should I be using webhooks with PayPal's V2 API?

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:

PayPalExceptionPayPalConnectionException
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

question from:https://stackoverflow.com/questions/65938345/should-i-be-using-webhooks-with-paypals-v2-api

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...