Class IAPButton
A GUI component for exposing the current price and allow purchasing of In-App Purchases. Exposes configurable elements through the Inspector.
Inherited Members
Namespace: UnityEngine.Purchasing
Syntax
[RequireComponent(typeof(Button))]
[AddComponentMenu("Unity IAP/IAP Button")]
[HelpURL("https://docs.unity3d.com/Manual/UnityIAP.html")]
public class IAPButton : MonoBehaviour
Fields
buttonType
The type of this button, can be either a purchase or a restore button.
Declaration
[Tooltip("The type of this button, can be either a purchase or a restore button.")]
public IAPButton.ButtonType buttonType
Field Value
Type | Description |
---|---|
IAPButton.ButtonType |
consumePurchase
Consume the product immediately after a successful purchase.
Declaration
[Tooltip("Consume the product immediately after a successful purchase.")]
public bool consumePurchase
Field Value
Type | Description |
---|---|
Boolean |
descriptionText
Displays the localized description from the app store.
Declaration
[Tooltip("[Optional] Displays the localized description from the app store.")]
public Text descriptionText
Field Value
Type | Description |
---|---|
Text |
onPurchaseComplete
Event fired after a successful purchase of this product.
Declaration
[Tooltip("Event fired after a successful purchase of this product.")]
public IAPButton.OnPurchaseCompletedEvent onPurchaseComplete
Field Value
Type | Description |
---|---|
IAPButton.OnPurchaseCompletedEvent |
onPurchaseFailed
Event fired after a failed purchase of this product.
Declaration
[Tooltip("Event fired after a failed purchase of this product.")]
public IAPButton.OnPurchaseFailedEvent onPurchaseFailed
Field Value
Type | Description |
---|---|
IAPButton.OnPurchaseFailedEvent |
priceText
Displays the localized price from the app store.
Declaration
[Tooltip("[Optional] Displays the localized price from the app store.")]
public Text priceText
Field Value
Type | Description |
---|---|
Text |
productId
Which product identifier to represent. Note this is not a store-specific identifier.
Declaration
[HideInInspector]
public string productId
Field Value
Type | Description |
---|---|
String |
titleText
Displays the localized title from the app store.
Declaration
[Tooltip("[Optional] Displays the localized title from the app store.")]
public Text titleText
Field Value
Type | Description |
---|---|
Text |
Methods
OnPurchaseFailed(Product, PurchaseFailureReason)
Invoked on a failed purchase of the product associated with this button
Declaration
public void OnPurchaseFailed(Product product, PurchaseFailureReason reason)
Parameters
Type | Name | Description |
---|---|---|
Product | product | The |
PurchaseFailureReason | reason | Information to help developers recover from this failure |
ProcessPurchase(PurchaseEventArgs)
Invoke to process a successful purchase of the product associated with this button.
Declaration
public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
PurchaseEventArgs | e | The successful |
Returns
Type | Description |
---|---|
PurchaseProcessingResult | The result of the successful purchase |