Apple的官方文档:
App Store Server Notifications | Apple Developer Documentation
国外大神对V2验证的手撸,看不了的话,自己想办法
App Store Server Notifications V2 with JWT, PHP and Laravel - S M Ibrahim Nafiz
苹果通知验证流程
苹果iOS内购三步曲:App内退款、历史订单查询、绑定用户防掉单!--- WWDC21-腾讯云开发者社区-腾讯云
通知验证SDK( 仅支持php7.4及以上)
composer require readdle/app-store-server-api
这个里面有自己的示例,打开即用
$postData = file_get_contents("php://input");
$responseBodyV2 = AppStoreServerUtils::notifyVerify($postData);
方法示例
public static function notifyVerify(string $signedPayload, $cerPath= "")
{
try {
return ResponseBodyV2::createFromRawNotification($signedPayload, Helper::toPEM(file_get_contents("https://www.apple.com/certificateauthority/AppleRootCA-G3.cer")));
}catch (AppStoreServerNotificationException $e)
{
Log::error('Server notification could not be processed: ' . $e->getMessage(), [$e->getFile(),$e->getLine()]);
exit('Server notification could not be processed: ' . $e->getMessage());
}
}