question

Kevin@Amazon avatar image
Kevin@Amazon asked

IAP v21 v2 Overview

As we have just rolled out an update to our IAP API (v1 > v2), we felt it may be helpful to provide a ‘cliff note’ version of the updates. The main update to v2 is to allow 3rd party apps to retrieve unfulfilled consumable items; we have also changed the method names and associated callbacks as well. Note that v1 and v2 are both included in the SDK, you will want to use v2 as v1 is now deprecated. A summary of IAP v1 (deprecated) and IAP v2 follows: [b]IAP (v1)[/b] This SDK (now deprecated) was made up of 5 method calls and associated callbacks - made to be used together. These are NOT a sync call. A request is made and then awaits a response of 2-3 sec. The IAP API connects to the App Store Connection, runs to the AMZ cloud and back. Method > Callback • regesterObserver() > onSDKAvailable(Boolean) • iniateGetItemDataRequest() > onGetItemDataResponse() • initiatePurchaceUpdatesRequest > onPurchaseUpdatesResponse() • initatePurchaseRequest() > onPurchaseResponse() • initiatesGetUserIdRequest > onGetUserIdRequest() You wrap all the callbacks into the PurchaseObserver onSDKAvailable(Boolean) – this is really testing to make sure communicating with App store -TRUE: using SDK tester initatePurchaseRequest(String) -String is a SKU for IAP item -If you use packageName and IAP name makes looking at logs easier for you iniateGetItemDataRequest() – called at beginning to get a SET of valid SKU’s -If done properly like this should NEVER get invalid SKU. -Also returns PRICE initiatesGetUserIdRequest() – only intended use for this is RVS – it is a hash of ASIN and ECID initatePurchaseRequest() – a lot of developers ignore this (bad idea)   initiatePurchaceUpdatesRequest() – only way to tell if Subscription valid. Also pulls stuck items from ToDoQueue. - put in OnStaart Edge cases - initiatesGetUserIdRequest() – can use to make sure the user logged in is the registered user for the entitlement - NO transaction ID - Purchasetoken cannot be used – it uses time hash so always different – this used for RVS only along with Dev Secret [b]IAP(v2)[/b] The main update to v2 is to allow 3rd party apps to retrieve unfulfilled consumable items. It also allows for the ability of 3p aps notifying Amazon on the fulfillment of consumable purchases and provides a unique transaction ID. One quick way to determine if your app is using v1 vs v2 is the manifest: V1: V2: Method > Callback • registerListener () > N/A - register an instance • getUserData() > onUserDataResponse() • getProductData() > onProductDataResponse() • purchase(sku) > onPurchaseResponse() • notifyFulfillment() > fulfillmentResult FULFILLED, UNAVAILABLE • getPurchaseUpdates() > onPurchaseUpdatesResponse() registerListener(PurchasingListener listener) - Registers a PurchaseListener instance which will handle all of API responses. RequestId getUserData () - to get information of the current user - Requests the information of the currently logged-in user. When the response is ready, PurchasingListener.onUserDataResponse() will be called with UserDataResponse object, which contains an app-specific user ID and a marketplace code. RequestId getProductData (java.util.Set skus) - to get information of products - Requests product data for the given skus. When the response is ready, PurchasingListener.onProductDataResponse() will be called with ProductDataResponse object, which contains the information of products requested. RequestId purchase (String sku) - to start an item purchase flow - Initiates a purchase flow for the given sku. This will open up a purchase dialog where the user can see the information of the product and purchase it. When the purchase dialog closes, PurchasingListener.onPurchaseResponse() will be called with PurchaseResponse object, which contains the result of the purchase and the receipt if the purchase was successful. RequestId getPurchaseUpdates (boolean reset) - to get purchase updates for the current user - Requests purchase updates for the currently logged-in user. When the response is ready, PurchasingListener.onPurchaseUpdatesResponse() will be called with PurchaseUpdatesResponse object. [b]Known Issues and Helpful Notes v2:[/b] • Each transaction now has a unique ID that you can use for tracking • You will need to implement a fulfilled acknowledgement for each receipt • V1 was tested via the AmazonSDKTester.apk included in the SDK zip. This WILL NOT WORK for IAP v2. The new IAP tester is NOT included in the zip, you will need to download the app from the Amazon Appstore: http://www.amazon.com/Amazon-App-Tester/dp/B00BN3YZM2/ref=sr_1_fkmr1_1?s=mobile-apps&ie=UTF8&qid=1405025087&sr=1-1-fkmr1&keywords=iap+app+tester • For RVS testing, after you register the listener (registerListener(PurchasingListener listener)) you can then query PurchaseService.IS_SANDBOX_MODE() – returns ‘true’ if in sandbox and ‘false’ if Live.
iap
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Pankaj avatar image
Pankaj answered
Hi Kevin, I am about to start IAP migration in my app. In IAP v2 documents its written to call [b]notifyFulfillment()[/b] for each receipt that we get and for every purchases. I have subscriptions in my app that user can buy, what I wanted to know is that is it necessary to call the [b]notifyFullfillment()[/b] method for the subscription receipts also? Becoz with the reset flag set to false, IAP won't return already returned receipts, right?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Kevin@Amazon avatar image
Kevin@Amazon answered
Hi Pankaj, Yes, it is recommended that you call notifyFulfillment() for subscriptions and entitlements as well when a user first purchases an item. This helps track the fulfillment status of purchases. You must implement this call after the item is fulfilled to send the status of the purchase to Amazon. If you do not call notifyFulfillment() with the FULFILLED status after the item is fulfilled, the delivery remains pending. In this case, the delivery attempts will continue to be made through the onPurchaseUpdatesResponse() callback the next time you call getPurchaseUpdates(). Eventually, the order may be canceled if Amazon does not receive explicit acknowledgement of fulfillment with this API. You can then call Call PurchasingService.getPurchaseUpdates() with reset equal to false to retrieve the current state of receipts for your pending consumables, entitlements, and subscriptions – this will help you synchronize both entitlements and subscriptions. Setting reset equal to false will simply give you a paginated response of purchase history since the last call to getPurchaseUpdates(); this is the recommended approach. Setting reset equal to true indicates you want a paginated response of the entire purchase history for the customer.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Pankaj avatar image
Pankaj answered
OK, thanks
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

