Skip to main content
Version: 10.5.x

bfgPurchase Class

Static Public Member Functions

static bool acquireProductInformation ()
 acquireProductInformation is used when productInformation does not return any data. More...
 
static bool acquireProductInformation (string productId)
 acquireProductInformation is used when productInformation does not return any data. More...
 
static bool acquireProductInformationForProducts (List< string > productIds)
 acquireProductInformation is used when productInformation does not return any data. More...
 
static bool hasDeferredPayments ()
 Checks if there are promoted in-app purchases to queue. More...
 
static void processDeferredPayments ()
 Process promoted in-app purchases queued.
 
static bool canStartPurchase (string productId)
 Test to see if purchase of the specified product can be started. Note that the method is not guaranteed to return false for a product that has already been purchased and should not be used as a substitute for maintaining a proper record of prior purchases. The purpose of the method is to determine whether the unavailability of network connectivity or the state of the SDK precludes purchase of an otherwise eligible product. The method will return false if:
  • the product id is invalid (null or empty string),
  • the network is unavailable,
  • the SDK services are unavailable,
  • a purchase of the product has been initiated and has not completed,
  • restoration of prior purchases is underway,
  • no product information has been retrieved for the SKU, or
  • user is not signed in (Amazon only).
More...
 
static void finishPurchase ()
 The application uses this method to report that a purchase has been awarded. It should be used only for SKUs that have been registered as consumable with a call to defineConsumableSKUs. The method should be called on the UI thread. Use on Google Purchases ONLY. This method will not do anything on Amazon purchases.
 
static void finishPurchase (string productId)
 The application uses this method to report that a purchase has been awarded. It should be used only for SKUs that have been registered as consumable with a call to defineConsumableSKUs. The method should be called on the UI thread. Use on Google Purchases ONLY. This function will not do anything on Amazon purchases. More...
 
static bool isPurchaseActive ()
 Indicates whether the purchase process is occurring or not for the default purchase. More...
 
static bool isPurchaseActive (string productId)
 Indicates whether the purchase process is occurring or not for the purchase of a product with the given ID. More...
 
static bool isRestoreActive ()
 Indicates whether a purchase process is curently being restored or not. More...
 
static bool productInformation (ref string prodInfoJson)
 Retrieves information about the default product. More...
 
static bool productInformation (string productId, ref string prodInfoJson)
 Retrieves information about the product with the given id. More...
 
static bool purchaseActivityInProgress ()
 Currently only works on iOS. Checks if a purchase / restore is in progress. Should not be displayed. More...
 
static void restorePurchases ()
 Restores previous purchases. Receives the same NOTIFICATION_PURCHASE_SUCCEEDED notification as the original purchase.
 
static void startPurchase ()
 Convenience method for calling startPurchase:details1:details2:details3:additionalDetails with null details and null additional details.
 
static void startPurchase (string productId)
 Convenience method for calling startPurchase:details1:details2:details3:additionalDetails with the given productId, null details, and null additional details. More...
 
static void startPurchase (string productId, string details1, string details2, string details3, Dictionary< string, string > additionalDetails)
 Convenience method for calling startPurchase:details1:details2:details3:additionalDetails with the given productId, null details, and null additional details. More...
 
static bool startService ()
 Calling startService on bfgPurchases enables its functionality and causes it to resume processing any operations that were already in progress. All notification listeners should be set up prior to calling start. More...
 
static bool startService (ref string error)
 Calling startService on bfgPurchases enables its functionality and causes it to resume processing any operations that were already in progress. All notification listeners should be set up prior to calling start. More...
 
static bool deliverablePurchases (ref string deliverablePurchasesJson)
 When a purchase completes, you will receive a notification of its success or failure. At this time, award the purchase to the user. This method gives you a secondary way of accessing purchases that should be awarded after the notification has fired. More...
 
static void forceConsumeAllPurchases ()
 WARNING: This is an internal SDK debug method. DO NOT CALL THIS METHOD IN PRODUCTION CODE!
 

Member Function Documentation

◆ acquireProductInformation() [1/2]

static bool BFGSDK.bfgPurchase.acquireProductInformation ()
inlinestatic
acquireProductInformation is used when productInformation does not return any data.
Returns
Boolean true is request for product information sent, false is the user is offline.

◆ acquireProductInformation() [2/2]

static bool BFGSDK.bfgPurchase.acquireProductInformation (string productId)
inlinestatic
acquireProductInformation is used when productInformation does not return any data.
Parameters
productIdString productId identifier of product that was purchased in game.
Returns
Boolean true is request for product information sent, false is the user is offline.

◆ acquireProductInformationForProducts()

static bool BFGSDK.bfgPurchase.acquireProductInformationForProducts (List< string > productIds)
inlinestatic
acquireProductInformation is used when productInformation does not return any data.
Parameters
productIdsList<String> productIds identifiers of products that was purchased in game.
Returns
Boolean true is request for product information sent, false is the user is offline.

◆ canStartPurchase()

