dongqingchan2385 2015-04-17 13:21
浏览 120

Paypal Webhooks的PHP监听器脚本

I'm having trouble writing a PHP listener script for Paypal notification webhooks. I simply need a script to listen for and request the Paypal json data. I have created one for Stripe successfully, thanks to plenty of online documentation. This is what I have:

<?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... //
?>

I just need something similar to handle Paypal event json.

  • 写回答

2条回答 默认 最新

  • drqefnd544707688 2015-06-11 06:24
    关注

    PayPal just released a new version, PayPal PHP-SDK 1.4.0; this has a webhook listener.

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

    The file is ValidateWebhookEvent.php

    It is in the samples.
    PayPal-PHP-SDK/paypal/rest-api-sdk-php/sample/notifications/ValidateWebhookEvent.php

    The docs are here
    https://github.com/paypal/PayPal-PHP-SDK/wiki/Webhook-Validation

    评论

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用