API way of accessing will be replaced by SDK way of accessing, refer to sdk-client for the sample of similar functionality accessed through SDK.
This project demonstrates Windows and Android sharing C++ code. (Work in progress, please report bugs and suggestions)
In order to build run this sample on Windows you will need libraries 'freeglut' and 'glew'.
One way to get these is to use vcpkg:
./vcpkg install freeglut:x64-windows
./vcpkg install glew:x64-windows
./vcpkg install freeglut:x86-windows
./vcpkg install glew:x86-windows
You will need to setup billing from your Play Console Application and Create in-app products for purchase in this sample.
Also, to sign-in using Google Identity API, you will need to retrieve your Google API client-id and secret
-
Open Teapot-Sdk.sln file using any recent version of Microsoft Visual Studio
-
Open app.config and replace the client_id and client_secret with your Google API client-id and secret.
-
Open AppConfig.json and replace the same client_id and client_secret with your Google API client-id and secret.
-
Press F5 to build and run your application
- Once the application is running correctly, you will be greeted by an OpenGL scene with a teapot and "Billing APIs" button
- Click on the "Billing APIs" button and a debug panel will pop up. Using this panel, you will be able to see a list of the operations you can perform, the API and parameters that will be sent to the server as well as the result once you execute the API request.
- In the Select the operation menu, click on the first menu item "Google Login". The URLs and parameters will automatically change to reflect the backend APIs that will be invoked when you click on the Execute button.
- Click on the Execute button and follow the login process, make sure that you give the permissions requested during the OAuth steps that follows
- Upon returning, you will get the appropriate user access token that can be used to invoke purchase and other subsequent APIs
- With the user access token loaded, proceed to Get SKUs API which will allow you to get a list of all available IAP items and launch the purchase flow on a hardcoded item
- The application will launch the purchase flow using your default browser
- Get all purchased items using the Get Purchase API
- Validate the purchased item using Validate Purchase API
- Acknowledge the purchased item using Acknowledge Purchase API
- Consume the purchased item using Consume Purchase API
- Invoke get all purchased items using the Get Purchase API and you will see that the API now returns no item as it has been consumed
Note that some of the API may return empty string upon success, this is intended and you can modify it in the API Server

















