React-native-iap: Amazon Appstore

Created on 20 Jan 2019  ·  30Comments  ·  Source: dooboolab/react-native-iap

Does this module support Amazon Appstore IAPs?

❓ question 🏃🏻‍♀️ in progress 🚶🏻 stale 🥺 feature request

Most helpful comment

Not sure if anybody has begun work on this, however I've started implementing the functionality to support the Amazon Appstore IAPs. Hopefully will have a PR ready soon.

All 30 comments

No. We don't support kindle device because we don't have one here. There is PR on our flutter plugin but no one contributed to this one yet.

Not sure if anybody has begun work on this, however I've started implementing the functionality to support the Amazon Appstore IAPs. Hopefully will have a PR ready soon.

@gborges0727 I think you are in. I've changed the label to working. Thank you!

@gborges0727, I see your fork, and that you at least started on some amazon related code.

What is the status of this work?

I'm at the point in my project where I need to add Amazon support.

It would be awesome if someone has already figured this out :)

Work is actually done, just haven’t gotten around to writing up the typescript / updating the readme quite yet. Hopefully will have a PR ready this weekend!

Sweet! Great to hear. I'm actually testing out your fork over the next few days or so. I'll let you know what I find.

My app is specifically using a subscription product with 2 period options ,monthly and annual.

What sort of testing have you done with this? Have you tested subscription products at all?

Also I noticed that your method of determining Amazon vs Other devices is to check for the amazon.hardware.fire_tv feature.

Is this because your app is actually specifically for Fire TV, or will this actually be true for all Amazon devices including tablets and such?

I’ve actually only tested subscription products so if you have any single purchase that would be a good test as well. And my app is specifically for fire_tv which is why i used that. Likely a more general option out there to test against for any amazon device

ok, I found this, which seems like it should be pretty reliable.

import android.os.Build;
isAmazonDevice = Build.MANUFACTURER.equals("Amazon");

My research found other options, including attempting to detect what STORE the app was installed from, but, I figure device detection is good enough for most.

Were you not getting errors about using the Set class?

I was getting the following when trying to use the amazon version of getProductData()

java.lang.RuntimeException: Got unknown argument class: Set

This was my work around:

public RequestId getProductData(ReadableArray skus, Promise promise) {

    //Build Set from ReadableArray
    final Set<String> skusSet = new HashSet<String>();
    for (int i = 0; i < skus.size(); i++) {
      skusSet.add(skus.getString(i));
    }

    savePromise(GET_PRODUCT_DATA, promise);
    RequestId requestId = PurchasingService.getProductData(skusSet);
    return requestId;
  }

Also, do you know how to disable the dependency on Google Play services at runtime, when on an amazon device?

I am getting a popup that says:

[App Name] won't run without Google Play services, which are not supported by your device.

Sorry so many questions, I don't mean to spam you. Thanks again for the awesome work!

I made a few more changes.

If you're interested you can see my fork/branch here:
https://github.com/curiousdustin/react-native-iap/commits/curious

  • I did some work to apply the latest changes from the main fork, mostly the checks for native modules. commit.
  • As mentioned, I found I had to use ReadableArray in place of Set commit
  • I'm checking the manufacturer instead of the specific fire_tv id. commit
  • Because I will be using RVS, I felt it would be useful to add userIdAmazon to the purchase objects. commit

Haven't done a whole lot of testing yet, but seems good so far. Thanks again!

Hey sorry for getting back late! I believe the depedency on google play services at runtime can be resolved by adding something to your AndroidManifest.xml but I can’t recall exactly what it was that I added. The errors around getProductData() could be completely valid! I did not really test that function so could 100% be issues there. Your changes look good! Makes sense to incorporate them before submitting the PR here.

Oh, I forgot to mention, I did figure out that the specific won't run without Google Play services message I was getting, was actually a result of using Firebase. I found a hacky work around to just not initialize Firebase if on Amazon, and I still get warnings in the logs, but it doesn't seem to affect the user anymore.

Any info you can share about the manifest file could still be valuable.

Thanks!

Taking a look back at my androidmanifest i'm not actually sure what I would have included that would have resolved any issue.. Might have been remembering ghosts as far as that is concerned haha. Any luck with testing around some more?

I wouldn't say that I've tested exhaustively. Still only testing with subscription products.

I did add a few more modifications:

Thank you for the work here, I fixed the function that checks which store to use
https://github.com/curiousdustin/react-native-iap/pull/1

Can I use this function? I need it

Is there any documentation on how to use your Amazon code @curiousdustin @gborges0727 ?

I need to add Amazon IAP Support for my apps so I really need this.

@DannyRox23 , sorry, there is no documentation past our discussions here.

Here are some clarifications:

  • Our live app is currently using the code found here: https://github.com/curiousdustin/react-native-iap/commit/a0911a845436f585769af28b12926bdebaf56f45
  • We are using gradle build variants to build a separate APK for amazon. This code in this branch uses the automatically generated build config properties to determine if it is the amazon APK or not.
  • Our app ONLY has 1 Auto-renew Subscription IAP.
  • We have NOT tested any other type of IAP or features.
  • We use server side receipt validation for all platforms.

Hope that helps. Wish I could give back to the community more by fully testing this and adding it to the main library, but I just don't have the time. Thanks again @gborges0727 for doing most of the work 👍

@curiousdustin I appreciate the reply! I used your code and I got rid of the device checks since the app is exclusively for Amazon devices. I am a bit lost, however; even with the device checking, I submitted my Amazon app to Amazon and Amazon reports that the app is using Google's IAP, so they didn't approve the app.

How do I debug the app to see if it's working. Should it show the Amazon IAP purchase window on emulators? Do I need an Amazon device to fully test? Does it work with Bluestacks? Are there any Amazon device emulators I can use?

I was able to remove the google billing warnings by using this manifest file that merges with my main manifest file. I think the key is the line to remove the billing permission.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="fm.pinna.app">

    <uses-permission android:name="com.android.vending.BILLING" tools:node="remove" />

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

</manifest>

There may be Amazon emulators, but I have not used them. I used actual Kindle Fire devices to test with. I have also not used Bluestacks, sorry I don't know if it would work.

For testing, I just followed the Amazon docs.

@hyochan would you be open to merging some Amazon support if it only includes support for Subscription billing?

Who has the most up to date fork of the code / can we try to get the PR into the main package potentially? To echo @benoitdion would it be alright to merge with just support for subscription billing?

I have not fully kept up with the progress of the main react-native-iap module. However, I think there have been major changes since @gborges0727 and I were working on this. Mainly re-working the purchase flow and other breaking changes that come with version 3.0.

https://github.com/dooboolab/react-native-iap/pull/510

So, I don't think either of our Amazon implementations would be ready to merge with the main fork at this time, even for only subscriptions. 😞

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@curiousdustin Do you think you can PR your changes with the Amazon Store compatibility to the master branch ? It would be very useful

The updates we made to support Amazon, are not compatible with the major changes in 3.0. See above.

Was this page helpful?
0 / 5 - 0 ratings