-
Notifications
You must be signed in to change notification settings - Fork 3
Split the different pages you need to visit #577
base: main
Are you sure you want to change the base?
Conversation
PreviewsSee contents
Sandbox ConsiderationsProducts, prices, and metadataIn sandbox, StoreKit Test, and TestFlight environments, prices will often not reflect the actual prices set in App Store Connect. This is due to these environments being relatively unstable, does not necessarily indicate an issue with your implementation, and is not commonly seen in the production environment. In these testing environments, you should ensure the purchase flow works as expected, rather than the prices and metadata being accurate. Unfortunately Apple's API can sometimes just be inaccurate, especially with different regions set for devices/accounts. Create a Sandbox Test AccountIn order to test your purchases, you'll need a sandbox test account. You can create test accounts from your App Store Connect dashboard > Users and Access > Sandbox Testers. If you need help, you can refer to Apple's guide on creating sandbox testers here.
LocalizationTo test purchases in different regions, you should set your sandbox user's App Store Country or Region property to the territory you'd like to test. [block:image] Testing on DeviceThis section is for testing on a physical device. If you want to test on the simulator, skip to the next section for instructions on how to get started with StoreKit testing. Add the Sandbox Test Account to Your DeviceOn iOS 13 and earlier, even for sandbox purchases, you'll need to test on a real device. Starting from iOS 12, you're able to add a sandbox account to your device without having to sign out of your Apple Developer account. On iOS 12 or greater, navigate to On iOS 13 or greater, navigate to On macOS 11.5.2 or greater, navigate to Add the sandbox account credentials that you previously created. (The sandbox account credentials won't appear until you've made a purchase using a sandbox account in a development build.) [block:image]
iOS 14+ Only: Testing on the SimulatorStarting from iOS 14, you can test sandbox purchases in the simulator. If you're using a physical device, you can skip this section. Testing on the simulator requires one of these SDK versions:
Step 1: Add a StoreKit Configuration FileGo to File > New > File... in the menu bar and select StoreKit Configuration File. You can enable the "Sync this file with an app in App Store Connect" checkbox to have the file automatically configured with the in-app purchases or subscriptions already set up in App Store Connect. Save the file in the top-level folder of your project and add it to your targets. [block:image] [block:image] Step 2: Create a New Scheme for StoreKit TestingClick the scheme in the scheme menu and click Manage Schemes... Select your current scheme and click Duplicate. In the scheme editor, add the StoreKit Configuration file you created in Step 1 and click Close. Step 3: Setting up the StoreKit Configuration FileIn the editor, click the "+" button at the bottom and create a new product. In this tutorial, an auto-renewable subscription will be created. Enter a name for a new subscription group and click Done. The subscription group name should match one that is set up for your app in App Store Connect, but it's not a requirement. That means you can test your subscription groups and products in the simulator and then create the products in App Store Connect later.
Configure the subscription as needed by filling in the Reference Name, Product ID, Price, Subscription Duration, and optionally an Introductory Offer. Again, this product doesn't have to exist in App Store Connect for you to test purchasing in the simulator. Here is a sample configuration: Repeat this for as many products as you want. Step 4: Uploading the Public Certificate to RevenueCatGo to Editor > Save Public Certificate and save the public certificate to your project. Go to your app's configuration page in your RevenueCat project settings (Project Settings > Apps > [Your App]). Expand the dropdown StoreKit testing framework and upload the certificate to your app. If successful, you should see Certificate added.
Make a PurchaseBuild and run your app on your device. When you attempt to make a purchase, you may be still be prompted to sign in with the sandbox account you just created.
Verify the Transaction Appears in the DashboardAfter a purchase is successful, you should be able to view the transaction immediately in the RevenueCat dashboard. If the purchase does not appear in the dashboard, it's not being tracked by RevenueCat.
Working with SubscriptionsIn the the sandbox environment, subscription renewals happen at an accelerated rate, and auto-renewable subscriptions renew a maximum of six times per day. This enables you to test how your app handles a subscription renewal, a subscription lapse, and a subscription history that includes gaps. Because of the accelerated expiration and renewal rates, sometimes not all renewals are reflected in the RevenueCat customer dashboard. Deleting Test UsersWhen testing, it may be helpful to delete a customer and all their receipts from RevenueCat to simulate a new installation. You can delete a specific user from the customer dashboard in RevenueCat. See our docs on deleting users for more information.
TestFlightTestFlight is a hybrid environment that uses production Apple IDs but purchases occur in sandbox, which can cause unexpected issues that are very likely undocumented by Apple. Common ErrorsIf you're getting the error "Account Not In This Store" when attempting to make a purchase on macOS, try to:
Next StepsFor more information, take a look at the official Apple documentation: temp/creating-play-service-credentials.md See contentsIn order for RevenueCat's servers to communicate with Google on your behalf, you need to provide a set of service credentials. The process for configuring these credentials is a bit complex, but the added level of control improves security by providing RevenueCat with only the access we need.
SetupNote that this setup takes place on both the Google Play Console and the Google Cloud Console. Due to the nature of the process, there’s some switching back and forth between each console that can’t be helped, but each step will make clear which console you should be looking at. 1. Enable the Google Developer and Reporting APITo enable the Developer and Reporting APIs for your Google Cloud Project, you’ll want to do the following:
After enabling the API, you will be redirected to your Google Cloud API page. From there, if you do not have credentials, you will need to create these following the prompt. You'll want to select that you are using the Google Play Android Developer API. Note that you'll want to generate these with either the owner of the project or a user that has the permissions from step 3 enabled in Google Play Console. You will then be redirected to create your form of credentials which you can follow step 2 for. If you just created your credentials, you may see the “To use this API, you may need credentials” message on your API console, this is because your credentials have not yet been validated. This will be done automatically by Google. 2. Create a Service Account
a. Create and name the service account key credentials and add roles.Select the button to 'Create Service Account'. These are the credentials that RevenueCat will need to communicate with Google. Name your new account, then select 'Create and continue'. On the step named 'Grant this service account access to project', you'll add two Roles:
Note that searching by name in the filter does not always bring up both roles. You can also find each by scrolling through the list - in the Pub/Sub and Monitoring folders respectively. You can skip the optional third step, and select done. [block:image] b. Create and download the public keyIn the 'Service Accounts' section of the Google Cloud Console, select the three dots for the Actions dropdown menu, then Manage Keys. Select Add Key, then Create new key. On the pop up, make sure JSON is selected, and then create and download the JSON Key. We'll use this in Step 4. [block:image]
3. Grant Financial Access to RevenueCat
In the Google Play Console, go to the 'Users and Permissions' section' and select invite user. You'll want to invite the service account you created in Step 2. Under 'App permissions' you need to add your app. Then under 'Account permissions', you need to grant certain permissions in order for RevenueCat to properly work. Grant the following permissions:
All other choices are yours - the other boxes can be checked or unchecked according to your needs, as long as those three are selected. Select invite user at the bottom of the page, and send the invite. You'll then be redirected to 'Users and Permissions', where you should see your newly created account as active. 4. Enter the Credentials JSON in RevenueCat
Find your credentials JSON file that was downloaded in Step 2 and either drop it into your project settings or select it from the finder. Be sure to save changes. Within approximately 36 hours, your credentials will be activated and we’ll be ready to handle Google Play purchases! [block:image]
Check the status of your credentialsWith our Google Play credential validation, we will validate every time Google credentials are (re)uploaded or at any time through a click of a button. A summary message will appear with the results of the validation to provide you additional information about the status of your Google credentials. Once your credentials are valid, you will see a "Valid credentials" message under your uploaded JSON file with all permissions checked. Troubleshooting the credential validationBefore starting to dive deeper in troubleshooting your credentials, you should confirm the following:
subscriptions APIIf the permission to call subscriptions API validation is not passing, that means we were unable to use your credentials to receive a response from Google's GET subscriptions endpoint. Ensure that you have granted the following permissions:
You will also want to make sure that you have uploaded your signed APK or Android App Bundle and have completed all the steps to approve the release. inappproducts APIIf the permission to call inappproducts API validation is not passing, that means we were unable to use your credentials to receive a response from Google's GET inappproducts endpoint. Ensure that you have granted the following permission:
monetization APIIf the permission to call monetization API validation is not passing, that means we were unable to use your credentials to receive a response from Google's LIST monetization endpoint. Ensure that you have granted the following permission:
After making changes to your Google credentials, it may take 24 hours, up to 36 hours, for the changes to populate throughout Google's servers. TroubleshootingThis guide contains a lot of information and many steps, and it can be all too easy to move too quickly or simply misconfigure something. Break down each step by where it needs to take place as you're going through the guide or after the fact with our handy Checklist. Error HandlingCommonly occurring errors when setting up your service credentials or developer notifications and what to do when you see them.
|
Motivation / Description
Split the different pages you need to visit for enabling the Google Developer and reporting api to make it clearer that there are two pages to visit.
Changes introduced
Linear ticket (if any)
Additional comments