Samsung Wearable Native API
Functions | Typedefs
In App Purchase

Functions

int iap_galaxyapps_start_payment (const char *item_id, iap_galaxyapps_mode_e mode, iap_galaxyapps_reply_cb reply_cb, void *user_data)
 Purchases an item on Samsung Galaxy Apps.
int iap_galaxyapps_get_item_list (int start_number, int end_number, const char *item_type, iap_galaxyapps_mode_e mode, iap_galaxyapps_reply_cb reply_cb, void *user_data)
 Gets the list of a specified subset of the items on Samsung Galaxy Apps offered for sale by caller app.
int iap_galaxyapps_get_purchased_item_list (int start_number, int end_number, const char *start_date, const char *end_date, iap_galaxyapps_reply_cb reply_cb, void *user_data)
 Gets the list of the purchased items on Samsung Galaxy Apps.
int iap_galaxyapps_get_purchased_item_list_by_item_ids (const char *item_ids, iap_galaxyapps_reply_cb reply_cb, void *user_data)
 Gets the list of the purchased items among item_ids on Samsung Galaxy Apps.
int iap_galaxyapps_get_value (iap_galaxyapps_h handle, const char *key, char **value)
 Gets value associated with the given key.
int iap_galaxyapps_foreach_item_info (iap_galaxyapps_h handle, iap_galaxyapps_item_info_cb callback, void *user_data)
 Retrieves all items contained in handle.

Typedefs

typedef struct iap_galaxyapps_s * iap_galaxyapps_h
 In-App Purchase handle.
typedef void(* iap_galaxyapps_reply_cb )(iap_galaxyapps_h reply, iap_galaxyapps_error_e result, void *user_data)
 Called when the reply of the In-App Purchase request is delivered.
typedef bool(* iap_galaxyapps_item_info_cb )(iap_galaxyapps_h handle, void *user_data)
 Called to retrieve all item information contained in the handle.

The In App Purchase APIs provide functions to purchase an item and get item list.

Required Header

#include iap_galaxyapps.h

Overview

Purchases an item on Samsung Galaxy Apps and Gets the list of a specified subset of the items and the purchased items.

Related Features

This API is related with the following feature:


Typedef Documentation

typedef struct iap_galaxyapps_s* iap_galaxyapps_h

In-App Purchase handle.

Since :
2.3.2
typedef bool(* iap_galaxyapps_item_info_cb)(iap_galaxyapps_h handle, void *user_data)

Called to retrieve all item information contained in the handle.

Since :
2.3.2
Parameters:
[in]handleThe In-App Purchase handle
[in]user_dataThe user data passed from the foreach function
Returns:
true to continue with the next iteration of the loop, otherwise false to break out of the loop
Precondition:
iap_galaxyapps_foreach_item_info() will invoke this callback.
See also:
iap_galaxyapps_foreach_item_info()
typedef void(* iap_galaxyapps_reply_cb)(iap_galaxyapps_h reply, iap_galaxyapps_error_e result, void *user_data)

Called when the reply of the In-App Purchase request is delivered.

Since :
2.3.2
Remarks:
The reply must not be deallocated by the application.
Parameters:
[in]replyThe In-App Purchase handle in which the results of the callee are contained
[in]resultThe result code of the In-App Purchase request such as IAP_GALAXYAPPS_ERROR_NONE Successful IAP_GALAXYAPPS_ERROR_PAYMENT_IS_CANCELED Payment canceled IAP_GALAXYAPPS_ERROR_INITIALIZATION Failure during IAP initialization IAP_GALAXYAPPS_ERROR_NEED_APP_UPGRADE Samsung IAP upgrade is required IAP_GALAXYAPPS_ERROR_COMMON Error while running IAP IAP_GALAXYAPPS_ERROR_ALREADY_PURCHASED Error when a non-consumable product is repurchased or a subscription product is repurchased before the product expiration date. IAP_GALAXYAPPS_ERROR_REQUEST_PAYMENT_WITHOUT_INFO Error when payment is requested without bundle information. IAP_GALAXYAPPS_ERROR_PRODUCT_DOES_NOT_EXIST Error when the requested item list is not available. IAP_GALAXYAPPS_ERROR_CONFIRM_INBOX The payment result is not received after requesting payment from the server, and the purchased item list is not confirmed IAP_GALAXYAPPS_ERROR_NETWORK_NOT_AVAILABLE Error network is not available. IAP_GALAXYAPPS_ERROR_IO_ERROR IOException IAP_GALAXYAPPS_ERROR_TIMED_OUT Timeout exception IAP_GALAXYAPPS_ERROR_NOT_EXIST_LOCAL_PRICE The item is not for sale in the country IAP_GALAXYAPPS_ERROR_NOT_AVAILABLE_SHOP IAP is not serviced in the country
[in]user_dataThe user data passed from the callback registration function
Precondition:
When the callee replies to the In-App Purchase request, this callback will be invoked.
See also:
iap_galaxyapps_start_payment()
iap_galaxyapps_get_item_list()
iap_galaxyapps_get_purchased_item_list()

