RegisterAppProduct()

Syntax

RegisterAppProduct(ProductID$, Callback [, Type])
Description
Register 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 retreive information about each products (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-consommable 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 purpose

      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-consummable product).
  #PB_Product_Cancelled: Product paiement cancelled (paiement was initialized, but cancelled.
                       Mainly useful for statistical purpose.
  #PB_Product_Refunded : Product paiement has been refunded. Previously purchased item should removed from the user 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