用于 Paypal Webhooks 的 PHP 监听器脚本

标签 php json paypal webhooks paypal-webhooks

我在为 Paypal 通知网络 Hook 编写 PHP 监听器脚本时遇到问题。我只需要一个脚本来监听和请求 Paypal json 数据。由于大量的在线文档,我已经成功地为 Stripe 创建了一个。这是我的:

<?php require_once('./lib/Stripe.php');
    Stripe::setApiKey("my_secret_stripe_key");

    $input = @file_get_contents("php://input");
    $event_json = json_decode($input);

    // then I request the json data from a Stripe event... //
    $event_json->type == 'charge.succeeded'
    // etc... //
?>

我只需要类似的东西来处理 Paypal 事件 json。

最佳答案

PayPal 刚刚发布了一个新版本,PayPal PHP-SDK 1.4.0; 这有一个 webhook 监听器。

https://github.com/paypal/PayPal-PHP-SDK/releases/tag/v1.4.0

文件是ValidateWebhookEvent.php

它在示例中。
Paypal -PHP-SDK/paypal/rest-api-sdk-php/sample/notifications/ValidateWebhookEvent.php

文档在这里
https://github.com/paypal/PayPal-PHP-SDK/wiki/Webhook-Validation

关于用于 Paypal Webhooks 的 PHP 监听器脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29700437/

相关文章:

php - 发表评论脚本

javascript - 使用 d3 和 JSON 数据在同一页面中创建多个饼图

ios - 将 Paypal 与ios集成

javascript - 如何知道 PayPal Smart Payment Button 是否完成渲染

iOS Paypal 移动 SDK - 付款证明

php - 连接被拒绝 SQL : select * from information_schema. 表,其中 table_schema = firstdb 和 table_name = migrations 和 table_type = 'BASE TABLE

php - 使用 Group_by 获取 CodeIgniter 中的最新记录

php - Wordpress:你不能编辑这篇文章(即使我是管理员)

java - 使用gson获取子对象列表

javascript - 如何从 JSON 数组中获取特定数据?