BLRInAppPurchase
1.0.0
|
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
Typedefs | |
Public (opaque) object types. | |
These are object types you will use in the API. | |
typedef struct BIAP_AppStore | BIAP_AppStore |
typedef struct BIAP_ProductResponseData | BIAP_ProductResponseData |
typedef struct BIAP_TransactionResponseData | BIAP_TransactionResponseData |
typedef struct BIAP_Product | BIAP_Product |
Functions | |
Setup/Initialization Functions | |
These functions setup and create your app store connection. | |
void | BIAP_RegisterKey (enum BIAP_StoreName store_name, const char *the_key) |
Allows you to register your public key for the app stores that require it. More... | |
void | BIAP_Init (void) |
Initializes the library. More... | |
bool | BIAP_IsInit (void) |
Has the library been initialized? More... | |
void | BIAP_Quit (void) |
Shuts down the library. More... | |
struct BIAP_AppStore * | BIAP_CreateAppStore (enum BIAP_StoreName store_name, void *native_platform_context, BIAP_ProductResponse product_response_callback, BIAP_TransactionResponse transaction_response_callback, void *user_data) |
Creates and starts a connection to the app store. More... | |
void | BIAP_StartAppStore (struct BIAP_AppStore *app_store) |
Starts the app store. More... | |
void | BIAP_FreeAppStore (struct BIAP_AppStore *app_store) |
Disconnects and frees your app store instance. More... | |
Core Workflow Functions | |
These functions are the core/primary functions to interact with the app store. | |
enum BIAP_StoreName | BIAP_GetAppStoreName (struct BIAP_AppStore *app_store) |
Gets the name of the app store you are connected with. More... | |
void | BIAP_RequestProducts (struct BIAP_AppStore *app_store, const char *nonconsumable_product_identifier_list[], size_t num_nonconsumables, const char *consumable_product_identifier_list[], size_t num_consumables, const char *subscription_product_identifier_list[], size_t num_subscriptions) |
Requests product information from your connected app store. More... | |
void | BIAP_PurchaseProduct (struct BIAP_ProductResponseData *callback_data, struct BIAP_Product *the_product) |
Purchases the specified product from the app store. More... | |
void | BIAP_FinishTransaction (struct BIAP_TransactionResponseData *callback_data) |
For those that require it, notifies the app store that the transaction is finished. More... | |
void | BIAP_ConsumePurchase (struct BIAP_TransactionResponseData *callback_data_of_purchase) |
Consumes a consumable purchased product. More... | |
void | BIAP_RestorePurchases (struct BIAP_AppStore *app_store) |
Requests all purchases a user has bought from the app store. More... | |
Functions for getting Product Properties | |
These functions return the product properties contained inside a BIAP_ProductResponseData during your product callbacks.
| |
struct BIAP_AppStore * | BIAP_GetProductAppStore (struct BIAP_ProductResponseData *callback_data) |
Gets the app store handle that this callback originated from. More... | |
enum BIAP_EventType | BIAP_GetProductEventType (struct BIAP_ProductResponseData *callback_data) |
Gets the BIAP_EventType associated with this callback data. More... | |
const char * | BIAP_GetProductErrorString (struct BIAP_ProductResponseData *callback_data) |
Gets the error string associated with this callback data. More... | |
size_t | BIAP_GetProductsListCount (struct BIAP_ProductResponseData *callback_data) |
Gets the number of valid products returned from your product request. More... | |
struct BIAP_Product * | BIAP_GetProductInList (struct BIAP_ProductResponseData *callback_data, size_t list_index) |
Gets a valid product from a list of valid products returned from your product request. More... | |
struct BIAP_Product * | BIAP_GetProductWithIdentifier (struct BIAP_ProductResponseData *callback_data, const char *product_identifer) |
Searches and returns a valid product from a list of valid products returned from your product request by the product identifier you specify. More... | |
const char * | BIAP_GetProductTitle (struct BIAP_ProductResponseData *callback_data, struct BIAP_Product *product_object) |
Gets the product title string for the specified product. More... | |
const char * | BIAP_GetProductDescription (struct BIAP_ProductResponseData *callback_data, struct BIAP_Product *product_object) |
Gets the product description string for the specified product. More... | |
const char * | BIAP_GetProductIdentifier (struct BIAP_ProductResponseData *callback_data, struct BIAP_Product *product_object) |
Gets the product identifier string associated with this product. More... | |
const char * | BIAP_GetProductLocalizedPrice (struct BIAP_ProductResponseData *callback_data, struct BIAP_Product *product_object) |
Gets the product localized price string for the specified product. More... | |
size_t | BIAP_GetInvalidProductsListCount (struct BIAP_ProductResponseData *callback_data) |
Gets the number of invalid products returned from your product request. More... | |
const char * | BIAP_GetInvalidProductIdentifier (struct BIAP_ProductResponseData *callback_data, size_t list_index) |
Gets a invalid product from a list of invalid products returned from your product request. More... | |
Functions for getting Transaction Properties | |
These functions return the transaction properties contained inside a BIAP_TransactionResponseData during your transaction callbacks.
| |
struct BIAP_AppStore * | BIAP_GetTransactionAppStore (struct BIAP_TransactionResponseData *callback_data) |
Gets the app store handle that this callback originated from. More... | |
enum BIAP_EventType | BIAP_GetTransactionEventType (struct BIAP_TransactionResponseData *callback_data) |
Gets the BIAP_EventType associated with this callback data. More... | |
const char * | BIAP_GetTransactionErrorString (struct BIAP_TransactionResponseData *callback_data) |
Gets the error string associated with this callback data. More... | |
enum BIAP_FailedTransactionType | BIAP_GetTransactionErrorType (struct BIAP_TransactionResponseData *callback_data) |
Gets the BIAP_FailedTransactionType associated with this callback data. More... | |
const char * | BIAP_GetTransactionProductIdentifier (struct BIAP_TransactionResponseData *callback_data) |
Gets the product identifier string associated with this callback data. More... | |
long long | BIAP_GetTransactionPurchaseTime (struct BIAP_TransactionResponseData *callback_data) |
Gets the transaction purchase time in milliseconds since Epoch (Unix 1970). More... | |
long long | BIAP_GetTransactionOriginalPurchaseTime (struct BIAP_TransactionResponseData *callback_data) |
(Android-only) Gets the original transaction purchase time in milliseconds since Epoch (Unix 1970). More... | |
const char * | BIAP_GetTransactionOriginalJson (struct BIAP_TransactionResponseData *callback_data) |
(Android-only) Gets the JSON formatted receipt for a transaction. More... | |
(Apple) Receipt APIs | |
These functions allow you to interact with Apple's receipt system. They are safe to call on Android, but will not have any useful effect. | |
void | BIAP_RequestReceiptRefresh (struct BIAP_AppStore *app_store) |
(Apple-only) Refreshes the user's purchases receipt on the file system. More... | |
const char * | BIAP_GetReceiptPath (struct BIAP_AppStore *app_store) |
(Apple-only) Gets the path to the receipt on the file system. More... | |
Debugging APIs | |
These functions are releated to debugging. | |
void | BIAP_SetDebugLogging (bool should_enable) |
Enables extra debug log messages in the library. More... | |
bool | BIAP_IsDebugLogging (void) |
Returns whether debug logging is enabled. More... | |
Platform Specific APIs | |
These functions are special platform specific APIs that only exist on specific platforms. | |
bool | BIAP_Android_HandleOnActivityResult (void *jni_env, void *original_activity, int32_t request_code, int32_t result_code, void *intent_data) |
(Android-only) Call this function in your Android Activity's onActivityResult method. More... | |
Store Name constants | |
These are constants you should use to distinguish between the different stores. | |
enum | BIAP_StoreName { BIAP_STORE_UNKNOWN = -2, BIAP_STORE_DEFAULT = -1, BIAP_STORE_NONE = 0, BIAP_STORE_APPLE, BIAP_STORE_GOOGLEPLAY, BIAP_STORE_AMAZON, BIAP_STORE_SAMSUNG, BIAP_STORE_NOKIA, BIAP_STORE_APPLAND, BIAP_STORE_APTOIDE, BIAP_STORE_APPMALL, BIAP_STORE_SLIDEME, BIAP_STORE_YANDEX, BIAP_STORE_FORTUMO, BIAP_STORE_SKUBIT, BIAP_STORE_SKUBITTEST, BIAP_STORE_WINDOWSSTORE } |
typedef enum BIAP_StoreName | BIAP_StoreName |
Callback Functions | |
There are two callback functions you must provide. One is for receiving product information. The other is for all other (transaction) information. | |
typedef void(* | BIAP_ProductResponse) (enum BIAP_EventType callback_type, struct BIAP_ProductResponseData *callback_data, void *user_data) |
This is the function signature for your Product callbacks. More... | |
typedef void(* | BIAP_TransactionResponse) (enum BIAP_EventType callback_type, struct BIAP_TransactionResponseData *callback_data, void *user_data) |
This is the function signature for your Transaction callbacks. More... | |
void | BIAP_FreeProductResponseData (struct BIAP_ProductResponseData *callback_data) |
Frees the memory for the BIAP_ProductResponseData that was created for you in the Product callback. More... | |
void | BIAP_FreeTransactionResponseData (struct BIAP_TransactionResponseData *callback_data) |
Frees the memory for the BIAP_TransactionResponseData that was created for you in the Transaction callback. More... | |
typedef struct BIAP_AppStore BIAP_AppStore |
typedef enum BIAP_EventType BIAP_EventType |
typedef enum BIAP_FailedTransactionType BIAP_FailedTransactionType |
typedef struct BIAP_Product BIAP_Product |
typedef void(* BIAP_ProductResponse) (enum BIAP_EventType callback_type, struct BIAP_ProductResponseData *callback_data, void *user_data) |
This is the function signature for your Product callbacks.
This is the function signature for your Product callbacks. The function you create must be passed to BIAP_CreateAppStore and all product callbacks will be sent to your function.
callback_type | This tells you the status of your network request, typically BIAP_EVENT_PRODUCT_REQUEST or BIAP_EVENT_REQUEST_FAILED. |
callback_data | This contains all the data sent to you from your product request. Use the BIAP_GetProduct* functions on this object to pull out the proerties you want. You must free this object with BIAP_FreeProductResponseData when you are done with it. |
user_data | This is the same pointer you passed as user data when you called BIAP_CreateAppStore. |
typedef struct BIAP_ProductResponseData BIAP_ProductResponseData |
typedef enum BIAP_StoreName BIAP_StoreName |
typedef void(* BIAP_TransactionResponse) (enum BIAP_EventType callback_type, struct BIAP_TransactionResponseData *callback_data, void *user_data) |
This is the function signature for your Transaction callbacks.
This is the function signature for your Transaction callbacks. This is the catch all for all callbacks not in the Product callback category. The function you create must be passed to BIAP_CreateAppStore and all product callbacks will be sent to your function.
callback_type | This tells you the status of your network request. |
callback_data | This contains all the data sent to you from your product request. Use the BIAP_GetTransaction* functions on this object to pull out the proerties you want. You must free this object with BIAP_FreeTransactionResponseData when you are done with it. |
user_data | This is the same pointer you passed as user data when you called BIAP_CreateAppStore. |
typedef struct BIAP_TransactionResponseData BIAP_TransactionResponseData |
enum BIAP_EventType |
These event types are given to you for every callback so you distingush the purpose of the event.
For an error in a transaction event, this sub-type can help you determine the reason for the failure.
enum BIAP_StoreName |
bool BIAP_Android_HandleOnActivityResult | ( | void * | jni_env, |
void * | original_activity, | ||
int32_t | request_code, | ||
int32_t | result_code, | ||
void * | intent_data | ||
) |
(Android-only) Call this function in your Android Activity's onActivityResult method.
Call this function in your Android Activity's onActivityResult method.
jni_env | The JNIEnv* you need to work with your JNI environment. (This was casted to void* to avoid needing the jni.h header which pollutes the namespace and sometimes causes problems.) |
original_activity | The Activity you are using to manage the store. This is expected to be the same activity you passed to BIAP_CreateAppStore. (This was casted to void* to avoid needing the jni.h header which pollutes the namespace and sometimes causes problems.) |
request_code | The request_code you get from your Activity's onActivityResult callback. |
result_code | The result_code you get from your Activity's onActivityResult callback. |
intent_data | The intent_data you get from your Activity's onActivityResult callback. (This was casted to void* to avoid needing the jni.h header which pollutes the namespace and sometimes causes problems.) |
void BIAP_ConsumePurchase | ( | struct BIAP_TransactionResponseData * | callback_data_of_purchase | ) |
Consumes a consumable purchased product.
For app stores that track consumable status, this will send a request/notification to the app store that the product will be consumed.
callback_data_of_purchase | This is the callback data containing the purchase of the product the user wishes to consume. You may get this object from either the original BIAP_PurchaseProduct/BIAP_EVENT_TRANSACTION_PURCHASED callback or from calling BIAP_RestorePurchases/BIAP_EVENT_TRANSACTION_RESTORED callback. |
struct BIAP_AppStore* BIAP_CreateAppStore | ( | enum BIAP_StoreName | store_name, |
void * | native_platform_context, | ||
BIAP_ProductResponse | product_response_callback, | ||
BIAP_TransactionResponse | transaction_response_callback, | ||
void * | user_data | ||
) |
Creates and starts a connection to the app store.
Creates and starts a connection to the app store and returns an instance to the handle.
store_name | Reserved for future use. For now, pass BIAP_STORE_DEFAULT. It will autodetect the store the use. On Apple, it uses the Apple store. On Android, autodetection looks at how the app was installed and what permissions are set. |
native_platform_context | For Android, you must pass the JNI jobject of the Activity instance that will display your store. SDL users: use SDL_AndroidGetActivity(). Other platforms may pass NULL. |
product_response_callback | The function pointer to your function for handling product callbacks. |
transaction_response_callback | The function pointer to your function for handling all other callbacks besides products. |
user_data | Any pointer you pass here will be passed back to you during a callback. |
void BIAP_FinishTransaction | ( | struct BIAP_TransactionResponseData * | callback_data | ) |
For those that require it, notifies the app store that the transaction is finished.
For those that require it, notifies the app store that the transaction is finished. You must call this following every successful transaction, otherwise Apple will assume the transaction was interrupted and will attempt to resume in the future, such as the next application launch. If you are offering the item as downloadable content, do not call this function until after the download is complete.
callback_data | The transaction you were handed in your BIAP_TransactionResponse callback which you want to declare as finished. |
void BIAP_FreeAppStore | ( | struct BIAP_AppStore * | app_store | ) |
Disconnects and frees your app store instance.
Disconnects and frees your app store instance.
app_store | The app store instance you want to free. |
void BIAP_FreeProductResponseData | ( | struct BIAP_ProductResponseData * | callback_data | ) |
Frees the memory for the BIAP_ProductResponseData that was created for you in the Product callback.
Frees the memory for the BIAP_ProductResponseData that was created for you in the Product callback.
callback_data | The data created for you in a callback which you want to free. |
void BIAP_FreeTransactionResponseData | ( | struct BIAP_TransactionResponseData * | callback_data | ) |
Frees the memory for the BIAP_TransactionResponseData that was created for you in the Transaction callback.
Frees the memory for the BIAP_TransactionResponseData that was created for you in the Transaction callback.
callback_data | The data created for you in a callback which you want to free. |
enum BIAP_StoreName BIAP_GetAppStoreName | ( | struct BIAP_AppStore * | app_store | ) |
Gets the name of the app store you are connected with.
Gets the name of the app store you are connected with.
const char* BIAP_GetInvalidProductIdentifier | ( | struct BIAP_ProductResponseData * | callback_data, |
size_t | list_index | ||
) |
Gets a invalid product from a list of invalid products returned from your product request.
Gets a invalid product from a list of invalid products returned from your product request. Invalid products are products you requested in your product request, but do not exist on the server. The callback_data is a container that contains a list of all the products you requested. This function will let you retrieve a product by array index.
callback_data | The object containing all the data associated with a callback event you wish to operate on. |
list_index | The index location of the invalid product string you want to retrieve. Array indices start counting at 0. |
size_t BIAP_GetInvalidProductsListCount | ( | struct BIAP_ProductResponseData * | callback_data | ) |
Gets the number of invalid products returned from your product request.
Gets the number of invalid products returned from your product request. Invalid products are products you requested in your product request, but do not exist on the server. The callback_data is a container that contains all the products you requested. This function will tell you how many valid products are in there.
callback_data | The object containing all the data associated with a callback event you wish to operate on. |
struct BIAP_AppStore* BIAP_GetProductAppStore | ( | struct BIAP_ProductResponseData * | callback_data | ) |
Gets the app store handle that this callback originated from.
Gets the app store handle that this callback originated from.
const char* BIAP_GetProductDescription | ( | struct BIAP_ProductResponseData * | callback_data, |
struct BIAP_Product * | product_object | ||
) |
Gets the product description string for the specified product.
Gets the product description string for the specified product. This is information returned by the app store and may be localized.
callback_data | The object containing all the data associated with a callback event you wish to operate on. |
product_object | The product you wish to operate on. It should have originated from the same callback_data you are passing. |
const char* BIAP_GetProductErrorString | ( | struct BIAP_ProductResponseData * | callback_data | ) |
Gets the error string associated with this callback data.
Gets the error string associated with this callback data in the case that the callback was for an error condition.
callback_data | The object containing all the data associated with a callback event you wish to operate on. |
enum BIAP_EventType BIAP_GetProductEventType | ( | struct BIAP_ProductResponseData * | callback_data | ) |
Gets the BIAP_EventType associated with this callback data.
Gets the BIAP_EventType associated with this callback data. This is the same value that was given to you in the callback event. This is provided as a convenience.
callback_data | The object containing all the data associated with a callback event you wish to operate on. |
const char* BIAP_GetProductIdentifier | ( | struct BIAP_ProductResponseData * | callback_data, |
struct BIAP_Product * | product_object | ||
) |
Gets the product identifier string associated with this product.
Gets the product identifier string associated with this product.
callback_data | The object containing all the data associated with a callback event you wish to operate on. |
product_object | The product you wish to operate on. It should have originated from the same callback_data you are passing. |
struct BIAP_Product* BIAP_GetProductInList | ( | struct BIAP_ProductResponseData * | callback_data, |
size_t | list_index | ||
) |
Gets a valid product from a list of valid products returned from your product request.
Gets a valid product from a list of valid products returned from your product request. The callback_data is a container that contains a list of all the products you requested. This function will let you retrieve a product by array index.
callback_data | The object containing all the data associated with a callback event you wish to operate on. |
list_index | The index location of the product you want to retrieve. Array indices start counting at 0. |
const char* BIAP_GetProductLocalizedPrice | ( | struct BIAP_ProductResponseData * | callback_data, |
struct BIAP_Product * | product_object | ||
) |
Gets the product localized price string for the specified product.
Gets the product localized price string for the specified product. This is information returned by the app store and will already have the correct price for the user's region. The string also is properly localized and contains the correct currency symbols and formatting, e.g. $0.99.
callback_data | The object containing all the data associated with a callback event you wish to operate on. |
product_object | The product you wish to operate on. It should have originated from the same callback_data you are passing. |
size_t BIAP_GetProductsListCount | ( | struct BIAP_ProductResponseData * | callback_data | ) |
Gets the number of valid products returned from your product request.
Gets the number of valid products returned from your product request. The callback_data is a container that contains all the products you requested. This function will tell you how many valid products are in there.
callback_data | The object containing all the data associated with a callback event you wish to operate on. |
const char* BIAP_GetProductTitle | ( | struct BIAP_ProductResponseData * | callback_data, |
struct BIAP_Product * | product_object | ||
) |
Gets the product title string for the specified product.
Gets the product title string for the specified product. This is information returned by the app store and may be localized.
callback_data | The object containing all the data associated with a callback event you wish to operate on. |
product_object | The product you wish to operate on. It should have originated from the same callback_data you are passing. |
struct BIAP_Product* BIAP_GetProductWithIdentifier | ( | struct BIAP_ProductResponseData * | callback_data, |
const char * | product_identifer | ||
) |
Searches and returns a valid product from a list of valid products returned from your product request by the product identifier you specify.
Searches and returns a valid product from a list of valid products returned from your product request by the product identifier you specify. The callback_data is a container that contains a list of all the products you requested. This function will let you retrieve a product by the product identifier name.
callback_data | The object containing all the data associated with a callback event you wish to operate on. |
product_identifer | The product identifier of the product you want to retrieve. |
const char* BIAP_GetReceiptPath | ( | struct BIAP_AppStore * | app_store | ) |
(Apple-only) Gets the path to the receipt on the file system.
Gets the path to the receipt on the file system. Use BIAP_RequestReceiptRefresh to make sure the receipt exists and is up-to-date.
app_store | The app store handle you want to request from. |
struct BIAP_AppStore* BIAP_GetTransactionAppStore | ( | struct BIAP_TransactionResponseData * | callback_data | ) |
Gets the app store handle that this callback originated from.
Gets the app store handle that this callback originated from.
const char* BIAP_GetTransactionErrorString | ( | struct BIAP_TransactionResponseData * | callback_data | ) |
Gets the error string associated with this callback data.
Gets the error string associated with this callback data in the case that the callback was for an error condition.
callback_data | The object containing all the data associated with a callback event you wish to operate on. |
enum BIAP_FailedTransactionType BIAP_GetTransactionErrorType | ( | struct BIAP_TransactionResponseData * | callback_data | ) |
Gets the BIAP_FailedTransactionType associated with this callback data.
Gets the BIAP_FailedTransactionType associated with this callback data in the case that the callback was for an error condition.
callback_data | The object containing all the data associated with a callback event you wish to operate on. |
enum BIAP_EventType BIAP_GetTransactionEventType | ( | struct BIAP_TransactionResponseData * | callback_data | ) |
Gets the BIAP_EventType associated with this callback data.
Gets the BIAP_EventType associated with this callback data. This is the same value that was given to you in the callback event. This is provided as a convenience.
callback_data | The object containing all the data associated with a callback event you wish to operate on. |
const char* BIAP_GetTransactionOriginalJson | ( | struct BIAP_TransactionResponseData * | callback_data | ) |
(Android-only) Gets the JSON formatted receipt for a transaction.
(Android-only) Gets the JSON formatted receipt for a transaction.
callback_data | The object containing all the data associated with a callback event you wish to operate on. This must be an object that was actually purchased, received with an event type of BIAP_EVENT_TRANSACTION_PURCHASED or BIAP_EVENT_TRANSACTION_RESTORED. |
long long BIAP_GetTransactionOriginalPurchaseTime | ( | struct BIAP_TransactionResponseData * | callback_data | ) |
(Android-only) Gets the original transaction purchase time in milliseconds since Epoch (Unix 1970).
(Android-only) Gets the original transaction purchase time in milliseconds since Epoch (Unix 1970).
callback_data | The object containing all the data associated with a callback event you wish to operate on. This must be an object that was actually purchased, received with an event type of BIAP_EVENT_TRANSACTION_PURCHASED or BIAP_EVENT_TRANSACTION_RESTORED. |
const char* BIAP_GetTransactionProductIdentifier | ( | struct BIAP_TransactionResponseData * | callback_data | ) |
Gets the product identifier string associated with this callback data.
Gets the product identifier string associated with this callback data.
callback_data | The object containing all the data associated with a callback event you wish to operate on. |
long long BIAP_GetTransactionPurchaseTime | ( | struct BIAP_TransactionResponseData * | callback_data | ) |
Gets the transaction purchase time in milliseconds since Epoch (Unix 1970).
Gets the transaction purchase time in milliseconds since Epoch (Unix 1970).
callback_data | The object containing all the data associated with a callback event you wish to operate on. This must be an object that was actually purchased, received with an event type of BIAP_EVENT_TRANSACTION_PURCHASED or BIAP_EVENT_TRANSACTION_RESTORED. |
void BIAP_Init | ( | void | ) |
Initializes the library.
Initializes the library.
bool BIAP_IsDebugLogging | ( | void | ) |
Returns whether debug logging is enabled.
Returns whether debug logging is enabled.
bool BIAP_IsInit | ( | void | ) |
void BIAP_PurchaseProduct | ( | struct BIAP_ProductResponseData * | callback_data, |
struct BIAP_Product * | the_product | ||
) |
Purchases the specified product from the app store.
Begins the sequence of events to allow the user to purchase an item from the app store. The results of the transaction will be returned in your BIAP_TransactionResponse callback. BIAP_EVENT_TRANSACTION_PURCHASED and BIAP_EVENT_TRANSACTION_FAILED are the two most important events to look for during this transaction. Other events may also trigger during this process depending on the app store in use.
callback_data | This is the callback data containing the product you want to purchase, which was originally handed to you during your BIAP_ProductResponse callback from calling BIAP_RequestProducts. |
the_product | This is the specific product you want to purchase. This object was pulled out from the callback_data using BIAP_GetProductInList or BIAP_GetProductWithIdentifier. |
void BIAP_Quit | ( | void | ) |
Shuts down the library.
Shuts down the library.
void BIAP_RegisterKey | ( | enum BIAP_StoreName | store_name, |
const char * | the_key | ||
) |
Allows you to register your public key for the app stores that require it.
Allows you to register your public key for the app stores that require it. Google Play, Yandex, Appland, and SlideME require you to provide keys. You must register your keys before you call BIAP_CreateAppStore. If you are using a different app store, the keys you register will be ignored.
store_name | Use the provided BIAP_STORE_* string constants to specify which store your key goes with. |
the_key | Your public key. |
void BIAP_RequestProducts | ( | struct BIAP_AppStore * | app_store, |
const char * | nonconsumable_product_identifier_list[], | ||
size_t | num_nonconsumables, | ||
const char * | consumable_product_identifier_list[], | ||
size_t | num_consumables, | ||
const char * | subscription_product_identifier_list[], | ||
size_t | num_subscriptions | ||
) |
Requests product information from your connected app store.
Requests product information for the identifiers you supply from your connected app store. This information includes things like description and price. Information will be returned in your BIAP_ProductResponse callback.
app_store | The app store connection you want to request from. |
nonconsumable_product_identifier_list | An array of strings containing the product identifiers of the non-consumable products you want information for. |
num_nonconsumables | The number of product identifiers in your nonconsumable_product_identifier_list. |
consumable_product_identifier_list | An array of strings containing the product identifiers of the consumable products you want information for. |
num_consumables | The number of product identifiers in your consumable_product_identifier_list. |
subscription_product_identifier_list | An array of strings containing the product identifiers of the subscription products you want information for. |
num_subscriptions | The number of product identifiers in your subscription_product_identifier_list. |
void BIAP_RequestReceiptRefresh | ( | struct BIAP_AppStore * | app_store | ) |
(Apple-only) Refreshes the user's purchases receipt on the file system.
Refreshes the user's purchases receipt on the file system. It is possible the receipt doesn't exist because it is a new device, or the receipt is out of date because the user has multiple devices, so this API will make a server request to update the receipt. This will trigger a BIAP_EVENT_TRANSACTION_RECEIPT_REQUEST_FINISHED or BIAP_EVENT_TRANSACTION_RECEIPT_REQUEST_FAILED callback in your BIAP_TransactionResponse callback.
app_store | The app store handle you want to request from. |
void BIAP_RestorePurchases | ( | struct BIAP_AppStore * | app_store | ) |
Requests all purchases a user has bought from the app store.
Requests all purchases a user has bought from the app store. Each product will trigger a BIAP_EVENT_TRANSACTION_RESTORED event in your BIAP_TransactionResponse callback. For Apple platforms, you are required to have a button that allows the user to restore all their purchases. The intent is to allow users to receover their purchases to a new device. For Android platforms, this has an additional use of retrieving the consumable purchase object you need to pass BIAP_ConsumePurchase in order to consume it.
app_store | The app store handle you want to request from. |
void BIAP_SetDebugLogging | ( | bool | should_enable | ) |
Enables extra debug log messages in the library.
Enables extra debug log messages in the library. The default is false. You should generally keep this disabled for release builds.
should_enable | True will enable more debugging messages. False will disable. |
void BIAP_StartAppStore | ( | struct BIAP_AppStore * | app_store | ) |
Starts the app store.
Starts the app store. This will trigger a transaction response callback with event type BIAP_EVENT_INIT_FINISHED or BIAP_EVENT_INIT_FAILED to let you know if the creation succeeded or failed. After BIAP_EVENT_INIT_FINISHED, you may call BIAP_GetAppStoreName to find out which store you connected with.
app_store | The app store instance to start. |