Enumeration Type Documentation

Enumeration for In-App Purchase Error.

Since :
2.3.2
Enumerator:
IAP_GALAXYAPPS_ERROR_NONE 

Successful

IAP_GALAXYAPPS_ERROR_PAYMENT_IS_CANCELED 

Payment canceled

IAP_GALAXYAPPS_ERROR_NETWORK_NOT_AVAILABLE 

Error network is not available.

IAP_GALAXYAPPS_ERROR_IO_ERROR 

IOException

IAP_GALAXYAPPS_ERROR_TIMED_OUT 

Timeout exception

IAP_GALAXYAPPS_ERROR_INITIALIZATION 

Failure during IAP initialization

IAP_GALAXYAPPS_ERROR_NEED_APP_UPGRADE 

Samsung IAP upgrade is required.

IAP_GALAXYAPPS_ERROR_COMMON 

Error while running IAP

IAP_GALAXYAPPS_ERROR_ALREADY_PURCHASED 

Error when a non-consumable product is repurchased or a subscription product is repurchased before the product expiration date.

IAP_GALAXYAPPS_ERROR_REQUEST_PAYMENT_WITHOUT_INFO 

Error when payment is requested without bundle information.

IAP_GALAXYAPPS_ERROR_PRODUCT_DOES_NOT_EXIST 

Error when the requested item list is not available.

IAP_GALAXYAPPS_ERROR_CONFIRM_INBOX 

The payment result is not received after requesting payment from the server, and the purchased item list is not confirmed

IAP_GALAXYAPPS_ERROR_NOT_EXIST_LOCAL_PRICE 

The item is not for sale in the country

IAP_GALAXYAPPS_ERROR_NOT_AVAILABLE_SHOP 

IAP is not serviced in the country

IAP_GALAXYAPPS_ERROR_INVALID_PARAMETER 

Invalid parameter

IAP_GALAXYAPPS_ERROR_KEY_NOT_FOUND 

Specified key is not found

IAP_GALAXYAPPS_ERROR_NOT_SUPPORTED_DEVICE 

The device does not support IAP

IAP_GALAXYAPPS_ERROR_OUT_OF_MEMORY 

Out of memory

IAP_GALAXYAPPS_ERROR_PERMISSION_DENIED 

Permission denied

Enumeration for mode.

Since :
2.3.2
Remarks:
Be sure to set IAP_GALAXYAPPS_COMMERCIAL_MODE when uploading an application for distribution so that actual payments from customers can be completed
See also:
iap_galaxyapps_start_payment()
iap_galaxyapps_get_item_list()
Enumerator:
IAP_GALAXYAPPS_COMMERCIAL_MODE 

Commercial mode

IAP_GALAXYAPPS_SUCCESS_TEST_MODE 

Test mode and always success

IAP_GALAXYAPPS_FAILURE_TEST_MODE 

Test mode and always failure


Function Documentation

int iap_galaxyapps_foreach_item_info ( iap_galaxyapps_h  handle,
iap_galaxyapps_item_info_cb  callback,
void *  user_data 
)

Retrieves all items contained in handle.

This function calls iap_item_info_cb() repeatedly for each item information contained in handle.
If the iap_item_info_cb() callback function returns false, then iteration will be finished.

Since :
2.3.2
Parameters:
[in]handleThe In-App Purchase handle
[in]callbackThe iteration callback function
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
IAP_GALAXYAPPS_ERROR_NONESuccessful
IAP_GALAXYAPPS_ERROR_INVALID_PARAMETERInvalid parameter
Postcondition:
This function invokes iap_item_info_cb().
See also:
iap_galaxyapps_item_info_cb()
int iap_galaxyapps_get_item_list ( int  start_number,
int  end_number,
const char *  item_type,
iap_galaxyapps_mode_e  mode,
iap_galaxyapps_reply_cb  reply_cb,
void *  user_data 
)

Gets the list of a specified subset of the items on Samsung Galaxy Apps offered for sale by caller app.

Since :
2.3.2
Privilege Level:
public
Privilege:
http://tizen.org/privilege/billing
Parameters:
[in]start_numberthe index of first item on the list
[in]end_numberthe index of last item on the list
[in]item_typethe item type such as 00, 01, 02 and 10
00: Non-consumable, 01: Consumable, 02: Subscription, 10: All
[in]modeIt can be possible to experience the entire process 'risk free' by enabling the IAP Test Mode when developing apps. Be sure to set IAP_GALAXYAPPS_COMMERCIAL_MODE when uploading an application for distribution so that actual payments from customers can be completed.
[in]reply_cbThe result callback function
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
IAP_GALAXYAPPS_ERROR_NONESuccessful
IAP_GALAXYAPPS_ERROR_INITIALIZATIONFailure during IAP initialization
IAP_GALAXYAPPS_ERROR_INVALID_PARAMETERInvalid parameter
IAP_GALAXYAPPS_ERROR_NOT_SUPPORTED_DEVICEThe device does not support IAP
IAP_GALAXYAPPS_ERROR_OUT_OF_MEMORYOut of memory
IAP_GALAXYAPPS_ERROR_PERMISSION_DENIEDPermission denied
See also:
iap_galaxyapps_mode_e
iap_galaxyapps_reply_cb()
int iap_galaxyapps_get_purchased_item_list ( int  start_number,
int  end_number,
const char *  start_date,
const char *  end_date,
iap_galaxyapps_reply_cb  reply_cb,
void *  user_data 
)

