RegisterAppProduct()

Syntax

RegisterAppProduct(ProductID$, Callback [, Type])
Description
Registers a new product for In-App purchase store. This product has to be existing in the app store. Once all needed products have been registered, FetchAppProducts() has to be called to contact the store and retrieve information about each product (like price, description etc.)

Parameters

ProductID$ The unique product identifier.
Callback A callback which will be called when a state change occurs on this product. It has to respect the following declaration:
  Procedure OnPurchase(State, ProductID$)
    Select State 
      Case #PB_Product_Approved
        ; A product has been successfully purchased. Do the logic and then call FinishAppProductPurchase() to finish the order process
        
      Case #PB_Product_Owned
        ; A non-consumable product has been already purchased. It will trigger this at program start

      Case #PB_Product_Cancelled
        ; An order has been initialized, but cancelled by the user. Mostly for statistical purposes

      Case #PB_Product_Refunded
        ; An order has been refunded, you should take appropriate action to remove the previously purchased item
        
    EndSelect
  EndProcedure
State can be one of the following value:
  #PB_Product_Approved : Product successfully purchased.
  #PB_Product_Owned    : Product already owned (only for non-consumable product).
  #PB_Product_Cancelled: Product payment cancelled (payment was initialized, but cancelled).
                       Mainly useful for statistical purposes.
  #PB_Product_Refunded : Product payment has been refunded. Previously purchased item should be removed from the user's account.
Note: the same callback can be used for more than one product.
Type (optional) Type can be one of the following value:
  #PB_Product_Consumable   : Product that can be purchased many times (like rubies, gems, wings for a game).
  #PB_Product_NonConsumable: Product that can be purchased only once (like sword, helmet for a game).
                             If a non-consumable item has been already purchased, the #PB_Product_Owned state
                             will be triggered at program start.

Return value

None.

See Also

FetchAppProducts()

Supported OS

Android, iOS

<- PurchaseAppProduct() - InAppPurchase Index