Giter Site home page Giter Site logo

tidev / ti.storekit Goto Github PK

View Code? Open in Web Editor NEW
69.0 28.0 37.0 45.83 MB

Use the native iOS StoreKit API for In-App-Purchasing with Appcelerator Titanium.

License: Other

Objective-C 1.12% C 98.55% JavaScript 0.33%
storekit appcelerator titanium in-app-purchase javascript native titanium-module

ti.storekit's Introduction

Titanium Store Kit Module Build Status

Note: We recently updated the Ti.StoreKit to version 4.x which includes some breaking changes. Make sure to check-out the Releases tab to grab the newest version. Thanks!

This is the Store Kit Module for Titanium. Check the documentation and example for more infos!

Contributors

  • Pedro Enrique
  • Jon Alter
  • Hans Knöchel

Interested in contributing? Read the contributors/committer's guide.

Legal

This module is Copyright (c) 2010-2017 by Appcelerator, Inc. All Rights Reserved. Usage of this module is subject to the Terms of Service agreement with Appcelerator, Inc.

ti.storekit's People

Contributors

caspahouzer avatar cb1kenobi avatar hansemannn avatar ingo avatar jawa9000 avatar jonalter avatar muhammaddadu avatar pec1985 avatar sophrinix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ti.storekit's Issues

Solution: Fetching latest Subscription Data & Expiration (locally on device)

const latestReceipt = _.max(Storekit.receiptProperties.purchases, function(purchase) {
    return purchase.transactionIdentifier;
});
Ti.API.info("Storekit Latest ReceiptProperties: " + JSON.stringify(latestReceipt));
const isOngoing = moment().isBefore(moment(latestReceipt.subscriptionExpirationDate));
Ti.API.info("Subscription: " + latestReceipt.productIdentifier + " is Ongoing?:" + isOngoing);
Ti.App.Properties.setBool('Purchased-' + latestReceipt.productIdentifier, isOngoing);

