simplephp/appstore-notification

There is no license information available for the latest version (dev-main) of this package.

The appstore notification for php

dev-main 2021-07-29 02:29 UTC

This package is auto-updated.

Last update: 2024-10-29 06:18:57 UTC


README

介绍

appstore server notifications for php appstore 内购通知 包含 服务端校验和appstore通知(test文件夹下包含 test 和 notify文件)

安装教程

1 Add to composer.json to the require key

"require" : {
    "simplephp/appstore-notification": "dev-master",
}

OR

composer require simplephp/appstore-notification dev-master

使用说明

<?php
require '../vendor/autoload.php';
$appstoreNotification = new \Simplephp\AppstoreNotification();
$receiptData = 'MIIVvgYJKoZIhvcNAQcCoIIVrzCCFasCAQExCzAJBgUrDgMCGgUAMIIFXwYJKoZIhvcNAQcBoIIFUASCBUwxggVIMAoCARQCAQEEAgwAMAsCARkCAQEEAwIBAzAMAgEKAgEBBAQWAjQrMAwCAQ4CAQEEBAICAJ4wDQIBDQIBAQQFAgMCJHEwDgIBAQIBAQQGAgQbKBW3MA4CAQMCAQEEBgwEMTEwNTAOAgEJAgEBBAYCBFAyNTYwDgIBCwIBAQQGAgQHEjAtMA4CARACAQEEBgIEMhtFuTAOAgETAgEBBAYMBDEwOTkwEAIBDwIBAQQIAgYcRugk+DswFAIBAAIBAQQMDApQcm9kdWN0aW9uMBgCAQQCAQIEECjM//6hbcF7DHk7dBx+bQEwHAIBBQIBAQQUv3H32G2xf8idikz/LB9wf20v/7gwHgIBCAIBAQQWFhQyMDIxLTAzLTIzVDAxOjM2OjE1WjAeAgEMAgEBBBYWFDIwMjEtMDMtMjNUMDE6MzY6MTZaMB4CARICAQEEFhYUMjAyMS0wMi0wOFQxMDozNjoyM1owIQIBAgIBAQQZDBdjb20uaXJlYWRlcmNpdHkud2VhdGhlcjBHAgEHAgEBBD/3bPvC/HjfujOS7lm0O2NSiQympvCeWW8UVowAArIkTnyaixD53PZhzFAMlF7Tp5/qmE2QEzRlB+fKljBvP9EwSgIBBgIBAQRCK7SUISHKe4v/3fPK+NvvW1jCudlq4aLgAtrUEAMVIww7294/TQ0eZ2tb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6VXtegjV1rKBS94Icb2xKIWJoHTcpWnZPenhVXnb4KpYjJWbQL2NFb9q1p/e3AcQtvjB2NyOOB9xPIURBXU70OXpwwhUTbMk+n8ZZ1lLAb/VI+H/DZR2bPJnWHTY8up0Nge+8zF0CqaDFuuxuXqRNL1KT9l/EKaG1Kih816r/lanwFnQWMwHOLnXqjLVmlf44QYav4ccMZJRkB+hwH75JPXs4CP+ZgZgJJkz3FssAH88=';

$secret = 'your secret';
$result = $appstoreNotification->setSharedSecret($secret)->verifyReceipt($receiptData);
echo '<pre />';
var_dump($result);
var_dump($appstoreNotification->getError());

###结果

array(1) {
  [110000956363006]=>
  array(17) {
    ["quantity"]=>
    string(1) "1"
    ["product_id"]=>
    string(23) "your product id"
    ["transaction_id"]=>
    string(15) "110000956363006"
    ["original_transaction_id"]=>
    string(15) "110000931704447"
    ["purchase_date"]=>
    string(27) "2021-03-08 10:55:35 Etc/GMT"
    ["purchase_date_ms"]=>
    string(13) "1615200935000"
    ["purchase_date_pst"]=>
    string(39) "2021-03-08 02:55:35 America/Los_Angeles"
    ["original_purchase_date"]=>
    string(27) "2021-02-08 10:55:39 Etc/GMT"
    ["original_purchase_date_ms"]=>
    string(13) "1612781739000"
    ["original_purchase_date_pst"]=>
    string(39) "2021-02-08 02:55:39 America/Los_Angeles"
    ["expires_date"]=>
    string(27) "2021-04-08 09:55:35 Etc/GMT"
    ["expires_date_ms"]=>
    string(13) "1617875735000"
    ["expires_date_pst"]=>
    string(39) "2021-04-08 02:55:35 America/Los_Angeles"
    ["web_order_line_item_id"]=>
    string(15) "110000377300246"
    ["is_trial_period"]=>
    string(5) "false"
    ["is_in_intro_offer_period"]=>
    string(5) "false"
    ["in_app_ownership_type"]=>
    string(9) "PURCHASED"
  }
}