calibr/ms-receipt-validator 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

calibr/ms-receipt-validator

最新稳定版本:1.2.1

Composer 安装命令:

composer require calibr/ms-receipt-validator

包简介

Microsoft Store Receipt Validator

README 文档

README

This library was created to easily validate Microsoft Store purchase receipts on the server side.

Installation

composer require calibr/ms-receipt-validator

Usage

Assume that client passes receipt to the server side and we receive it in the variable $_POST["receiptXML"], validation of the receipt will look like:

<?php

use Calibr\MSReceiptValidator\Validator;

$validator = new Validator();
// validation(omit exception handling)
$receipt = $validator->load($_POST["receiptXML"]);

// if we are here receipt has been successfully validated and we have all receipt data in the $receipt variable

Validator#load method

Validation is run by calling load method on the Validator class instance. This method takes only one argument - receipt XML string and returns Receipt.

Validator#setPublicKey method

If you want to set public key directly you need to pass the public key string to this method.

Receipt object format

Field
date
deviceId
productReceipt
appReceipt
publicKey
xmlDoc (DOMDocument created from XML string)

Product receipt object format

Field
id
appId
productId
purchaseDate
productType
purchasePrice
expirationDate

App receipt object format

Field
id
appId
purchaseDate
licenseType

Error handling

Validator#load method throws an exception if an error occurs. Possible exceptions:

  • Calibr\MSReceiptValidator\FailFetchPublicKeyException - Microsoft server didn't respond or respond with an error, see details in the exception message
  • Calibr\MSReceiptValidator\MalformedReceiptException - Receipt is invalid, see details in the exception message
  • Calibr\MSReceiptValidator\ValidationFailedException - Receipt didn't pass signature verification process

统计信息

  • 总下载量: 9.63k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-12-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固