You may want to modify some of your code (especially if it's Subscriptions only (without 1 time IAP) but ongoing subscriptions; Notably the markProductAsPurchased in the example.

Subscribing a second time after expiration does not work

I do a manual check for the expiration date and save the subscription status with the markProductAsPurchased and removeProductAsPurchased functions.
Later, having found that the subscription has expired I resubmit the purchase, but the outcome of the purchaseProduct click is to go directly into the Storekit.TRANSACTION_STATE_PURCHASED case without any Apple purchase screen being proposed and without actually reactivating the subscription.

Video attached on Slack thread

https://tidev.slack.com/archives/C03CVQX2A/p1688503085742179

CFBundleVersion error

I have the error "The hard-coded bundle version does not match the app's CFBundleVersion."
I have tried Xcode procedure writed on documentation but I get another error, see attachment.

Xcode 14.3.1
SDK 12.1.1.GA

IMG_2884

I can't restore "single item" already purchased. Works in sendbox, not in production

Hello,
Can the module in sanboxbox work properly and in production no?
I did several sendbox tests for single item products. If a product has already been purchased, and I try to redo the purchase, it says correctly that the purchase has already been made. So if I use Restore, it works correctly and the markProductAsPurchased() method is invoked.
But it seems that production does not work. Users have bought products correctly, but the markProductAsPurchased() method does not seem to be invoked after the purchase, even using Restore.

Is there any API for getting if the trial period has ended ?

I am using introductoryPrice.paymentMode and subscriptionPeriod to get if the App has a trial version and its period. But How do we identify if the trial period has ended?

  • say for the case where the User already used the trial period but then has not subscribed to the app yet, and an appropriate message has to be shown in the App based on that condition.

Problem with Titanium 3.5.0 SDK

Hi,
if I try to compile my app with this module I get this error:

[ERROR] : 2015-01-14 00:19:04.470 xcodebuild[28363:671359] DeveloperPortal: Using pre-existing current store at URL (file:///Users/myhome/Library/Developer/Xcode/DeveloperPortal%206.1.1.db).
[ERROR] : ** BUILD FAILED **
[ERROR] : The following build commands failed:
[ERROR] : Ld build/MyApp.build/Debug-iphonesimulator/MyApp-universal.build/Objects-normal/x86_64/MyApp normal x86_64
[ERROR] : (1 failure)

Without this module titanium compile fine. With 3.4.1 compile fine.

Do you have suggestion for me?

Best regards
Lorenzo

Unable to decode the TiBlob object (purchase receipt)

After sucessfull purchase i have to send the purchase receipt to serevr for validation and server intern validate it from Apple.
i am reading the receipt from ti.Storekit.receipt parameter. and its returning TiBlob object.
can u tell me how to share this to server? can we convert this Blob into base64 string?

Problem with requestProduct

I'm testing this module, release 4.1.0, following the instructions 100%, using SDK 6.0.3

After calling

Storekit.requestProducts([identifier], function(evt) {
if (!evt.success)
{
Ti.API.error('ERROR: We failed to talk to Apple!');
}
else if (evt.invalid)
{
Ti.API.error('ERROR: We requested an invalid product (' + identifier + '):');
Ti.API.error(evt);
}
else
{
Ti.API.info('Valid Product:');
Ti.API.info(evt);
success(evt.products[0]);
}
});
};

I get a valid response, but there is only the long text. I can't find title, price, etc...

[INFO] : Valid Product:
[INFO] : {
[INFO] : products = (
[INFO] : "DigitalSodaPop for you!!!!"
[INFO] : );
[INFO] : source = "[object TiStorekitProductRequest]";
[INFO] : success = 1;
[INFO] : type = callback;
[INFO] : }

Products is only a string.

Any help?

Arm64 architecture

I'm trying to put your module in my project, but when I try to call "require ('ti.storekit')" I get back the following alert:
trycatch share: Couldn't find module: ti.storekit for architecture: arm64

What's happening?
Thanks,
Francesco.

Configuration problems or incompatibility xCode 14.3

I'm not able to build and run on device from xCode. App start on device but is stucked on splashscreen.
If I build and run on device from CLI app works but not storekit:

[ERROR] Failed to refresh receipt: Error Domain=SKErrorDomain Code=0 "Si è verificato un errore sconosciuto" UserInfo={NSLocalizedDescription=Si è verificato un errore sconosciuto, NSUnderlyingError=0x283404480 {Error Domain=ASDServerErrorDomain Code=500317 "Unhandled exception" UserInfo={NSLocalizedDescription=Unhandled exception, NSLocalizedFailureReason=An unknown error occurred}}}

One obvious difference from the documentation is related to the points:

Under "General", make sure that the "Version" is what you expect it to be.
If the version is not what you expect (maybe something like 1.0.0.1382133876099) change it to its correct value (in this case 1.0.0).

When I first open the project in xcode the version and build are empty, but even compiling them by hand the app does not start on the phone.

Can anyone help me?

Message when I launch build.py

First: I do not know much Python... maybe can be my fault...
I get this when I drag build.py on Python Launcher:
Last login: Fri Apr 29 09:41:05 on ttys003 MacBook-Jack:~ jack$ cd '/Users/jack/Downloads/ti.storekit-master/ios/' && '/usr/bin/pythonw' '/Users/jack/Downloads/ti.storekit-master/ios/build.py' && echo Exit status: $? && exit 1 Traceback (most recent call last): File "/Users/jack/Downloads/ti.storekit-master/ios/build.py", line 272, in <module> build_module(manifest,config) File "/Users/jack/Downloads/ti.storekit-master/ios/build.py", line 168, in build_module from tools import ensure_dev_path ImportError: No module named tools MacBook-Jack:ios jack$

did I miss something?

Error using getting the Receipt

I'm using this module, but after loging in to my account I get this errror

[ERROR] Failed to refresh receipt: Error Domain=SKErrorDomain Code=0 "Ocorreu um erro desconhecido" UserInfo={NSLocalizedDescription=Ocorreu um erro desconhecido, NSUnderlyingError=0x287c17030 {Error Domain=ASDErrorDomain Code=500 "Unhandled exception" UserInfo={NSUnderlyingError=0x287c16100 {Error Domain=AMSErrorDomain Code=100 "Authentication Failed" UserInfo={NSMultipleUnderlyingErrorsKey=( [ERROR] "Error Domain=AMSErrorDomain Code=2 \"Ocorreu um erro desconhecido. Volte a tentar.\" UserInfo={NSLocalizedDescription=Ocorreu um erro desconhecido. Volte a tentar.}", [ERROR] "Error Domain=AMSServerErrorDomain Code=-5000 \"(null)\" UserInfo={failureType=-5000, m-allowed=false, pings=(\n), cancel-purchase-batch=true, customerMessage=The Apple\U00a0ID you entered couldn\U2019t be found or your password was incorrect. Please try again.}" [ERROR] ), NSLocalizedDescription=Authentication Failed, NSLocalizedFailureReason=The authentication failed.}}, NSLocalizedFailureReason=An unknown error occurred, NSLocalizedDescription=Unhandled exception}}} [INFO] Validating receipt. [ERROR] Error: Receipt does not exist. Try refreshing the receipt. [ERROR] at ([native code]) [ERROR] at validate () [ERROR] at () [ERROR] CoreFoundation 0x000000018a7c529c 5198FB57-5645-3B34-A49F-F32B52256CF3 + 627356 [ERROR] libobjc.A.dylib 0x00000001a34bf744 objc_exception_throw + 60 [ERROR] TitaniumKit 0x00000001011857c4 JavascriptNameForClass + 0 [ERROR] Aqua-Info 0x0000000100287d84 -[TiStorekitModule receiptURL] + 228 [ERROR] Aqua-Info 0x0000000100284fe0 -[TiStorekitModule validateReceipt:] + 332 [ERROR] CoreFoundation 0x000000018a74db24 5198FB57-5645-3B34-A49F-F32B52256CF3 + 138020 [ERROR] CoreFoundation 0x000000018a76b610 5198FB57-5645-3B34-A49F-F32B52256CF3 + 259600 [ERROR] TitaniumKit 0x00000001011d1abc -[KrollMethod call:] + 1024 [ERROR] TitaniumKit 0x00000001011d0df0 __KrollCallAsFunction_block_invoke + 36 [ERROR] TitaniumKit 0x00000001011d0c08 KrollCallAsFunction + 396 [ERROR] JavaScriptCore 0x0000000195e03028 62EB08D2-3EC0-33A3-9789-1FC94458F203 + 4718632 [ERROR] JavaScriptCore 0x00000001966444ec 62EB08D2-3EC0-33A3-9789-1FC94458F203 + 13374700 [ERROR] JavaScriptCore 0x0000000196677ac4 62EB08D2-3EC0-33A3-9789-1FC94458F203 + 13585092 [ERROR] JavaScriptCore 0x0000000195d86d3c 62EB08D2-3EC0-33A3-9789-1FC94458F203 + 4209980 [ERROR] JavaScriptCore 0x0000000195d834f8 62EB08D2-3EC0-33A3-9789-1FC94458F203 + 4195576 [ERROR] JavaScriptCore 0x0000000195d834f8 62EB08D2-3EC0-33A3-9789-1FC94458F203 + 4195576 [ERROR] JavaScriptCore 0x0000000195d59430 62EB08D2-3EC0-33A3-9789-1FC94458F203 + 4023344 [ERROR] JavaScriptCore 0x0000000196556e1c 62EB08D2-3EC0-33A3-9789-1FC94458F203 + 12402204 [ERROR] JavaScriptCore 0x00000001967de38c _ZN3JSC12profiledCallEPNS_14JSGlobalObjectENS_15ProfilingReasonENS_7JSValueERKNS_8CallDataES3_RKNS_7ArgListE + 96 [ERROR] JavaScriptCore 0x0000000195e16568 JSObjectCallAsFunction + 520

Support missing StoreKit API'S

Ok, so this module already is the most advanced StoreKit module out there and that's cool. But there are a few (secondary) functionalities missing:

  • SKStoreProductViewController*: Shows a dialog of an app inside the AppStore.
  • SKStoreReviewController**: Requests a review-dialog for an app inside the AppStore.
  • SKCloudServiceSetupViewController: Shows a dialog to setup iCloud / Apple Music

* Already externally available through TiStoreProductView.
** Already externally available through titanium-review-dialog.

Will unify those in this module as well, to keep the module-dependency-graph as small as possible.

Missing to call Storekit.TRANSACTION_STATE_PURCHASED in transactionState eventListener.

Hello Developer,

Thank you for developing this module.

I’m using your module in one of my applications. I’m facing a strange problem. When I get an alert of successful InApp Purchase I’m calling a function to post this payment on my custom server for maintaining records.
I’m calling this function in “transactionState” eventListener under Storekit.TRANSACTION_STATE_PURCHASED. My problem is that, sometimes my custom function does not invoke and sometimes it works great. Can you please find sometime and look into it. I’d be grateful.

My Code:

case storekit.TRANSACTION_STATE_PURCHASED:
if (storekit.validateReceipt()) {
Ti.API.info('My payment receipt : ' + JSON.stringify(evt.receipt.toString()));
alert('Purchase completed!');
evt.transaction && evt.transaction.finish();
myFunction();
}
break;

myFunction(){
console.log(“Posting my payment to my custom server”);
}

Thank you very much.

requestReviewDialog not working

I have a problem. From my App I call this:

require('ti.storekit').requestReviewDialog();

It's great, the rate window appears, but if I select the stars, Send button is aways disabled.

Any help? Thanks.

Receipt verification failed with Apple Server from ti.storekit

Hello,

based on the apple forum, the InApp receipt verification failed. It seems that Apple changes some things to work no longer with the current ti.storekit (3.1.2)

Have a look at the post:
https://forums.developer.apple.com/thread/47218

I tested the latest version of ti.storekit with Ti.SDK 5.2.2.GA, ios SDK 9.3 and Titanium Studio 4.5.0

The Storekit.validateReceipt() functions returns an "Invalid Receipt"

A fix for that would be very nice :)

Thanks,
Fab

iOS 9 support

Was ti.storekit tested with iOS 9?

ti.storekit returned TRANSACTION_STATE_FAILED (state 2) when the purchase was sucessful

Here is what happened at the Storekit.addEventListener('transactionState', function(evt) { ... } );

Clicking buy, then evt state is TRANSACTION_STATE_PURCHASING:
{"quantity":1,"state":0,"productIdentifier":"com.xxx.xxx","downloads":[],"transaction":{},"bubbles":true,"type":"transactionState","source":{"id":"ti.Storekit"},"cancelBubble":false}

Successfuly bought, then state is TRANSACTION_STATE_FAILED:
{"quantity":1,"cancelled":false,"productIdentifier":"com.xxx.xxx","transaction":{},"identifier":"2AA799AC-C71C-4317-A7AC-359694FXXXXXX","downloads":[],"message":"Cannot connect to iTunes Store","state":2,"bubbles":true,"type":"transactionState","source":{"id":"ti.Storekit"},"cancelBubble":false}

I'm using the latest ti.storekit (3.1.2) with ti sdk 3.5.1.GA

Needs support for restoreCompletedTransactionsWithApplicationUsername

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.