【问题标题】:PHP Listener Script for Paypal WebhooksPaypal Webhook 的 PHP 侦听器脚本
【发布时间】:2015-06-24 09:03:57
【问题描述】:

我在为 Paypal 通知 webhook 编写 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。

【问题讨论】:

标签: php json paypal webhooks paypal-webhooks


【解决方案1】:

我使用了这个tutorial on http://code.tutsplus.com/,非常有帮助。您可能还想看看the webhook validation

【讨论】:

    【解决方案2】:

    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

    【讨论】:

      猜你喜欢
      • 2013-03-04
      • 1970-01-01
      • 2012-10-09
      • 2012-05-20
      • 2019-06-22
      • 2011-07-06
      • 1970-01-01
      • 2023-03-20
      • 1970-01-01
      相关资源
      最近更新 更多