static bool BFGSDK.bfgPurchase.canStartPurchase (string productId)
inlinestatic
Test to see if purchase of the specified product can be started. Note that the method is not guaranteed to return false for a product that has already been purchased and should not be used as a substitute for maintaining a proper record of prior purchases. The purpose of the method is to determine whether the unavailability of network connectivity or the state of the SDK precludes purchase of an otherwise eligible product. The method will return false if:
  • the product id is invalid (null or empty string),
  • the network is unavailable,
  • the SDK services are unavailable,
  • a purchase of the product has been initiated and has not completed,
  • restoration of prior purchases is underway,
  • no product information has been retrieved for the SKU, or
  • user is not signed in (Amazon only).
Parameters
productId
Returns

◆ deliverablePurchases()

static bool BFGSDK.bfgPurchase.deliverablePurchases (ref string deliverablePurchasesJson)
inlinestatic
When a purchase completes, you will receive a notification of its success or failure. At this time, award the purchase to the user. This method gives you a secondary way of accessing purchases that should be awarded after the notification has fired.
Parameters
deliverablePurchasesJsonPurchase objects that were successfully purchased but have not had "finishPurchase" called on them.
Returns
If true, the purchase objects were succesfully retrieved. If false, there was a problem with retrieving purchase objects.

◆ finishPurchase()

static void BFGSDK.bfgPurchase.finishPurchase (string productId)
inlinestatic
The application uses this method to report that a purchase has been awarded. It should be used only for SKUs that have been registered as consumable with a call to defineConsumableSKUs. The method should be called on the UI thread. Use on Google Purchases ONLY. This function will not do anything on Amazon purchases.
Parameters
productIdThe ID of the product to take off the queue.

◆ hasDeferredPayments()

static bool BFGSDK.bfgPurchase.hasDeferredPayments ()
inlinestatic
Checks if there are promoted in-app purchases to queue.
Returns
true if promoted in-app purchases are available to queue.

◆ isPurchaseActive() [1/2]

static bool BFGSDK.bfgPurchase.isPurchaseActive ()
inlinestatic
Indicates whether the purchase process is occurring or not for the default purchase.
Returns
If true, the default product is currently being processed for purchase. If false, purchase already in-flight, restore in-flight, or other restriction

◆ isPurchaseActive() [2/2]

static bool BFGSDK.bfgPurchase.isPurchaseActive (string productId)
inlinestatic
Indicates whether the purchase process is occurring or not for the purchase of a product with the given ID.
Parameters
productIdID of product to query if purchase is active.
Returns
YES Purchase is being processed. NO Purchase already in-flight, restore in-flight, or other restriction preventing purchase.

◆ isRestoreActive()

static bool BFGSDK.bfgPurchase.isRestoreActive ()
inlinestatic
Indicates whether a purchase process is curently being restored or not.
Returns
If true, restore is being processed or verified. If false, restore in-flight or other restriction preventing restore.

◆ productInformation() [1/2]

static bool BFGSDK.bfgPurchase.productInformation (ref string prodInfoJson)
inlinestatic
Retrieves information about the default product.
Parameters
prodInfoJsonThe product id to get the information for.
Returns
If true, the ref param received a valid string. If false, the ref param is empty or null.

◆ productInformation() [2/2]

static bool BFGSDK.bfgPurchase.productInformation (string productId,
ref string prodInfoJson 
)
inlinestatic
Retrieves information about the product with the given id.
Parameters
productIdThe id of the product to get information on
prodInfoJsonThe product id to get the information for.
Returns
If true, the ref param received a valid string. If false, the ref param is empty or null.

◆ purchaseActivityInProgress()

static bool BFGSDK.bfgPurchase.purchaseActivityInProgress ()
inlinestatic
Currently only works on iOS. Checks if a purchase / restore is in progress. Should not be displayed.
Returns
YES Purchase or restore in progress. NO Purchase already in-flight, restore in-flight, or other restriction preventing purchase.

◆ startPurchase() [1/2]

static void BFGSDK.bfgPurchase.startPurchase (string productId)
inlinestatic
Convenience method for calling startPurchase:details1:details2:details3:additionalDetails with the given productId, null details, and null additional details.
Parameters
productIdThe id of the product being purchased

◆ startPurchase() [2/2]

static void BFGSDK.bfgPurchase.startPurchase (string productId,
string details1,
string details2,
string details3,
Dictionary< string, string > additionalDetails 
)
inlinestatic
Convenience method for calling startPurchase:details1:details2:details3:additionalDetails with the given productId, null details, and null additional details.
Parameters
productIdThe id of the product being purchased
details1An alpha-numeric label to categorize the event. May be null.
details2An alpha-numeric label to categorize the event. May be null.
details3An alpha-numeric label to categorize the event. May be null.
additionalDetailsAdditional data to be associated with this productId. This value may be null. If not null, the value must be a flat dictionary containing only strings as keys and values.

◆ startService() [1/2]

static bool BFGSDK.bfgPurchase.startService ()
inlinestatic
Calling startService on bfgPurchases enables its functionality and causes it to resume processing any operations that were already in progress. All notification listeners should be set up prior to calling start.
Returns
YES Purchase has started. NO Purchase has previously started.

◆ startService() [2/2]

static bool BFGSDK.bfgPurchase.startService (ref string error)
inlinestatic
Calling startService on bfgPurchases enables its functionality and causes it to resume processing any operations that were already in progress. All notification listeners should be set up prior to calling start.
Parameters
errorIf service fails to start, error will contain the reason. Otherwise error is null.
Returns
YES Purchase has started. NO Purchase has previously started.