php - 我无法使用 PHP 获取 webhook 数据
问题描述
请我需要帮助..我正在尝试从发送到我的应用程序的 webhook 访问数据中的值。
{
"event": "charge.completed",
"data": {
"id": 285959875,
"tx_ref": "Links-616626414629",
"flw_ref": "PeterEkene/FLW270177170",
"device_fingerprint": "a42937f4a73ce8bb8b8df14e63a2df31",
"amount": 100,
"currency": "NGN",
"charged_amount": 100,
"app_fee": 1.4,
"merchant_fee": 0,
"processor_response": "Approved by Financial Institution",
"auth_model": "PIN",
"ip": "197.210.64.96",
"narration": "CARD Transaction ",
"status": "successful",
"payment_type": "card",
"created_at": "2020-07-06T19:17:04.000Z",
"account_id": 17321,
"customer": {
"id": 215604089,
"name": "Yemi Desola",
"phone_number": null,
"email": "user@gmail.com",
"created_at": "2020-07-06T19:17:04.000Z"
},
"card": {
"first_6digits": "123456",
"last_4digits": "7889",
"issuer": "VERVE FIRST CITY MONUMENT BANK PLC",
"country": "NG",
"type": "VERVE",
"expiry": "02/23"
}
}
}
我试着这样称呼它
$postdata = file_get_contents("php://input");
$referenc = $postdata->data->tx_ref;
但它没有工作..
但如果我只调用 $postdata,我可以获得完整的记录..但我只需要一条记录
解决方案
推荐阅读
- excel - 如何使用存储在 Variant 变量中的 Range 进行复制和粘贴?
- django - 将 ParentalKey 链接到 Wagtail 中的抽象类和所有子类
- flutter - 为什么 IconButtons 之间的空间没有填满?
- python - 如何在python中打印所有可能的不同长度的排列?
- sql-server - 插入后更新触发器触发
- docker - 为什么我无法在本地启动带有图像 nginxphp 的容器
- c# - 在 asp net core web appllication 中运行 powershell 7 脚本
- qt - 在屏幕上的某个 x 和 y 位置打开菜单
- validation - 客户端-服务器任务分离的最佳解决方案
- artifactory - Artifactory 在启动期间无法从 /api/v1/system/ping 获得响应