0.0
The project is in a healthy, maintained state
IappValidator is a Ruby gem that helps developers validate in-app purchases made through Google Play, using a service account and the Google Android Publisher API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme

IappValidator

Gem Version

IappValidator is a Ruby gem that facilitates purchase verification for Google Play. It leverages the Google Play Developer API to confirm whether a purchase is valid or not.

📦 Installation

Add the gem to your application's Gemfile:

gem 'iapp_validator'

Then run:

bundle install

🔐 Configuration

To verify Google Play purchases, you need a Google Play Service Account JSON key.

  1. Go to Google Cloud Console.
  2. Create a Service Account and grant it "Android Publisher" permissions.
  3. Download the JSON key file.
  4. Place it in your app (e.g., config/credentials/google_play_service_account.json).

🚀 Usage

require 'iapp_validator'

validator = ReceiptHelper::GooglePlayValidator.new
result = validator.verify_purchase("com.package.name", "your.product.id", "purchase_token")

if result[:success]
  puts "Purchase is valid"
else
  puts "Purchase failed: #{result[:error]}"
end

verify_purchase(package_name, product_id, token) Parameters

  • package_name: The package name of your app on Google Play (e.g., com.katkatgames.kanbiztoupatou)
  • product_id: The ID of the purchased product (e.g., coins_100)
  • token: The purchase token returned from the Google Play API.

🛠 Development

To install the gem locally:

bundle exec rake install

To open an interactive console:

bin/console

🤝 Contributing

Pull requests, bug reports, and suggestions are welcome! Please follow the Code of Conduct.

📄 License

This gem is licensed under the MIT License.