简体   繁体   English

PayPal:验证 PHP 中的 webhook 通知

[英]PayPal: Verify webhook notifications in PHP

PayPal's documentation is pretty bad, but they do have a PHP notification verification sample here which mentions: PayPal 的文档非常糟糕,但他们确实有一个 PHP 通知验证示例其中提到:

PHP Currently does not support certificate chain validation, that is necessary to validate webhook directly, from received data. PHP 目前不支持证书链验证,这是从接收到的数据中直接验证 webhook 所必需的。 To resolve that, we need to use alternative, which makes a call to PayPal's verify-webhook-signature API.为了解决这个问题,我们需要使用替代方法,它调用 PayPal 的 verify-webhook-signature API。

It also includes some files that aren't within the Checkout SDK.它还包括一些不在 Checkout SDK 中的文件。 I found this question from a year ago in which someone created what seems like a decent explanation of all of the various missing packages and files that aren't included in the base SDK.我从一年前发现了这个问题,其中有人对基本 SDK 中未包含的所有各种丢失的包和文件进行了似乎不错的解释。

One of the key parts of their answer was to install a separate PayPal SDK, which they don't mention anywhere in the documentation, via composer (without mentioning its package name).他们的答案的关键部分之一是安装一个单独的 PayPal SDK,他们没有在文档中的任何地方通过作曲家提到它(没有提到它的 ZEFE90A8E604A7C840E88D03A67F6B7D8 名称)。 Luckily composer has decent recommendations to my incorrect attempts at finding it so I got it eventually with: composer require paypal/rest-api-sdk-php .幸运的是,composer 对我寻找它的错误尝试提出了不错的建议,所以我最终得到了它: composer require paypal/rest-api-sdk-php Looking through the files it downloaded, it's clear that this is the package that the Paypal documentation I listed above is including.查看它下载的文件,很明显这是我上面列出的 Paypal 文档包含的 package。 However, upon requiring it I got the message但是,在要求时,我收到了消息

Package paypal/rest-api-sdk-php is abandoned, you should avoid using it. Package paypal/rest-api-sdk-php 已弃用,应避免使用。 No replacement was suggested.没有建议更换。

This seems pretty cut and dry, that it's not future safe and I shouldn't use it, but what am I supposed to do instead?这看起来很简单,它对未来不安全,我不应该使用它,但我应该怎么做呢? Is there some new SDK somewhere I should be looking at or have they just given up on PHP and I have to just start making direct hand crafted API calls?是否有一些新的 SDK 我应该在某个地方查看,或者他们刚刚放弃了 PHP 而我必须开始直接手工制作 API 调用?

There is no supported SDK for webhooks -- not for PHP, nor for any other environment. webhook 不支持 SDK -- 不支持 PHP,也不支持任何其他环境。 Use a direct HTTPS integration.使用直接 HTTPS 集成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM