Add In App Purchases to Your App
This feature is not available on all plans.
After you have created your in app purchases for iOS and Android, it's time to add them to your app. Here's an overview:
- Create the purchase page and add it to your app menu.
- Add the in app purchase plugin(s) to your site.
- Setup your validator
If using subscriptions, you can only have one subscription level in the app.
Create the Purchase Page
Begin by creating a new custom page. Add a new block, and choose the In App Purchase Form.
This block outputs a form that includes an email field for user registration. After purchase, a user is created through our in app purchase plugin.
productId - (required) must match your iOS in app purchase product ID
productIdAndroid - (optional) only use this if product ID is different for Android, otherwise Android will use productId above
isSubscription - (optional) set to "false" if this is a one-time purchase
removeAds - (optional) set to "true" if this purchase should remove Admob Ad banners
noLogin - (optional) set to "true" if login, registration, and validation with WordPress are not required. For example, if this purchase is just to remove ads in the app. No user will be created in WordPress.
Add purchase description
Next you'll need to add a description of the purchase. If your description is incomplete, your app may be rejected.
Add a Text or Custom Content block and include information such as exactly what you get with the purchase, price, frequency, and purchase terms. You must include a link to your privacy policy and terms. For example:
<p>Pay $9/month to get access to 5 premium language lessons: Spanish, Portugese, Mandarin, Japanese, and Italian.</p> <h3>Already purchased?</h3> <p>If you've already purchased but can't see your content, you may just need to login.</p> <p>If you got a new device and need to restore your purchase, click Restore Purchase.</p> <p> </p> <p><strong>What you get:</strong></p> <ul class="smaller-text"> <li>Access to premium content including videos, courses, and more</li> <li>You will be charged $9 each month until you cancel</li> <li>Payment will be charged to account at confirmation of purchase</li> <li>Subscription automatically renews unless auto-renew is turned off at least 24-hours before the end of the current period</li> <li>Account will be charged for renewal within 24-hours prior to the end of the current period, and identify the cost of the renewal</li> <li>Subscriptions may be managed by the user and auto-renewal may be turned off by going to the user's Account Settings after purchase</li> <li><u><a (click)="iab('https://mysite.com/terms')">View terms of use</a></u></li> <li><u><a (click)="iab('https://mysite.com/terms')">View privacy policy</a></u></li> </ul><br>
Save this page and add it to your menu.
Testing Purchases
First, login to your WordPress site and visit the AppPresser settings. Click the "Log" tab, then check "enable logging." This will allow you to see the API calls if there is a problem.
If you setup test users as per our documentation, you can build the app with dev certs for iOS, and no key for Android. Download the app to your test device and try the purchase.
For iOS, you will be prompted to login. Use your sandbox tester email and password.
For Android, you can add yourself as a tester in the Google Play Console under Settings => Manage Testers. You should be able to test the purchase with your normal account, or you can log in as a tester.
Test subscriptions do not match the normal schedule, you can look up the renewal times online.
Click here for a detailed article on testing Android in app purchases.