我不熟悉在PHP中使用JSON。我想帮助他的朋友使用PHP开发的软件。有一个支付集成,交换机需要URL,他们可以在每次成功付款时发布JSON参数,以帮助他跟踪付款活动。参数如下
PaymentLogId String
CustReference String
Amount Numeric
PaymentReference String
IsReversal Boolean
PaymentDate DateTime
BankName String
CustomerName String
ItemName String
CustomerAddress String
支付网关坚持认为他应该编写可以捕获上述JSON参数并更新其数据库的代码。
我有:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'https://');
$result = curl_exec($ch);
curl_close($ch);
$obj = json_decode($result);
echo $obj->firstname;
?>
但似乎应该有地址来获取信息,他们拒绝提供任何地址。
答案 0 :(得分:0)
听起来他们希望能够将生成的json发布到朋友服务器中的API端点。他们目前是否有可以发生这种情况的API架构?例如,他们可以在www.example.com/api/payments/
或任何路线上接受$(document).on("click", "button", function () {
$(".box").on("mouseover", function () {
$(".box").css("background", "blue")
});
$(".box").on("mouseout", function () {
$(".box").css("background", "none")
});
})
个请求。然后,您的朋友可以自动处理与服务器路由关联的控制器中成功付款的接收。
答案 1 :(得分:0)
支付公司需要一个URL来将数据POST到您的服务器。因此,您需要编写服务来管理此请求。
看看this tutorial。也许它会有所帮助。