I'm currently working on a mobile game using Unity3D and Soomla for the in-app purchases part. Currently I'm trying to implement the 'restore' functionality for non-consumable item (I only have 1 which is "No Ads"). In order to do this; I used "SoomlaStore.RestoreTransactions" functions and restore the item if "OnRestoreTransactionsFinished" received true.
The problem is that whenever the "OnRestoreTransactionsFinished" is called, the value it received will always be TRUE even though that device/account never purchase the item before. According to Soomla website;
success is a boolean value that says if the restore transactions
operation hass succeeded or failed
Am I misunderstanding something here? Does the value will always be true even if the account never purchase the item before? Does this means I need to use something else to check whether the item should be restore and that my way of doing things now are totally wrong? Thank you.
For future readers... OnRestoreTransactionsFinished returns whether or not the transactions have been restored or not. It does not tell which products or anything.
The RestoreTransactions function call will call the OnMarketPurchased event for each item restored, so you can use that to update your app with each item that has been restored.
Related
In SP2016 I'm making a call to the AddUserToGroup method of UserGroup.asmx. My function adds a user to a SharePoint permission group called "Supervisors".
If I supply a valid user account (in i:0#.w|domain\\username format), the call returns success, and almost always adds the user to the group. Sometimes, however, the user does not get added (although the call still returns success).
If I add a subsequent call to the GetGroupCollectionFromUser method, it returns a list of groups which include the target "Supervisors" group. But the user has not actually been added, and a refresh of the page will reflect that. How could that be?
The problem is not specific to a user, domain, or anything else that I can tell. The same user account may fail one time and succeed the next (returning success both times). The exact same problem occurs whether I use ASMX or REST (!!!). Verbose ULS logs have also not shed any light on the issue.
Has anyone seen this issue before?
I'm using the JavaScript SDK flavor of the Dropbox Datastore API with a web app for mobile and desktop. When the recordsChanged event fires while the app is offline, object data about those changes are generated but the changes can't sync to the datastore until the app is online again.
The event data can be checked against the settings table, for instance, like this:
e.affectedRecordsForTable("settings")
But the array data returned has a lot of layers to wade through.
[t_datastore: t_deleted: false_managed_datastore: t_record_cache: t_rid: "startDate"_tid: "settings"__proto__: t]
I would like to capture the "has been synced" or the "not yet synced" status of each change (each array index) so that I can store the data still waiting to sync in case the session is lost (user closes the app/browser or OS kills the app process). But I also want to know if/when the data does eventually sync successfully. Where can I find the property holding this data?
I found my answer. Steve Marx has a post on the Dropbox developer blog that covers the information I needed. There is a datastore.getSyncStatus().uploading property that returns true or false depending on the state of the datastore sync status.
Source:
https://www.dropbox.com/developers/blog/61/checking-the-datastore-sync-status-in-javascript
I am using multiple in-app purchases within my app, and I need to check, sometimes for two at once, for example,
if a user has made a purchase for featureA or featureB or featureC
or perhaps they have made A & B but not C... for example;
if ([MKStoreManager featureAPurchased] && [MKStoreManager featureCPurchased] ) {
bannerView_.hidden = YES;
What I am trying to do is say "if you have purchased feature A OR feature C then bannerView will be hidden.
I know how to do it for just one (ie featureA) but if I am trying to check for if BOTH those features have been purchased, that is where I am struggling.
I guess I am doing it wrong, as it does not appear to work correctly? I am probably muddling up the statement using &&?
&& is the operator used for saying 'and'. If you want to say 'or', use ||.
So, you want
if ([MKStoreManager featureAPurchased] || [MKStoreManager featureCPurchased] ) {
bannerView_.hidden = YES;
How are you checking that the user has purchased something? The usual way to check this is either have this information persisted in the app (User Defaults or database) or asking App store with -[SKPaymentQueue restoreCompletedTransactions]. Restoring transactions gives you information about all available products purchased for the user in your app, so this should give you enough to accomplish what you want
I am trying to implement in-app purchase for my Windows Store App (Metro App). I was referring to the code samples here, but when I triggered the RequestProductPurchaseAsync method nothing happens.
When I say nothing happens, it means literally nothing. No return results (the result was supposed to be a receipt since I passed in true for includeReceipt). Also, when I re-checked the ProductLicences[string].IsActive flag it will always return me false.
How do I test this out properly? Thanks a lot!
Make sure the app LicenseInformation.IsTrial is false, otherwise it won't work. In-app product purchases require that the app not be in trial. In a published app, the user would see an error stating that you can't do in-app product purchases under trial license. The simulator doesn't show this warning in the in-app purchase simulation dialog during testing.
You can either modify the initial state of the simulation (see the samples for how to do that) or call RequestAppPurchaseAsync(false) during the simulation run to get a full license for the app, then try the product purchase.
We experienced and solved a similar problem.
Using CurrentAppSimulator worked fine, but bringing up the real purchasing UI with CurrentApp did not.
In a production setting await CurrentApp.RequestProductPurchaseAsync(string,bool) seemed to never return (more specifically, it only returns once after the user has logged in -- subsequent calls did not return).
Additionally, after we tried to bring up the purchasing UI in our app, other applications using the purchasing UI had the same problem -- UI never shows.
Here is the problem code:
private async void CommandInvokedHandler(IUICommand command)
{
switch (command.Label)
{
case "Continue":
licenseInformation = CurrentApp.LicenseInformation;
if (!licenseInformation.ProductLicenses[Notes.ProductName].IsActive)
{
try
{
await CurrentApp.RequestProductPurchaseAsync(Notes.ProductName, false);
// The code never steps over
}
The somewhat-obvious problem with the code above is that the request to bring up the in-app purchase UI is made from within a modal dialog box command handler. The request hangs -- never returns. The not-so-obvious part is that it also blocks all subsequent requests from our application and every other application (until the user's session is restarted).
Upon moving the "try" block out of the command handler, and ensuring that there are no modal UI calls contesting the purchase request, purchasing worked without issue.
EDIT: You should restart (or re-login) to test this. Once the purchasing UI breaks, it will not show until you restart or re-login.
There is a small nuance to follow: to be able to purchase anything using CurrentAppSimulator one needs to call CurrentAppSimulator.RequestAppPurchaseAsync before making any purchase requests. After the operation returned by the call is done, you can successfully call CurrentAppSimulator.RequestProductPurchaseAsync (unless the IsTrial value in LicenseInformation element is set to false in the xml).
I've been looking at implementing the new VerificationController to verify in-App-Purchases:
http://developer.apple.com/library/ios/#releasenotes/StoreKit/IAP_ReceiptValidation/_index.html
And I wonder if there is some example anywhere en how to validate a transaction, since it seems that the - (BOOL)verifyPurchase:(SKPaymentTransaction *)transaction; is not enough and it has to be implemented internally to verify the purchase when the data form the server is received.
Another question is if anyone has a clue on what the KNOWN_TRANSACTIONS_KEY is and how to fill it, is it just the product id of the purchase?
In the file "VerificationController.m", check this function:
- (void)saveTransactionId:(NSString *)transactionId
we can see, KNOWN_TRANSACTIONS_KEY is a key to be wrote to NSUserDefaults. So we don't need to touch it.
login iTunes Connect > Manage Your Apps > (click your app) > Manage In-App Purchases > click the link View or generate a shared secret (at bottom-left of the page)
it'll show us:
A shared secret is a unique code that you should use when you make the
call to our servers for your In-App Purchase receipts.
Just click Generate.
You can find a complete implementation over here: https://github.com/evands/iap_validation
RayWenderlich.com Tutorial
This article, In-App Purchases in iOS 6 Tutorial: Consumables and Receipt Validation on the RayWenderlich.com site, offers a download of Apple's code but fleshed-out (including Base64 methods) and tweaked.
You need to perform the validation on a transaction when it changes to one of the completion states:
SKPaymentTransactionStatePurchased
SKPaymentTransactionStateRestored
call the function:
[[VerificationController sharedInstance] verifyPurchase:transaction];
As you say it is not enough to just look at the return value. The function is asynchronous. You need to add some code to VerificationController.m where it says:
#warning Validation succeeded. Unlock content here.
There are also a few other lines with #warning in VerificationController.m where you need to deal with errors.
As for base64 another library you might want to look at using is:
http://www.imthi.com/blog/programming/iphone-sdk-base64-encode-decode.php
When it comes to
KNOWN_TRANSACTIONS_KEY
and
ITC_CONTENT_PROVIDER_SHARED_SECRET
I too would like to know what they are for and why and when they are needed.