In-App purchases for RubyMotion.
Add this line to your application's Gemfile:
gem 'helu'
And then execute:
$ bundle
Or install it yourself as:
$ gem install helu
Start a helu with the In App Purchase ID:
@helu = Helu.new("loosing_weight_10")
@helu.fail = lambda { |transaction| puts transaction ; # node here for failed in app purchase }
@helu.winning = lambda { |transaction| puts transaction ; # code here for successful in app purchase }
@helu.restore = lambda { restoring_method }
The transaction object on the lambda is the one we get from Apple; Therefore, it is a SKPaymentTransaction. More information about it here
@helu.buy
@helu.restore
Make sure that if your code ever throws out the Helu object, it better also close the store before doing so.
@helu.close
- Consumables and Non-Consumables are supported.
- Auto-Renewable subscriptions and Non-Renewing Subscriptions are not supported yet. However, we would love some help making it happen.
Asynchronous, raw:
inapps = %w[first second third]
@x = Helu::ProductInfoFetcher.new(inapps) do |pi|
p pi
end
Asynchronous, wrapped in method call:
Helu::ProductInfoFetcher.fetch(inapps) do |pi|
p pi
end
Synchronous:
pi = Helu::ProductInfoFetcher.fetch(inapps)
p pi
All three calls return hash of the following form:
{
"inapp_id": {
id: "inapp_id",
title: "inapp_localized_title",
description: "inapp_localized_description",
price: "0.89", # float
currency: "EUR",
price_str: "\u20AC0.89",
}, # ....
}
You can find an example app here. Remember that for this to work properly, you must add your app identifier to the Rakefile.
Helu is relase under the MIT license.
Ivan Acosta-Rubio | Initial work Michal J. | Product Info Fetcher Simon Traels Ravn | Removing Observer and Bug fixes.