amazongangadhar avatar image
amazongangadhar answered
HI, Does amazon kindle supports IAP for all devices(Generations) ? In my device , When i am trying purchase from app Viber, it is showiing dialog box Title is :- Can't complete purchase. Text is:- This purchase can't be completed because your device doesn't support In-App Purchases. Thanks.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
IAP is supported in all Kindle devices. It is so unfortunate that you are facing issues while doing the transaction in Viber. For questions related to end user experience with Amazon Apps or other parts of Amazon user experience, please direct your inquiries to: https://www.amazon.com/gp/help/contact-us/general-questions.html
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

magentared avatar image
magentared answered
HI, Did you mean "Each transaction now has a unique ID" is "Receipt ID"? Do I should use Which ID to unique ID ? thanks
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

DougM@Amazon avatar image
DougM@Amazon answered
Hello magentared , The receiptID would be what you would want to use as a Unique ID. For more information, we discuss the various fields in our Fundmanentals of IAP 2.0 guide: https://developer.amazon.com/public/apis/earn/in-app-purchasing/docs-v2/fundamentals-of-iap-2.0
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Pankaj avatar image
Pankaj answered
Hello Guys, I'm not able to verify the receipts generated by SDK Tester app (used in 1.0) using the IAP 2.0 RVS in sandbox mode. I wanted to ask a simple question, whether the IAP 2.0 RVS will be able to correctly manage the old purchases that were made using IAP 1.0 both in sandbox and production environment?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Nick Gardner avatar image
Nick Gardner answered
You can use RVS to handle V1 purchases, but you'll need to migrate the purchases from v1 to v2 and update the URLs and responses: https://developer.amazon.com/public/apis/earn/in-app-purchasing/docs-v2/migrate-iapv1-apps-to-iapv2#Updating the Receipt Verification Service (RVS) URLs and Responses
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Pankaj avatar image
Pankaj answered
Thanks Nick.... I've migrated my app's code and URLs to IAP 2.0, but still I'm not able to verify the receipt returned by SDK Tester app (IAP V 1.0). Can you please explain your statement [b]"migrate the purchases from v1 to v2"[/b]
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.