Archives

How to set up in apps purchase in Android (for dev)

You can only set up a one-time or recurring plan on your platform. Both types cannot be used at the same time.

To find out how to set up in-apps purchases for buying recurring subscription and how to set up server to receive Plays Store server notification, please refer How to set up in apps purchase in Android (for client)

TEST PLAY STORE SERVER NOTIFICATION

  1. Go to Play console: https://play.google.com/apps/publish
  2. Select your app

  1. Scroll to Monetize, click on Monetization setup

inapp_android_12

  1. Click on Send test notification

inapp_android_25

  1. Go to Google console: https://console.cloud.google.com/
  2. At Navigation menu, scroll to ANALYTICS section, click on Pub/Sub

inapp_android_26

  1. Click on Topic ID

inapp_android_27

  1. Click on subscription ID

inapp_android_28

  1. You can view the request count at METRICS tab

CREATE TEST ACCOUNT

  1. Go to Play console: https://play.google.com/apps/publish
  2. Select the app you want to create test account

inapp_android_24

  1. At Navigation menu, scroll to Testing section, click on Internal testing and select Testers tab

  1. Click on Create email list

  1. Create email list

(1) List name: Enter your list name

(2)  Add email address: Enter email address of testers

(3) Upload CSV file: If not enter email at (2), you can upload csv file here

(4) Email addresses added: List the email that you enter or upload

(5) Save changes

  1. Enable the list name and click on Save button

TESTING IN APPS PURCHASE ON DEVICE

  1. Open Play Store and login the email you created test account

  1. Open your app and buy subscription, you will see the test card

inapp_android_29

  1. Click on the test card, you can choose the case to test: approve or decline.

inapp_android_30

  1. After buy subscription successfully (approve or decline), you can view the order manager by accessing https://play.google.com/console and opening Order Management menu

inapp_android_31

Note: Renewal periods: Test subscriptions renew more quickly than actual subscriptions, and test subscriptions can renew a maximum of six times.

The following table lists the testing renewal times for subscriptions of various durations. These times are approximate.

How to set up in apps purchase in Android (for client)

You can only set up a one-time or recurring plan on your platform. Both types cannot be used at the same time.

To find out how to create test account and how to test in-apps purchase with real device, please refer How to set up in apps purchase in Android (for dev)

ADD ANDROID APP PACKAGE NAME

  1. Go to Google Play Console: https://play.google.com/console
  2. Copy your App Package nameinapp_android_1

3. Open Admin Panel, click on Subscription menu 

inapp_android_2

4. Paste the App Package name that you copy to Android app package name field and save changes

inapp_android_3

SET UP IN-APPS PURCHASES FOR BUYING RECURRING SUBSCRIPTION

  1. Open your site, go to AdminCP -> System Admin -> Subscription -> Manage Packages.
  2. Edit Package -> create new Plan -> setting all information and click the Save Changes button

(1) Plan Type: select One Time plan

(2) Title: enter plan title

(3) Price: enter plan price

(4) Plan Duration: setting plan duration

(5) Expiration Reminder: setting expiration reminder

(6) Show at: select Manage Membership

(7) Android Product Id:  enter Android Product Id. This is a unique alphanumeric ID. After you use an Android Product ID for one product, it can’t be used again, even if the product is deleted.

(8) Ios Product Id:

(9) App recurring: tick on

(10) Enable Plan: tick on

3. Go to Play consolehttps://play.google.com/apps/publish

4. Select your app

5. Scroll to Monetize, click on Subscription (under Product)

6. Click on Create subscription button

7. Enter Product ID and Name and click the Create button. Product ID is the Android Product Id that you create in step #2.

Product ID must be unique for your app, and they can’t be changed or reused after they’ve been created.

8. After creating a new subscription, you will be redirected to this subscription detail page. At Base plans and offers section, click on Add base plan.

9. Enter base plan information

(1) Base plan ID: enter a base plan ID. The base plan ID must be unique for your app, and it can’t be changed or reused after it’s been created.

(2) Type: select Auto-renewing.

(3) Billing period: select the period matches the Plan Duration that you setting in step #2.

(4) Grace period: can use the default value (3 days).

(5) Customer base plan and offer changes: select Charge immediately.

(6) Resubscribe: select allow.

10. Scroll to the Price and availability section, click on Set prices.

11. Select all the countries and click on Set price button.

12. Enter price and select currency that match the Price you setting in step #2 and click on Update button.

13. Click on Save button.

