Amazon In App Purchase Failure

Tag: amazon-s3 , in-app-purchase , amazon , kindle , amazon-appstore Author: Crazydog9600 Date: 2012-09-02

Amazon In App is integrated to my game application. But the app submission on the Amazon Distribution Portal has been rejected due to In App purchase failure.

The problem is often the In App purchase fails by reporting error "Error while purchasing items".

I have tried to figure out the issue but unable to do so. Ive tried testing using the AmazonSDKTester.apk and amazon.sdktester.json

described at Amazon In-app purchase and every thing works fine. but on actual enviornment the problem arise. Has anyone faced same issue? or any idea about the problem/solution?

Other Answer1

The following code works fine for me. You can always email Amazon's support to ask for details about why your IAP failed submission. Also, post your code, then we can see what was missing. You have to make sure IAP is working or exits smoothly when you test on a Kindle and other Android devices (Motorola Droid's, HTC's, etc).

private class AmazonPurchasingObserver extends BasePurchasingObserver 
{

    public AmazonPurchasingObserver() 
    {        
        super(oThis);

    }

    @Override
    public void onItemDataResponse(ItemDataResponse itemDataResponse) 
    {        
        //Check itemDataResponse.getItemDataRequestStatus();
        //Use itemDataResponse to populate catalog data
        // Didn't use, items have already been stored locally in the game localization xml
    }

    @Override
    public void onPurchaseResponse(PurchaseResponse purchaseResponse)
    {
        PurchaseRequestStatus status = purchaseResponse.getPurchaseRequestStatus();
        Log.d(sTag, "status: " + status.name());
        if (status == PurchaseRequestStatus.SUCCESSFUL)
        {
            //If SUCCESSFUL, fulfill content;
            Receipt purchaseReceipt = purchaseResponse.getReceipt();
            String sku = purchaseReceipt.getSku();
            successBoughtProduct(sku); // implement the logic you need when a product is successfully bought, ie: increment game scores, save game states, etc.
            Log.d(sTag, "SUCCESS: " + sku);
        }
        else
        {               
            failToBuyProduct(); // implement your own logic to deal with failures
            Log.d(sTag, "FAILED purchase");
        }

    }
} 

public static void amazonPurchaseRequest(String productSku)
{
    Log.d(sTag, "amazonPurchaseRequest: " + productSku);
    PurchasingManager.initiatePurchaseRequest(productSku);      
}

In your AndroidManifest.xml, inside the "application" tag, add:

<application ... etc  
            <receiver android:name = "com.amazon.inapp.purchasing.ResponseReceiver" >
                <intent-filter>
                    <action android:name = "com.amazon.inapp.purchasing.NOTIFY"
                            android:permission = "com.amazon.inapp.purchasing.Permission.NOTIFY" />
                </intent-filter>
            </receiver>     

</application>