Class CodelessIAPButton
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
Assembly: Unity.Purchasing.Codeless.dll
Syntax
[AddComponentMenu("In-App Purchasing/IAP Button")]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.purchasing@latest")]
public class CodelessIAPButton : MonoBehaviour
Fields
automaticallyConfirmTransaction
Consume the product immediately after a successful purchase.
Declaration
[FormerlySerializedAs("consumePurchase")]
[Tooltip("Automatically confirm the transaction immediately after a successful purchase.")]
public bool automaticallyConfirmTransaction
Field Value
Type | Description |
---|---|
bool |
See Also
button
Declaration
[Tooltip("Button that triggers purchase.")]
public Button? button
Field Value
Type | Description |
---|---|
Button |
See Also
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 CodelessButtonType buttonType
Field Value
Type | Description |
---|---|
Codeless |
See Also
onOrderConfirmed
Event fired after a confirmed order.
Declaration
[Tooltip("Event fired after a confirmed order.")]
public CodelessIAPButton.OnOrderConfirmedEvent? onOrderConfirmed
Field Value
Type | Description |
---|---|
Codeless |
See Also
onOrderDeferred
Event fired after deferring to purchase an order.
Declaration
[Tooltip("Event fired after the payment of a purchase was delayed or postponed for this product.")]
public CodelessIAPButton.OnOrderDeferredEvent? onOrderDeferred
Field Value
Type | Description |
---|---|
Codeless |
See Also
onOrderPending
Event fired after a pending order.
Declaration
[Tooltip("Event fired after a pending order.")]
public CodelessIAPButton.OnOrderPendingEvent? onOrderPending
Field Value
Type | Description |
---|---|
Codeless |
See Also
onProductFetchFailed
Event fired after failing to fetch a product.
Declaration
[Tooltip("Event fired after failing to fetch a product.")]
public CodelessIAPButton.OnProductFetchFailedEvent? onProductFetchFailed
Field Value
Type | Description |
---|---|
Codeless |
See Also
onProductFetched
Event fired after fetching a product.
Declaration
[Tooltip("Event fired after fetching a product.")]
public CodelessIAPButton.OnProductFetchedEvent? onProductFetched
Field Value
Type | Description |
---|---|
Codeless |
See Also
onPurchaseFailed
Event fired after a failed purchase of this product.
Declaration
[Tooltip("Event fired after a failed purchase of this product.")]
public CodelessIAPButton.OnPurchaseFailedEvent? onPurchaseFailed
Field Value
Type | Description |
---|---|
Codeless |
See Also
onPurchaseFetched
Event fired after fetching a purchase.
Declaration
[Tooltip("Event fired after fetching a purchase.")]
public CodelessIAPButton.OnPurchaseFetchedEvent? onPurchaseFetched
Field Value
Type | Description |
---|---|
Codeless |
See Also
onTransactionsRestored
Event fired after a restore transactions.
Declaration
[Tooltip("Event fired after a restore transactions.")]
public CodelessIAPButton.OnTransactionsRestoredEvent? onTransactionsRestored
Field Value
Type | Description |
---|---|
Codeless |
See Also
productId
Which product identifier to represent. Note this is not a store-specific identifier.
Declaration
[HideInInspector]
public string? productId
Field Value
Type | Description |
---|---|
string |
See Also
Methods
OnOrderConfirmed(ConfirmedOrder)
Invoked on a failed purchase of the product associated with this button
Declaration
public void OnOrderConfirmed(ConfirmedOrder order)
Parameters
Type | Name | Description |
---|---|---|
Confirmed |
order | The |
See Also
OnOrderDeferred(DeferredOrder)
Invoked on a deferred order associated with this button
Declaration
public void OnOrderDeferred(DeferredOrder deferredOrder)
Parameters
Type | Name | Description |
---|---|---|
Deferred |
deferredOrder | The |
See Also
OnOrderPending(PendingOrder)
Invoked on a failed purchase of the product associated with this button
Declaration
public void OnOrderPending(PendingOrder order)
Parameters
Type | Name | Description |
---|---|---|
Pending |
order | The |
See Also
OnProductFetchFailed(ProductDefinition, string)
Invoked for each failed fetch product.
Declaration
public void OnProductFetchFailed(ProductDefinition product, string failureReason)
Parameters
Type | Name | Description |
---|---|---|
Product |
product | The product that failed to be fetched. |
string | failureReason | The reason the fetch product failed. |
See Also
OnProductFetched(Product)
Invoked for each fetched product.
Declaration
public void OnProductFetched(Product product)
Parameters
Type | Name | Description |
---|---|---|
Product | product | The fetched product. |
See Also
OnPurchaseFailed(FailedOrder)
Invoked on a failed order associated with this button
Declaration
public void OnPurchaseFailed(FailedOrder failedOrder)
Parameters
Type | Name | Description |
---|---|---|
Failed |
failedOrder | The |
See Also
OnPurchaseFetched(Order)
Invoked for each fetched purchase.
Declaration
public void OnPurchaseFetched(Order order)
Parameters
Type | Name | Description |
---|---|---|
Order | order | The fetched purchase. |
See Also
OnTransactionsRestored(bool, string?)
Invoked on transactions restored.
Declaration
public void OnTransactionsRestored(bool success, string? error)
Parameters
Type | Name | Description |
---|---|---|
bool | success | Indicates if the restore transaction was successful. |
string | error | When unsuccessful, the error message. |