GithubHelp home page GithubHelp logo

sn01615 / apple-iap-php Goto Github PK

View Code? Open in Web Editor NEW
11.0 1.0 7.0 5 KB

苹果内购凭据验证工具(苹果支付,苹果内购,凭据解析)

License: MIT License

PHP 100.00%
ios iap iap-verification ios-iap apple-iap

apple-iap-php's Introduction

ios-iap-php

iOS支付验证

install

composer require sn01615/apple-iap-php

use

use sn01615\iap\ios\Verify;

include "../vendor/autoload.php";

$cc = new Verify();
$receipt = ".."; // 凭据
$cc->endpoint(true);// 可选,切换到沙盒环境
$cc->setPassword('123');// 可选,如果是连续订阅需要密码
$cc->setExcludeOldTransactions(true);// 可选,将此值设置为,true以使响应仅包括任何订阅的最新续订交易。
                                     // 仅对包含自动续订的应用收据使用此字段。

$vv = $cc->query($receipt);

// 打印结果
var_dump($vv);


/**
// 返回示例
object(stdClass)#648 (3) {
  ["receipt"]=>
  object(stdClass)#666 (18) {
    ["receipt_type"]=>
    string(10) "Production"
    ["adam_id"]=>
    int(902861234)
    ["app_item_id"]=>
    int(902861234)
    ["bundle_id"]=>
    string(17) "com.xx.xxx"
    ["application_version"]=>
    string(3) "722"
    ["download_id"]=>
    int(75072419401234)
    ["version_external_identifier"]=>
    int(836721234)
    ["receipt_creation_date"]=>
    string(27) "2020-07-22 02:26:01 Etc/GMT"
    ["receipt_creation_date_ms"]=>
    string(13) "1595384761000"
    ["receipt_creation_date_pst"]=>
    string(39) "2020-07-21 19:26:01 America/Los_Angeles"
    ["request_date"]=>
    string(27) "2020-07-22 03:31:59 Etc/GMT"
    ["request_date_ms"]=>
    string(13) "1595388719760"
    ["request_date_pst"]=>
    string(39) "2020-07-21 20:31:59 America/Los_Angeles"
    ["original_purchase_date"]=>
    string(27) "2020-07-21 13:18:24 Etc/GMT"
    ["original_purchase_date_ms"]=>
    string(13) "1595337504000"
    ["original_purchase_date_pst"]=>
    string(39) "2020-07-21 06:18:24 America/Los_Angeles"
    ["original_application_version"]=>
    string(3) "722"
    ["in_app"]=>
    array(1) {
      [0]=>
      object(stdClass)#647 (11) {
        ["quantity"]=>
        string(1) "1"
        ["product_id"]=>
        string(24) "com.xx.xx.xx.xx"
        ["transaction_id"]=>
        string(15) "350000687123456"
        ["original_transaction_id"]=>
        string(15) "350000687123456"
        ["purchase_date"]=>
        string(27) "2020-07-22 02:25:25 Etc/GMT"
        ["purchase_date_ms"]=>
        string(13) "1595384725000"
        ["purchase_date_pst"]=>
        string(39) "2020-07-21 19:25:25 America/Los_Angeles"
        ["original_purchase_date"]=>
        string(27) "2020-07-22 02:25:25 Etc/GMT"
        ["original_purchase_date_ms"]=>
        string(13) "1595384725000"
        ["original_purchase_date_pst"]=>
        string(39) "2020-07-21 19:25:25 America/Los_Angeles"
        ["is_trial_period"]=>
        string(5) "false"
      }
    }
  }
  ["status"]=>
  int(0)
  ["environment"]=>
  string(10) "Production"
}

**/

参考链接

Validating Receipts with the App Store

https://developer.apple.com/documentation/storekit/in-app_purchase/validating_receipts_with_the_app_store

apple-iap-php's People

Contributors

sn01615 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.