question

amazongangadhar avatar image
amazongangadhar asked

Retriving InApp receipts with "PurchasingService.getPurchaseUpdates(true)"

Hi, I am using InApp purchase(Subscripton) in MyApplication and Subsribed to an item successfully. At one condition, I am un-able to validate receipt. So that record is not updating in Server Table. Whenever I again trying to Subscrbe , It is showing "You are already subscribed to this item". At this time I am calling a method PurchasingService.getPurchaseUpdates(true). But I am un-able to get receipts, the no of receipts are zero. In sand box mode , I am able to get all receipts. My Code is: @Override public void onPurchaseResponse(final PurchaseResponse response) { Log.i(TAG, "onPurchaseResponse: "); final PurchaseResponse.RequestStatus status = response.getRequestStatus(); switch (status) { case SUCCESSFUL: break; case ALREADY_PURCHASED: if (HomeActivity.getInstance() != null) { HomeActivity.getInstance().updatePurchases(); } else if (SubscribeActivity.getInstance() != null) { SubscribeActivity.getInstance().updatePurchases(); } break; case INVALID_SKU: break; case FAILED: case NOT_SUPPORTED: break; } } and My onPurchaseUpdatesResponse is below @Override public void onPurchaseUpdatesResponse(final PurchaseUpdatesResponse response) { final PurchaseUpdatesResponse.RequestStatus status = response.getRequestStatus(); switch (status) { case SUCCESSFUL: final String userId = response.getUserData().getUserId(); iapManager.setAmazonUserId(response.getUserData().getUserId(), response.getUserData().getMarketplace()); Log.i(TAG, "response.getReceipts().size()===>"+response.getReceipts().size()); if(response.getReceipts().size() == 0){ } for (final Receipt receipt : response.getReceipts()) { iapManager.handleReceipt(response.getRequestId().toString(), receipt, response.getUserData()); Date receiptDate = receipt.getPurchaseDate(); String expiresOn = CastApplication.mPref.getString(ConstantManager.EXPIRES_ON, ""); Date userRegTime = new Date(Long.parseLong(expiresOn)); if(CAUtils.isValidReceipt(receiptDate, userRegTime)){ String phoneNo = CastApplication.mPref.getString(ConstantManager.PREF_PHONE_NO, ""); validatePurchase(phoneNo, userId, receipt.toJSON().toString()); } } if (response.hasMore()) { PurchasingService.getPurchaseUpdates(false); } iapManager.reloadSubscriptionStatus(); break; case FAILED: case NOT_SUPPORTED: break; } }
amazon appstore
10 |5000

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

1 Answer

DougM@Amazon avatar image
DougM@Amazon answered
Hello, If you are still experiencing this issue, please contact us at : https://developer.amazon.com/public/support/contact/contact-us with what version of the In-App Purchasing SDK, what app this is occurring on and whether it a live app test or a live app.
10 |5000

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