Gets the list of the purchased items on Samsung Galaxy Apps.

Since :
2.3.2
Privilege Level:
public
Privilege:
http://tizen.org/privilege/billing
Parameters:
[in]start_numberthe index of first item on the list. it starts from 1.
[in]end_numberthe index of last item on the list
[in]start_datethe start date of the requested inbox list. the date format is "yyyymmdd". ex) "20160301"
[in]end_datethe end date of the requested inbox list. the date format is "yyyymmdd". ex) "20160331"
[in]reply_cbThe result callback function
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
IAP_GALAXYAPPS_ERROR_NONESuccessful
IAP_GALAXYAPPS_ERROR_INITIALIZATIONFailure during IAP initialization
IAP_GALAXYAPPS_ERROR_INVALID_PARAMETERInvalid parameter
IAP_GALAXYAPPS_ERROR_NOT_SUPPORTED_DEVICEThe device does not support IAP
IAP_GALAXYAPPS_ERROR_OUT_OF_MEMORYOut of memory
IAP_GALAXYAPPS_ERROR_PERMISSION_DENIEDPermission denied
See also:
iap_galaxyapps_reply_cb()
int iap_galaxyapps_get_purchased_item_list_by_item_ids ( const char *  item_ids,
iap_galaxyapps_reply_cb  reply_cb,
void *  user_data 
)

Gets the list of the purchased items among item_ids on Samsung Galaxy Apps.

Since :
2.3.2
Privilege Level:
public
Privilege:
http://tizen.org/privilege/billing
Parameters:
[in]item_idsItem IDs seperated by comma(,)
[in]reply_cbThe result callback function
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
IAP_GALAXYAPPS_ERROR_NONESuccessful
IAP_GALAXYAPPS_ERROR_INITIALIZATIONFailure during IAP initialization
IAP_GALAXYAPPS_ERROR_INVALID_PARAMETERInvalid parameter
IAP_GALAXYAPPS_ERROR_NOT_SUPPORTED_DEVICEThe device does not support IAP
IAP_GALAXYAPPS_ERROR_OUT_OF_MEMORYOut of memory
IAP_GALAXYAPPS_ERROR_PERMISSION_DENIEDPermission denied
See also:
iap_galaxyapps_reply_cb()
int iap_galaxyapps_get_value ( iap_galaxyapps_h  handle,
const char *  key,
char **  value 
)

Gets value associated with the given key.

Since :
2.3.2
Parameters:
[in]handleThe In-App Purchase handle
[in]keyThe name of the extra data
[out]valueThe value associated with the given key
Returns:
0 on success, otherwise a negative error value
Return values:
IAP_GALAXYAPPS_ERROR_NONESuccessful
IAP_GALAXYAPPS_ERROR_INVALID_PARAMETERInvalid parameter
IAP_GALAXYAPPS_ERROR_KEY_NOT_FOUNDSpecified key not found
See also:
iap_galaxyapps_foreach_item_info()
int iap_galaxyapps_start_payment ( const char *  item_id,
iap_galaxyapps_mode_e  mode,
iap_galaxyapps_reply_cb  reply_cb,
void *  user_data 
)

Purchases an item on Samsung Galaxy Apps.

Since :
2.3.2
Privilege Level:
public
Privilege:
http://tizen.org/privilege/billing
Parameters:
[in]item_idthe item id to purchase
[in]modeIt can be possible to experience the entire process 'risk free' by enabling the IAP Test Mode when developing apps. Be sure to set IAP_GALAXYAPPS_COMMERCIAL_MODE when uploading an application for distribution so that actual payments from customers can be completed.
[in]reply_cbThe result callback function
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
IAP_GALAXYAPPS_ERROR_NONESuccessful
IAP_GALAXYAPPS_ERROR_INITIALIZATIONFailure during IAP initialization
IAP_GALAXYAPPS_ERROR_INVALID_PARAMETERInvalid parameter
IAP_GALAXYAPPS_ERROR_NOT_SUPPORTED_DEVICEThe device does not support IAP
IAP_GALAXYAPPS_ERROR_OUT_OF_MEMORYOut of memory
IAP_GALAXYAPPS_ERROR_PERMISSION_DENIEDPermission denied
See also:
iap_galaxyapps_mode_e
iap_galaxyapps_reply_cb()

Except as noted, this content - excluding the Code Examples - is licensed under Creative Commons Attribution 3.0 and all of the Code Examples contained herein are licensed under BSD-3-Clause.
For details, see the Content License