guanhui07 / apple_pay
苹果支付 苹果内购 ios
v1.0
2020-07-15 07:44 UTC
Requires
- php: >=7.1.0
This package is auto-updated.
Last update: 2024-11-23 09:23:21 UTC
README
安装 composer
$ composer require guanhui07/apple_pay
// $orderId 本地订单号 // $storeProductId 苹果商店产品ID // $tradeNo 苹果交易号 $order = findOrder($orderId); $applePay = new ApplePay($_POST['receipt'], ''); if ($applePay->verifyReceipt()) { $result = $applePay->query($storeProductId,$bundleId, function ($tradeNo, $returnData) use ($order) { // 检查此交易号是否被使用 if (!$order->checkTradeNoIsUsed($tradeNo)) { // 更新本地订单状态等... return $this->notify($order, $returnData, $tradeNo); } else { echo '此笔交易号已经被使用,这笔交易有可能是伪造的!'; return false; } }); if ($result) { echo 'success'; } else { echo $applePay->getError(); } } else { echo $applePay->getError(); }