already posted this on Unity Answers ( http://answers.unity3d.com/questions/1335987/amazon-iap-sandbox-testing-issue.html ) but wanted to try my luck here as well.
So, currently i am trying to implement Amazon IAP into our app (Google and iOS already working).
The app is in Beta on Amazon and can be tested with an invitation and there area few subscription items set up.
I think the best would be just to show you how my implementations looks like atm and what the problems are:
I have the following lines in my PurchaseHandler:
builder = ConfigurationBuilder.Instance(module);
for (int i = 0; i < products.Length; i++)
{
builder.AddProduct(products[i].id, ProductType.Subscription, new IDs { });
Log("Added product available to buy: " + products[i].id + " (" + products[i].price + ", " + products[i].description + ")");
}
//TODO: sandbox only
builder.Configure<IAmazonConfiguration>().WriteSandboxJSON(builder.products);
Where products has a id (exampleItem), price (4.99) etc.
This are the logs im receiving through adb:
Well, the json im receiving has the following information:
I know from the amazon dev page that “Subscription Parent” seems to be the parent SKU, because you have to set TWO SKUs. One parent SKU and another one for the iap item itself. I dont know how to set those though as we can add products only with their ID.
So my problem is that i cant really test this because i dont understand what exactly to change in our project to get this to work and i ready every single documentation site about this.
I really would appreciate it if anyone could help me out here
Hi Desoxi. When you call ‘WriteSandboxJSON’, UnityIAP will write some test data to /mnt/sdcard/amazon.sdktester.json and it contains some fake prices and titles.
If you added some In-App Items in your amazon developer console, you can download your own amazon.sdktester.json file from “In-App Items” tab by clicking “JSON Data File”. And then copy it to /mnt/sdcard/. Do not forget to remove “builder.Configure().WriteSandboxJSON(builder.products);”, otherwise it will overwrite your json file.
Hi Desoxi. It seems like that you app didn’t find any product from amazon.sdktester.json. Please check if Amazon App Tester can read amazon.sdktester.json file: Open Amazon App Tester → Click “In-App Purchasing Api” → Click “5. IAP Items in JSON File”. I attached 2 screenshots to show those steps.
Yes the json information from my first post is taken out of the App Tester app, so there is no problem with the Tester App not able to read the json file
The reason it was spitting out those logs was, that INSIDE the amazon app tester i set all “API Response Settings” to successful. Well, i thought if i set those settings to successful, it will simulate a successful purchase etc. I was wrong.
Setting it all back to default at least let the unity IAP system initialize properly and i was able to “subscribe” and see the transaction inside the amazon app tester.
Im now able to subscribe in Sandbox Mode and see the transaction inside the Amazon App Tester.
The next thing im going to add is a custom amazon validator, as the CrossPlatformValidator only supports Google and Apple at the moment.
EDIT:
I think the most important thing for me to know is, what the equivalent of the GooglePlayTangle.Data() is for Amazon.
Im currently trying to extend the CrossPlatformValidator class to support amazon as well.
But i need the byte[ ] for that.
Unfortunetaley the Products.hasReceipt property is always false (on startup) when i use the amazon store…
Its true when i actually make a purchase with running App tester in background.
Is this always the case or just because im using a selfbuilt .apk in sandbox mode?
I cant say it for sure, but i think its like the receipts from google… as long as we receive a receipt the subscription is active. And if we dont receive a receipt it means that the subscription is over.
I hope this can be tested in a Beta build on amazon.