Note: Please do not delete products and base plan (step #7 and step #9). You cannot reuse the Product ID and Base plan ID even if you delete the package.

 

SET UP SERVER TO RECEIVE PLAY STORE SERVER NOTIFICATION

  1. Go to Google console: https://console.cloud.google.com/
  2. At Navigation menu, scroll to ANALYTICS section, click on Pub/Subinapp_android_4
  1. Click on CREATE TOPIC

inapp_android_5

  1. Enter Topic ID and click on CREATE BUTTON

inapp_android_6

  1. After creating a new topic, you will be redirected to this topic detail page. Copy Topic name.

inapp_android_7

  1. Click on ADD PRINCIPAL button

inapp_android_8

  1. Enter principal information and click on SAVE button

(1) New principal: enter “google-play-developer-notifications@system.gserviceaccount.com

(2) Role: select Pub/Sub -> Pub/Sub Publisher

8. When creating a topic, the system will automatically create a subscription. Click on this subscription to view subscription detail page

inapp_android_9

9. Click on EDIT

inapp_android_10

10. Setting subscription and click on UPDATE button

  1. Delivery type: select Push
  2. Endpoint URL: enter [yourwebsite]/subscription/subscribe_public/notification_android

Ex: https://moosocial.com/subscription/subscribe_public/notification_android

inapp_android_11

11. Go to Play console: https://play.google.com/apps/publish

12. Select your app

13. Scroll to Monetize, click on Monetization setup

inapp_android_12

14.  Enter the Topic name that you copy in step #5 and click on Save Changes button

inapp_android_13

SETUP SERVICE ACCOUNT

  1. Go to Google consolehttps://console.cloud.google.com/
  2. At Navigation menu, scroll to APIs & Services section, click on Library

inapp_android_14

  1. Search to find “Google Play Android Developer API

inapp_android_15

  1. Open Google Play Android Developer API and enable

  1. At Navigation menu, scroll to IAM & Admin section, click on Service Accounts

inapp_android_16

 

  1. Click on CREATE SERVICE ACCOUNT

  1. Create service account

7.1. Service account details:

(1) Service account name: Enter an arbitrary Service account name

(2) Service account ID: Service account ID will be automatically generated from your Service account name. You don’t need to change it

(3) Service account description: This is optional field

(4). CREATE AND CONTINUE: click to create account and move to next step

7.2. Grant this service account access to project:

(1) Select a role: Open dropdown and select Basic -> Editor

(2) ADD ANOTHER ROLE: click to add more role
You need to add one more role: 
IAM -> Security Admin

(3) CONTINUE: click to move to next step

7.3. Grant users access to this service account

You do not need to set up this step. Click Continue

  1. There is an email that will be automatically generated. Please copy this email for use in the next stage. I will refer to this email as Email (1) for the rest of the tutorial.

Click on the email just created.

  1. Select KEYS

  1. Click on CREATE KEY button, select Create new key

  1. Select Key type is JSON and click on CREATE button

Now, you will download a json file. Please change the file name to “service_account.json” and keep this file for use in the next stage.

UPLOAD JSON FILE

  1. Go to your host server -> open database
  2. Redirect to ../app/Plugin/Subscription/Lib/
  3. Upload the file “service_account.json

ADD USERS AND PERMISSIONS

  1. Go to https://play.google.com/console/
  2. Click on Users and Permissions menu

inapp_android_18

  1. Click on Invite new users

inapp_android_19

  1. Email address: Enter Email (1)

inapp_android_20

  1. Click on Add app, select the app you want to set up users and click on Apply

inapp_android_21

  1. Select the permissions and click on Apply:
  • View app information (read-only)
  • View app quality information (read-only)
  • View financial data
  • Manage orders and subscriptions

inapp_android_22

  1. Click on Inviter user and confirm to send invite

inapp_android_23

How to enable admob for mooSocial Android app

1. Go to admin panel -> plugins manager -> mooApp

2. Enter value for “Google Admob Banner Id “, see below screenshot. Save changes then check to see if the ad appear at android or not. Contact us if you have any problem when configuring.

3. Please search google to know how to setup and get “Google Admob Banner Id”. There are a lot of documents that you can reference.

Screenshot at May 31 10-18-34

 

 

How to enable admob mooApp on iOS”

1. Uncomment Podfile pod ‘Google-Mobile-Ads-SDK’ then run “pod install” in terminal

Screenshot at Jan 20 10-49-40

Screenshot at Jan 20 10-50-03

2. Search in project with keyword: “Support Admob” and uncomment follow pictures

Screenshot at Jan 20 10-50-38

AppViewController.swift

Screenshot at Jan 20 10-51-12

AppDelegate.swift

Screenshot at Jan 20 10-52-03

WKWebview.swift

Screenshot at Jan 20 10-51-46

3. Add GADApplicationIdentifier  to Info app.

Screenshot at Jan 20 10-52-50

Enter key “GADApplicationIdentifier”, Type String, Value is app id on Admob setting (How to get app id, please see NOTE)

Screenshot at Jan 20 10-53-30

4. Enter banner id on settings moosocial: Admin -> Plugin -> mooApp. (How to get banner id, please see NOTE)

Screenshot at Jan 20 10-53-43

5. Run App to  test

Screenshot at Jan 20 10-54-39

—– NOTE —–

1. How to get App Id?

Screenshot at Jan 20 10-55-13

2. How to get Banner Id

Screenshot at Jan 20 10-55-29