mehmetbeyhz / apple_iap
Apple in app purchases
dev-master
2023-01-04 20:37 UTC
Requires
- mehmetbeyhz/easy-json-mapper: dev-master
- mehmetbeyhz/mclient: dev-master
This package is not auto-updated.
Last update: 2025-03-28 06:10:07 UTC
README
Verify Apple App store purchases and handle apple server notifications v2.
Get notification details.
$data = '{"signedPayload":"..."}' $iap = new \AppleIAP\AppleIAP(); $notificationDetails = $iap->getNotificationDetails($data); $data = $notificationDetails->getData(); $transactionInfo = $data->getSignedTransactionInfo(); $renewalInfo = $data->getSignedRenewalInfo(); $transactionInfo->getAppAccountToken(); $transactionInfo->getOriginalTransactionId(); $transactionInfo->getExpiresDate(); $transactionInfo->getPurchaseDate(); ...
verify purchases
$receiptData = '...'; $password = '...'; $iap = new \AppleIAP\AppleIAP(); $verify = $iap->enableSandboxMode() ->verifyPurchase($password,$receiptData,true); if($verify->getStatus() == 0){ // verified. foreach ($verify->getLatestReceiptInfo() as $receipt){ $receipt->getPurchaseDate(); $receipt->getAppAccountToken(); $receipt->getTransactionId(); ... } }