3.2 – Setting up IAP for Google Play

Google Play Developer Console

This section assumes you will be uploading a new application to Google. However, if you are updating an existing app that’s already on Google Play, you can skip to step 5. The purpose of this section is to get as much done in the Developer Console as possible before publishing to remove the need to re-upload your APK for testing purposes.

  1. Log into the Google Play Developer Console from the Google account you use to publish apps to the Google Play store. If you don’t have one, you will need to set one up.https://play.google.com/apps/publish/
  2. Click on ‘Add new application
  3. Fill out the form and then click ‘Prepare Store Listing‘. This will allow us to get the License Key necessary for Web Publishing later without having to upload an APK first.
  4. Fill out the ‘Store Listing‘ and ‘Pricing & Distribution‘ pages. You can do this after uploading the APK but you will not be able to publish it to the Play Store until you do so.
  5. From the ‘Services & APIs‘ page, grab the License Key under LICENSING AND IN-APP BILLING. We will be using this in Web Publishing. This is what validates your app to use these services. If you’ve used Amazon IAP before, this is a similar concept to the API Key.

Once you have the License Key, you need to set up your IAPs in Creator. You’ll be coming back to the Developer Console after making the APK in Web Publishing.

Setting Up IAP In Creator

Before publishing your gameproj, you’ll need to set up your in-app purchases in Creator. This is done through the PurchaseTable and the new IAP behaviors introduced in version 0.12 of Creator.

One difference between Google and the other IAP providers (iOS and Amazon) with regards to setting up in-app purchases is that the Product IDs for Google IAP can’t use capital letters.

Also, Product IDs are not case-friendly (meaning “bowlboyconsumable” is not the same as “BowlBoyConsumable”) so you will need to keep this in mind if you plan on making a multiplatform app.

Note that Google has 4 reserved Product IDs that can be used for off-line testing. For more information see the section ‘Offline Testing’ at the end of this doc.

Once your gameproj is ready, upload it to Web Publishing.

Web Publishing

Services

The Services dropdown now has a Google page. This is where you put your License Key from the Google Play Developer Console. Simply copy and paste it into the field and allow it to save.

Android Target

On the Android publishing target page, make sure to use the Package Name you plan on using once it goes live. This cannot be changed once you upload it to Google Play without making a new application and you will not be able to use a previous package name.

You will also need to check ‘Google‘ under In-App Purchases of the Service Configuration section near the bottom of the page.

Generate and Sign the APK. Once you have the APK, you’ll need to go back to the Google Play Developer Console 

Upload APK as an Alpha

Now that you have the APK, it’s time to upload it to the Google Play Developer Console as an Alpha Build so you can test your IAP items before they go live.

 

  1. From the Application’s main page, click on APK from the menu on the left
  2. Click the ALPHA tab
  3. Click on Upload new APK to Alpha
  4. Upload the APK and then click Publish now to Alpha

With the APK uploaded, you can now set up the In-App Purchases in the Google Play Developer Console.

NOTE: Uploads to the Google Play store can take a while before they are available (anywhere from 3-5 hours). However, this does not prevent you from setting up the app’s In-App Purchases, so let’s do that now…

Setting up In-App Purchases in the Google Play Developer Console

  1. Click on ‘In-App Products‘ from the application’s main page on the Google Play Developer Console
  2. Click on ‘Add New Product
  3. Click on ‘Managed Product‘ NOTE: GameSalad Google IAPs are all Managed Products as the transaction information is handled by Google Play.
  4. Enter in the Product ID of one of your IAP items (the same as what you used in the PurchaseTable in your gameproj) , make sure you clicked on ‘Managed product‘ and then click ‘Continue
  5. Fill out the Managed Product Details, Price, and Title for this item and then click ‘Save‘.
  6. Once saved, activate the IAP item by clicking the ‘– Inactive‘ button and then clicking ‘Activate‘.
  7. Repeat steps 2-6 for the rest of your IAP items

You may have noticed that you don’t explicitly set your items as Consumable or Non-Consumable in the Google Play Developer Console. This is handled by your app instead through the PurchaseTable and IAP behaviors.

Once your IAP items are activated, it’s time to test the app.

Testing Google IAP

 

  1. From the Google Play Developer Console main page, click ‘Settings‘ (the gear icon to the left).
  2. Under ‘Account Details‘, add user emails to the License Testing section separated by commas. This allows your testers to use test purchases that don’t actually cost real money.
  3. Set up a Google Group for your testers (http://groups.google.com). Google uses Groups for lists of testers that can download your app from the Alpha and Beta stores. It’s the only way to add test users to your app.

    Only Google accounts on actual Android devices will be able to test In-App Purchases so keep that in mind when adding users.

  4. From the APK page of your app on the Google Play Developer Console, click on the ‘Alpha Testing‘ tab then click on ‘Manage list of testers
  5. Add the Google Group email address to list of in Alpha. Share the test app link with your users. Make sure they are logged into the Google account they plan on testing with.
  6. Ask your testers to click on the ‘BECOME A TESTER’ button to opt-in.

  7. Ask your testers to log into their Android devices with the same Google account they used to sign up for the Google Group. They should now be able to download the Alpha version your app from Google Play.
  8. Verify your In-App Purchases are test purchases by looking for text that says ‘This is a test order, you will not be charged.’ Otherwise, your payment information WILL be charged.

 

Offline Testing

There are 4 reserved Product IDs defined by Google that can be used for offline testing. These IDs can be used to test for various user responses when an attempt is made to purchase the item. Your game does not have to be published to test with these IDs.

  • android.test.purchased : Buying this item will cause a successful purchase response.
  • android.test.canceled : Buying this item will act as if the user had canceled the purchase.
  • android.test.refunded : Buying this item will act as if the purchase was refunded.
  • android.test.item_unavailable : Buying this item will act as if this item was not added to the Google Developer Console for your game.