Download the PHP package calibr/ms-receipt-validator without Composer
On this page you can find all versions of the php package calibr/ms-receipt-validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download calibr/ms-receipt-validator
More information about calibr/ms-receipt-validator
Files in calibr/ms-receipt-validator
Package ms-receipt-validator
Short Description Microsoft Store Receipt Validator
License
Informations about the package ms-receipt-validator
Why?
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:
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 messageCalibr\MSReceiptValidator\MalformedReceiptException- Receipt is invalid, see details in the exception messageCalibr\MSReceiptValidator\ValidationFailedException- Receipt didn't pass signature verification process