question

Anton Petrov avatar image
Anton Petrov asked

Appstore SDK Plugin for Unity not invoking PurchaseResponse handler when payment was canncelled

I am using the latest Appstore SDK Plugin for Unity and it works as expected in LAT mode when you complete payment.


But if instead you cancel the payment by pressing the Back button of android the callback of PurchaseResponse is never called. Checked it multiple times!

Is it a bug? This does not allow to implement user-friendly game store flow.

amazon appstoreunity
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

Smile and Learn avatar image
Smile and Learn answered

Hello Anton,

it's not a answer for your question but I think that you can give some help, I'm also trying to use the latest Appstore SDK Plugin for Unity, I've tried using an APK file directly to my Fire Tablet, I've tried using the Live App Testing, but always the GetUserData() event listener get nulls inputs. How did you make it works?

There is my code, hope you can add some light to it. Thanks in advance.

IAmazonIapV2 iapService = AmazonIapV2Impl.Instance;
SkusInput request = new SkusInput();
private List<string> skuList = new List<string>
        {
            "com.amazon.myapp.subscriptions"
        };
private ResetInput requestReset = new ResetInput();

    void Start()
    {
        iapService.AddGetPurchaseUpdatesResponseListener(EventHandlerPurchaseUpdates);
        iapService.AddPurchaseResponseListener(EventHandlerPurchaseResponse);
        iapService.AddGetProductDataResponseListener(EventHandlerProductData);
        iapService.AddGetUserDataResponseListener(EventHandlerUserData);
        iapService.GetUserData();
        request.Skus = skuList;
        requestReset.Reset = false;
        iapService.GetPurchaseUpdates(requestReset);
        iapService.GetProductData(request);
    }

    private void EventHandlerUserData(GetUserDataResponse args)
    {
        Debug.Log("///INIT USER DATA RESPONSE/// ");
        string requestId = args.RequestId;
        string userId = args.AmazonUserData.UserId;
        string marketplace = args.AmazonUserData.Marketplace;
        string status = args.Status;
        Debug.Log("RequestID: " + requestId);
        Debug.Log("userID: " + userId);
        Debug.Log("marketplace: " + marketplace);
        Debug.Log("status: " + status);
        Debug.Log("///END USER DATA RESPONSE/// ");
    }
2 comments
10 |5000

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

Anton Petrov avatar image Anton Petrov commented ·

When I install my APK with adb it never works for me. There are errors in Android logcat about "command service not initialized" and handlers never get called.

I installed Amazon Appstore app (you have it pre-install on your Fire Tablet) and installed the Live App Test version of the game from there.

Then it worked.

0 Likes 0 ·
Smile and Learn avatar image Smile and Learn Anton Petrov commented ·
Thank you Anton, yes, for me was the same, installing with adb never worked, using the Live App Test was the best choice but when I call the GetUserData() it never works, I always get a NullReference, it works for you? you can get the user data?


thank you!

0 Likes 0 ·