{"id":1776,"url":"https://github.com/gabrielgarza/monza","last_synced_at":"2025-08-02T04:32:32.479Z","repository":{"id":51155394,"uuid":"61469129","full_name":"gabrielgarza/monza","owner":"gabrielgarza","description":"Ruby Gem for Rails - Easy iTunes In-App Purchase Receipt validation, including auto-renewable subscriptions","archived":false,"fork":false,"pushed_at":"2023-03-07T16:21:52.000Z","size":79,"stargazers_count":162,"open_issues_count":3,"forks_count":36,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-19T21:53:02.637Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gabrielgarza.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-06-19T07:21:51.000Z","updated_at":"2025-03-14T00:38:25.000Z","dependencies_parsed_at":"2022-09-08T08:03:27.929Z","dependency_job_id":"5eafa544-adfa-4882-8589-4461a9aa8455","html_url":"https://github.com/gabrielgarza/monza","commit_stats":{"total_commits":87,"total_committers":19,"mean_commits":4.578947368421052,"dds":"0.25287356321839083","last_synced_commit":"dfaa59ab103a8f47f005233333f58349d22f4036"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/gabrielgarza/monza","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielgarza%2Fmonza","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielgarza%2Fmonza/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielgarza%2Fmonza/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielgarza%2Fmonza/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gabrielgarza","download_url":"https://codeload.github.com/gabrielgarza/monza/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielgarza%2Fmonza/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266061933,"owners_count":23870682,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-01-05T20:15:55.552Z","updated_at":"2025-08-02T04:32:32.248Z","avatar_url":"https://github.com/gabrielgarza.png","language":"Ruby","funding_links":[],"categories":["Payments"],"sub_categories":["Other Parsing","Other free courses"],"readme":"[![Build Status](https://travis-ci.org/gabrielgarza/monza.svg?branch=master)](https://travis-ci.org/gabrielgarza/monza)\n\n![monza_asset](https://user-images.githubusercontent.com/1076706/30770801-8dc83b60-9fee-11e7-8532-c486dacaea07.png)\n\n#### Monza is a ruby gem that makes In-App Purchase receipt and Auto-Renewable subscription validation easy.\n\nYou should always validate receipts on the server, in [Apple's words](https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html#//apple_ref/doc/uid/TP40010573-CH104-SW1):\n\u003e Use a trusted server to communicate with the App Store. Using your own server lets you design your app to recognize and trust only your server, and lets you ensure that your server connects with the App Store server. It is not possible to build a trusted connection between a user’s device and the App Store directly because you don’t control either end of that connection.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'monza'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install monza\n\n## Usage\n\n##### Basic Usage:\n```ruby\n\ndata = \"base64 receipt data string\"\noptions = { shared_secret: \"your shared secret\" }\nresponse = Monza::Receipt.verify(data, options)\n\n```\nYou can also pass in `exclude_old_transactions` with value `true` as an option in the options hash for [iOS7 style app receipts](https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html#//apple_ref/doc/uid/TP40010573-CH104-SW3).\n\n##### Useful Methods\n```ruby\n# Check if subscription is active\n# this checks if latest transaction receipt expiry_date is in today or the future\nresponse.is_subscription_active? # =\u003e true or false\n\n# Returns the active subscription TransactionReceipt or nil\nresponse.latest_active_transaction_receipt # =\u003e TransactionReceipt instance\n\n# Check most recent expiry date\n# ActiveSupport::TimeWithZone\nresponse.latest_active_transaction_receipt.expires_date_ms # =\u003e Fri, 17 Jun 2016 01:57:28 UTC +00:00\n\n```\n\n##### Response Objects\n```ruby\n# Receipt object\n# See Receipt class or sample JSON below for full attributes\nresponse.receipt\n\n# Receipt In App Transactions\n# Returns array of TransactionReceipt objects, see TransactionReceipt class or sample JSON below for full attributes\nresponse.receipt.in_app\n\n# Receipt Latest Transactions List, use these instead if in_app to ensure you always have the latest\n# Returns array of TransactionReceipt objects, see TransactionReceipt class\nresponse.latest_receipt_info # =\u003e Array of TransactionReceipt objects\n\n# Expires date of a transaction\n# DateTime\nresponse.latest_receipt_info.last.expires_date =\u003e # Fri, 17 Jun 2016 01:57:28 +0000\n\n# Check if latest transaction was trial period\nresponse.latest_receipt_info.last.is_trial_period # =\u003e true or false\n\n# Latest receipt base64 string\nresponse.latest_receipt\n\n# original JSON response\nresponse.original_json_response\n```\n\n##### Sample JSON Response Schema\n```json\n\n{\n  \"status\": 0,\n  \"environment\": \"Sandbox\",\n  \"receipt\": {\n    \"receipt_type\": \"ProductionSandbox\",\n    \"adam_id\": 0,\n    \"app_item_id\": 0,\n    \"bundle_id\": \"your_product_id\",\n    \"application_version\": \"58\",\n    \"download_id\": 0,\n    \"version_external_identifier\": 0,\n    \"receipt_creation_date\": \"2016-06-17 01:54:26 Etc/GMT\",\n    \"receipt_creation_date_ms\": \"1466128466000\",\n    \"receipt_creation_date_pst\": \"2016-06-16 18:54:26 America/Los_Angeles\",\n    \"request_date\": \"2016-06-17 17:34:41 Etc/GMT\",\n    \"request_date_ms\": \"1466184881174\",\n    \"request_date_pst\": \"2016-06-17 10:34:41 America/Los_Angeles\",\n    \"original_purchase_date\": \"2013-08-01 07:00:00 Etc/GMT\",\n    \"original_purchase_date_ms\": \"1375340400000\",\n    \"original_purchase_date_pst\": \"2013-08-01 00:00:00 America/Los_Angeles\",\n    \"original_application_version\": \"1.0\",\n    \"in_app\": [\n      {\n        \"quantity\": \"1\",\n        \"product_id\": \"product_id\",\n        \"transaction_id\": \"1000000218147651\",\n        \"original_transaction_id\": \"1000000218147500\",\n        \"purchase_date\": \"2016-06-17 01:32:28 Etc/GMT\",\n        \"purchase_date_ms\": \"1466127148000\",\n        \"purchase_date_pst\": \"2016-06-16 18:32:28 America/Los_Angeles\",\n        \"original_purchase_date\": \"2016-06-17 01:30:33 Etc/GMT\",\n        \"original_purchase_date_ms\": \"1466127033000\",\n        \"original_purchase_date_pst\": \"2016-06-16 18:30:33 America/Los_Angeles\",\n        \"expires_date\": \"2016-06-17 01:37:28 Etc/GMT\",\n        \"expires_date_ms\": \"1466127448000\",\n        \"expires_date_pst\": \"2016-06-16 18:37:28 America/Los_Angeles\",\n        \"web_order_line_item_id\": \"1000000032727764\",\n        \"is_trial_period\": \"false\"\n      }\n    ]\n  },\n  \"latest_receipt_info\": [\n    {\n      \"quantity\": \"1\",\n      \"product_id\": \"product_id\",\n      \"transaction_id\": \"1000000218147500\",\n      \"original_transaction_id\": \"1000000218147500\",\n      \"purchase_date\": \"2016-06-17 01:27:28 Etc/GMT\",\n      \"purchase_date_ms\": \"1466126848000\",\n      \"purchase_date_pst\": \"2016-06-16 18:27:28 America/Los_Angeles\",\n      \"original_purchase_date\": \"2016-06-17 01:27:28 Etc/GMT\",\n      \"original_purchase_date_ms\": \"1466126848000\",\n      \"original_purchase_date_pst\": \"2016-06-16 18:27:28 America/Los_Angeles\",\n      \"expires_date\": \"2016-06-17 01:32:28 Etc/GMT\",\n      \"expires_date_ms\": \"1466127148000\",\n      \"expires_date_pst\": \"2016-06-16 18:32:28 America/Los_Angeles\",\n      \"web_order_line_item_id\": \"1000000032727765\",\n      \"is_trial_period\": \"true\"\n    }\n  ],\n  \"latest_receipt\": \"base 64 string\"\n}\n\n```\n\n##### TransactionReceipt Object\nAn array TransactionReceipt objects will come inside the `receipt.in_app` and `latest_receipt_info` keys of the `response`\n```json\n{\n  \"quantity\": \"1\",\n  \"product_id\": \"product_id\",\n  \"transaction_id\": \"1000000218147500\",\n  \"original_transaction_id\": \"1000000218147500\",\n  \"purchase_date\": \"2016-06-17 01:27:28 Etc/GMT\",\n  \"purchase_date_ms\": \"1466126848000\",\n  \"purchase_date_pst\": \"2016-06-16 18:27:28 America/Los_Angeles\",\n  \"original_purchase_date\": \"2016-06-17 01:27:28 Etc/GMT\",\n  \"original_purchase_date_ms\": \"1466126848000\",\n  \"original_purchase_date_pst\": \"2016-06-16 18:27:28 America/Los_Angeles\",\n  \"expires_date\": \"2016-06-17 01:32:28 Etc/GMT\",\n  \"expires_date_ms\": \"1466127148000\",\n  \"expires_date_pst\": \"2016-06-16 18:32:28 America/Los_Angeles\",\n  \"web_order_line_item_id\": \"1000000032727765\",\n  \"is_trial_period\": \"true\"\n}\n\n```\n\n\n\n\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/gabrielgarza/monza. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrielgarza%2Fmonza","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgabrielgarza%2Fmonza","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrielgarza%2Fmonza/lists"}