{"id":42671157,"url":"https://github.com/calibr/ms-receipt-validator","last_synced_at":"2026-01-29T11:00:06.142Z","repository":{"id":62499144,"uuid":"76805590","full_name":"calibr/ms-receipt-validator","owner":"calibr","description":"Validate purchase receipts from Microsoft Store","archived":false,"fork":false,"pushed_at":"2016-12-20T13:46:39.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-20T00:24:01.611Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/calibr.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-18T20:40:44.000Z","updated_at":"2024-09-06T13:54:59.000Z","dependencies_parsed_at":"2022-11-02T12:16:07.873Z","dependency_job_id":null,"html_url":"https://github.com/calibr/ms-receipt-validator","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/calibr/ms-receipt-validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calibr%2Fms-receipt-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calibr%2Fms-receipt-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calibr%2Fms-receipt-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calibr%2Fms-receipt-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/calibr","download_url":"https://codeload.github.com/calibr/ms-receipt-validator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calibr%2Fms-receipt-validator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28876674,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T10:31:27.438Z","status":"ssl_error","status_checked_at":"2026-01-29T10:31:01.017Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-29T11:00:02.822Z","updated_at":"2026-01-29T11:00:06.026Z","avatar_url":"https://github.com/calibr.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Why?\n\nThis library was created to easily validate Microsoft Store purchase receipts on the server side.\n\n# Installation\n\n`composer require calibr/ms-receipt-validator`\n\n# Usage\n\nAssume that client passes receipt to the server side and we receive it in the variable `$_POST[\"receiptXML\"]`, validation of the receipt will look like:\n\n```php\n\u003c?php\n\nuse Calibr\\MSReceiptValidator\\Validator;\n\n$validator = new Validator();\n// validation(omit exception handling)\n$receipt = $validator-\u003eload($_POST[\"receiptXML\"]);\n\n// if we are here receipt has been successfully validated and we have all receipt data in the $receipt variable\n```\n\n# Validator#load method\n\nValidation is run by calling `load` method on the `Validator` class instance. This method takes only one argument - receipt XML string and returns [Receipt](#receipt).\n\n# Validator#setPublicKey method\n\nIf you want to set public key directly you need to pass the public key string to this method.\n\n\u003ca id=\"receipt\"\u003e\u003c/a\u003e\n## Receipt object format\n\n| Field          |\n|----------------|\n| date           |\n| deviceId       |\n| [productReceipt](#product-receipt) |\n| [appReceipt](#app-receipt)     |\n| publicKey     |\n| xmlDoc ([DOMDocument](http://php.net/manual/class.domdocument.php) created from XML string) |\n\n\u003ca id=\"product-receipt\"\u003e\u003c/a\u003e\n## Product receipt object format\n\n| Field          |\n|----------------|\n| id           |\n| appId       |\n| productId |\n| purchaseDate  |\n| productType         |\n| purchasePrice         |\n| expirationDate         |\n\n## App receipt object format\n\u003ca id=\"app-receipt\"\u003e\u003c/a\u003e\n\n| Field          |\n|----------------|\n| id           |\n| appId       |\n| purchaseDate |\n| licenseType  |\n\n# Error handling\n\n`Validator#load` method throws an exception if an error occurs. Possible exceptions:\n\n- `Calibr\\MSReceiptValidator\\FailFetchPublicKeyException` - Microsoft server didn't respond or respond with an error, see details in the exception message\n- `Calibr\\MSReceiptValidator\\MalformedReceiptException` - Receipt is invalid, see details in the exception message\n- `Calibr\\MSReceiptValidator\\ValidationFailedException` - Receipt didn't pass signature verification process\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalibr%2Fms-receipt-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcalibr%2Fms-receipt-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalibr%2Fms-receipt-validator/lists"}