What do you need to know
The following are the key points that will help you understand Apple App Store and Google Play Store integrations in Chargebee.
It is recommended to go through these points before setting up the integration.
About Integrations
The following are the points to know about Apple App Store and Google Play Store integration in general.
- Both Apple App Store and Google Play Store integrations are supported for Product Catalog 1.0 (PC 1.0) and Product Catalog 2.0 (PC 2.0) accounts in Chargebee. Therefore, irrespective of your account type you can integrate these stores into Chargebee.
- We generate a webhook or notifications URL once the integration is completed and this needs to be configured in the respective stores for Chargebee to receive notifications from these stores. This notification URL can be obtained by referring to the documentation on Apple App Store and Google Play Store .
- Post integration, you need to either use Chargebee's SDK(iOS , Android , Flutter , or React Native ) or Process Purchase Command API to create an initial in-app subscription in Chargebee.
Note: Chargebee cannot create an initial subscription by receiving notification from these stores due to the lack of information on the price and currency of purchase.
- To use SDK or API you need an App ID or SDK key(Apple App Store or Google Play Store ) and a Publishable Key .
- We recommend using Chargebee's SDK for quick integration at the client end without implementing server APIs. In-app subscriptions are supported by Chargebee's iOS , Android , Flutter , or React Native SDKs.
- Apple and Google do not pass the Apple Id and Google Id or any other information about the customer to your application or Chargebee. We recommend passing the Customer Id while invoking the API / purchaseProduct method of SDK, though it is an optional parameter. If you don't pass this parameter, then the Customer Id in Chargebee will be the same as the Subscription Id.
- If the initial subscription is not created using SDK or Process Purchase Command API and the notifications URL is configured for the respective stores, then Chargebee does not process these notifications and returns an error - "Failed to update subscription because it's missing in Chargebee. Import subscription data, and try again."
To resolve this error you can import the subscription data by using the Import Receipt API. Once the initial subscription is recorded in Chargebee you can retry processing the failed notification.
- Once the initial subscription is created in Chargebee, we use webhook events from Apple App Store or Google Play Store and maintain the subscription status in Chargebee.
- In the Chargebee user interface, apply the Channel filter and select APP STORE or PLAY STORE to view store-specific data. This filter can be applied to pages - Customers, Subscriptions, Plans, and Invoices in Chargebee.
About Apple App Store and Google Play Store Plans
Apple App Store or Google Play Store refers to subscription plans as in-app subscription products within their documentation. So both terms plans and products are used in this section.
The following are the points to know about Apple App Store and Google Play Store plans or products.
- Apple or Google products cannot be created using the Chargebee admin user interface. You need to import products from their respective stores to Chargebee. Learn more about importing Apple and Google products.
- While importing products, please ensure that products corresponding to all the currencies configured in the stores are imported to Chargebee.
- Importing Apple or Google products is only needed if you want to import historic subscriptions from these stores to Chargebee or use the
retrieveProductIdentifers
SDK method to retrieve Apple or Google product IDs from Chargebee.
- Suppose you are using the Process Purchase Command API or
purchaseProduct
SDK method(Apple / Google ) to create in-app subscriptions in Chargebee without importing Apple or Google products. In such a case, plans are going to auto-create in Chargebee with the price and currency information available with the API or SDK method.
- Suppose you have a trial period associated with an in-app subscription product in the Apple App Store or Google Play Store then you don't need to import the same. When an in-app subscription is created in Chargebee, we automatically associate the trial period with the plan and subscription created in Chargebee.
- Suppose you are on Product Catalog 1.0 (PC 1.0) and have imported the products from the Apple App Store or Google Play Store; then Chargebee will auto-create the plans. The plan ID will be created by appending the currency code to the related product ID of the Apple or Google store.
- Suppose you are on Product Catalog 2.0 (PC 2.0) and have imported the products from the Apple App Store or Google Play Store then Chargebee will auto-create the product family as ‘Apple-App-store' or ‘Google-Play-store' and create plans within these product families for the imported products. The plan ID in Chargebee will be the same as the product ID of the Apple APP Store or Google Play Store and the plan price point ID will be created by appending the currency code to the related plan ID. All these plans will be associated with the channel - APP STORE or PLAY STORE.
- Any changes done to the plans in Chargebee will not reflect in Apple App Store or Google Play Store. Therefore, if you want to change in-app subscription plans then make changes to respective in-app subscription products in Apple App Store or Google Play Store.
- Suppose you have made changes to in-app subscription product details like price-point or subscription duration of a product in the Apple App Store or Google Play Store. In such a case, you can either edit the related plan in Chargebee using the admin user interface or import(Apple / Google ) the same plan again to reflect the changes in Chargebee.
- Suppose the price-point of an in-app subscription product is changed in Apple App Store or Google Play Store and by chance you missed changing the same in Chargebee. In such a case, Chargebee will override the plan price and create new subscriptions with the updated price-point of the Apple App Store or Google Play Store. Renewals for these new subscriptions will happen as per the new price point but existing subscriptions will renew as per the old price-point.
- Suppose the price point of a product is changed in Apple App Store or Google Play Store and if the same change is done in Chargebee plan as well, then new subscriptions as well as the renewals for existing subscriptions will occur as per the new price-point of the plan.
About Subscriptions
- Subscriptions associated with the channel
app_store
and play_store
cannot be managed directly in Chargebee, as they are controlled by the respective stores. Chargebee relies on event notifications from these stores to handle such subscriptions.
- Apple or Google subscriptions can be created in Chargebee through the Process Purchase Command API or
purchaseProduct
SDK(iOS / Android / Flutter / React Native) method. Once a subscription is in place, Chargebee manages its state based on notification events received from the respective stores.
The status of these notification events is visible on the Sync Events page, categorized under the following status filters:
- Queued: This status is assigned when Chargebee receives a notification event from the Apple or Google store, indicating the event is queued for imminent processing.
- In Progress: This status denotes the ongoing processing of a notification event from the Apple or Google store within Chargebee.
- Success: This status confirms the successful processing of a notification event by Chargebee, originating from either the Apple or Google store.
- Failed: This status indicates Chargebee's inability to process a notification event received from the Apple or Google store.
- Pending: This status is applied when a new subscription awaits creation in Chargebee. It's important to note that Chargebee does not process the INITIAL_BUY or SUBSCRIPTION_PURCHASED notifications. In such cases, the receipt associated with the event is available for download, allowing for the initiation of subscription creation through the Process Purchase Command API. Once the subscription is created using the Process Purchase Command API the 'Pending' event will be automatically removed from the sync events page.
Note: If you have configured Apple's v2 notifications then receipt information will not be available with the event in Chargebee. So we recommend getting the receipt from the mobile device of the user and invoking the process purchase command API to create a subscription in Chargebee. Learn more about how to fetch the receipt from the device.