Skip to content

Tips for Setting Up In-App Purchases with Capacitor

Setting up in-app purchases in a mobile app involves more than just writing code. Between Apple's agreements, Google's compliance checks, and platform-specific gotchas, there's a lot of ground to cover before you can charge your first customer. Here are some practical tips to help you get started with in-app purchases on both iOS and Android using the Purchases plugin.

Prerequisites

Before you begin, make sure you have the following:

  • A Capacitor app with the Purchases plugin installed. To install the plugin, please refer to the Installation section in the plugin documentation.
  • An Apple Developer account with access to App Store Connect (for iOS).
  • A Google Play Developer account with access to the Google Play Console (for Android).

General Recommendations

Before diving into platform-specific setup, here are a few best practices that apply to both iOS and Android.

Handling Unfinished Transactions

On every app launch, call getUnfinishedTransactions() to check for any purchases that weren't properly confirmed. This can happen if the app was closed or crashed before a transaction was completed. If there are unfinished transactions, deliver the purchased content or enable the service and then call finishTransaction(...) for each one.

Adding a Restore Purchases Button

Your app should include a restore purchases button so users can recover their purchases on a new device or after reinstalling. Use syncTransactions() for this. If there are any transactions, deliver the purchased content or enable the service. Unlike the unfinished transactions flow, there is no need to call finishTransaction(...) since transactions returned by syncTransactions() have already been finished.

Choosing Product IDs

To simplify your backend logic, use the same product ID for equivalent products on both Apple and Google. Be careful when choosing your product IDs — they often cannot be changed or reused on either platform once created.

Setting Up In-App Purchases on iOS

Apple's setup process involves multiple steps across your Developer account and App Store Connect. Pay close attention to the details here, as missing a single step can prevent purchases from working.

Accepting Developer Agreements

Under the Agreements section of your Apple Developer account, make sure the following are accepted:

  1. Apple Developer Agreement
  2. Apple Developer Program License Agreement

These agreements are updated regularly and need to be accepted each time they change.

Configuring App Store Connect Business

Under the Business section of App Store Connect, verify the following:

  1. Free Apps Agreement has status Active.
  2. Paid Apps Agreement has status Active.
  3. A bank account has been added with status Active.
  4. All tax forms are completed with status Active (the exact list depends on your region).

Creating Products and Subscriptions

Under the Monetization section of your app in App Store Connect:

  1. Create your in-app purchases or subscriptions.
  2. Fill out all fields on screen, including localization and optional fields.
  3. The product or subscription must have the status Ready to Submit or Waiting for Review, which indicates that no information is missing.

Note

There may be a delay of up to a few hours between a product being properly created and the API returning a response. You may see "Product not found." until then.

Small Business Program

If you qualify as a small business, you can apply to Apple's Small Business Program for a significant reduction in commission fees.

Handling App Store Server Notifications

If you offer renewable subscriptions, your backend must handle the different notification types of App Store Server Notifications. This is how you get notified about events that happen outside your app, such as a subscription renewal, cancellation, or expiration. Make sure to remove a user's access when their subscription has expired.

Setting Up In-App Purchases on Android

Google's setup is generally more straightforward, but there are still a few prerequisites to take care of before creating products.

Completing Compliance and Metadata

Under your app's section in the Google Play Console:

  1. Make sure all compliance steps are completed.
  2. Make sure all metadata steps are completed.

Creating Products and Subscriptions

Under the Monetize with Play section of the Google Play Console:

  1. Under Products, create your one-time products or subscriptions.
  2. Fill out all fields on screen, including price, availability, and tax and policy settings.
  3. The product or subscription must have the status Active.

Note

You can configure your subscription settings and Real-time Developer Notifications under Monetization setup.

Reduced Fee Program

If you qualify as a small business, you can apply to Google's reduced fee program for lower commission fees.

Handling Real-Time Developer Notifications

If you offer renewable subscriptions, your backend must handle the different notification types of Real-time Developer Notifications. Similar to Apple, this is how you get notified about out-of-app events like renewals, cancellations, and expirations.

Testing

Before going live, you should thoroughly test your in-app purchases on both platforms.

On iOS, Apple provides two approaches: Sandbox testing with test accounts created in App Store Connect, and StoreKit testing in Xcode using a local configuration file (iOS 14+). Sandbox testing requires a physical device with a sandbox account signed in under Settings > Developer > Sandbox Apple Account — you do not need to log out of your main Apple account. StoreKit testing works entirely locally without server connectivity.

On Android, you need to upload your app to the Google Play Console (the internal testing track is sufficient), add test accounts under Settings > License Testing, and install the app from Google Play rather than via direct APK installation.

For full details, see the Testing section in the plugin documentation.

Stay Updated

Want to stay up to date with the latest features and guides? Subscribe to the Capawesome newsletter.

Subscribe to the Capawesome Newsletter

Conclusion

Setting up in-app purchases requires careful attention to platform-specific requirements, from Apple's agreements and App Store Connect configuration to Google Play's compliance steps and product setup. By following this guide and handling edge cases like unfinished transactions and server notifications, you'll be well prepared to monetize your Capacitor app on both platforms.

For the full API reference and additional details, check out the Purchases plugin documentation. Have suggestions or questions? Join the Capawesome Discord server to connect with the community. And subscribe to the Capawesome newsletter to stay updated on the latest news.