Introduction
If you had InApp purchases enabled in your CocoonJS project you can migrate them using any of the new Cocoon cloud available plugins for InApp purchases: iOS AppStore, Google Play Store or Amazon AppStore.
Installation
The InApp purchases plugins will be migrated along with your application configuration when your projects are automatically migrated to the new Cocoon cloud so you should have all the plugins installed in the new Cocoon cloud already. To check if everything is correct go to the old CocoonJS cloud and check which store plugins did you had enabled.
The available CocoonJS store plugins were Apple AppStore, Google Playstore and Amazon Appstore. Check which of them were enabled in the old CocoonJS cloud and check that they are installed in the new Cocoon cloud.
If the plugins that you had in the old CocoonJS configuration are installed, the application is ready to be compiled. Before compiling an APK or a Developer app check your integration in the following step.
Parameters
This plugin doesn’t require any parameter in the new Cocoon cloud.
Integration
The old CocoonJS InApp purchases plugins have been recoded in the the new Cocoon so the API is not exactly the same but we really think it is for good. We have tried to make a simpler and easier to integrate API so the changes in your application code shouldn’t be difficult to implement.
Check the InApp purchases plugins guides to see what modifications you should made in your code to get the new Cocoon InApps plugins working:
Automatic purchases verification
In the old CocoonJS cloud there was an option for automatic purchases verification:
1 2 3 4 5 6 7 8 |
Cocoon.Store.initialize({ sandbox: false, managed: true }); |
The “sandbox” flag was used for verifying the purchase in a sandbox application or a production one. In the new Cocoon this flag doesn’t exist anymore, we automatically choose the right environment for you.
The “managed” flag decided if you were in charge of validating the purchase or if we did it in the backend side. Now you can do it easier, just call a method to handle it yourself or handle it over to the Ludei backend.
1 2 3 4 5 6 7 8 9 10 11 12 |
// Yourself inAppsService.setValidationHandler(function(receipt, productId, completion){ ... //Custom server validation code completion(true); //call completion function with true param if validation succeeds }); // Let Ludei do it inappsService.setLudeiServerValidationHandler(); |
Important: We are currently working on this verification mode for the Cocoon cloud so it doesn’t work at the moment of writing this.
Check the new Cocoon InApp purchases plugins for a complete guide, examples and API.