Skip to content

Instantly share code, notes, and snippets.

View php-cpm's full-sized avatar

zouyi php-cpm

View GitHub Profile
@php-cpm
php-cpm / parse.php
Last active August 25, 2023 10:48
apple iap App Store Server Notifications V2 parse code
<?php
$error = ['code'=>0,'msg'=>''];
$req = json_decode(file_get_contents("php://input"), true);
if (//https://developer.apple.com/documentation/appstoreservernotifications/responsebodyv1
!isset($req['environment']) ||
//https://developer.apple.com/documentation/appstoreservernotifications/responsebodyv2
!isset($req['signedPayload']) {
$error = ['code' => 400, 'msg' => 'params error'];
return $error;
}