Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
80 changes: 40 additions & 40 deletions CHANGELOG-ASSETSTORE.md

Large diffs are not rendered by default.

187 changes: 174 additions & 13 deletions CHANGELOG.md

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Documentation~/AmazonTesting.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ var builder = ConfigurationBuilder.Instance(
StandardPurchasingModule.Instance());
// Define your products.
builder.AddProduct("someConsumable", ProductType.Consumable);
// Write a product description to the SD card
// Write a product description to the SD card
// in the appropriate location.
builder.Configure<IAmazonConfiguration>()
.WriteSandboxJSON(builder.products);
.WriteSandboxJSON(builder.products);
````

When using this method to write product descriptions to the SD card, declare the Android permission to write to external storage in the test app’s manifest:

````
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
````

Remove this extra permission before publishing, if appropriate.
Remove this extra permission before publishing, if appropriate.

Amazon Sandbox is now set up for local testing. For more information, please see Amazon's [App Tester documentation](https://developer.amazon.com/public/apis/earn/in-app-purchasing/docs-v2/installing-and-configuring-app-tester).
Amazon Sandbox is now set up for local testing. For more information, please see Amazon's [App Tester documentation](https://developer.amazon.com/public/apis/earn/in-app-purchasing/docs-v2/installing-and-configuring-app-tester).
2 changes: 1 addition & 1 deletion Documentation~/AppleReceipt.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ Payload varies depending upon the device's iOS version.
Mac App Store
-------------

Payload is a base 64 encoded [App Receipt](https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html#/apple_ref/doc/uid/TP40010573-CH106-SW1).
Payload is a base 64 encoded [App Receipt](https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html#/apple_ref/doc/uid/TP40010573-CH106-SW1).
2 changes: 0 additions & 2 deletions Documentation~/AppleTesting.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,3 @@ To sign the bundle, you may first need to remove the Contents.meta file if it ex
In order to install the package correctly you must delete the unpackaged .app file before running the newly created package.

You must then launch your App from the Applications folder. The first time you do so, you will be prompted to enter your iTunes account details, for which you should enter your App Store Connect test user account login. You will then be able to make test purchases against the sandbox environment.


2 changes: 1 addition & 1 deletion Documentation~/BackendReceiptValidation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

Backend receipt validation helps you prevent users from accessing content they have not purchased.

For server-side content, where content is downloaded once purchased, the validation should take place on the server before the content is released. Unity does not offer support for server-side validation; however, third-party solutions are available, such as Nobuyori Takahashi’s [IAP project](https://github.com/voltrue2/in-app-purchase).
For server-side content, where content is downloaded once purchased, the validation should take place on the server before the content is released. Unity does not offer support for server-side validation; however, third-party solutions are available, such as Nobuyori Takahashi’s [IAP project](https://github.com/voltrue2/in-app-purchase).
63 changes: 63 additions & 0 deletions Documentation~/CodelessIAPButton.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# IAP Button

IAP Button is a way to purchase or restore products without writing code.

## Adding IAP Button to the Scene

To add an __IAP Button__ to your Scene, in the Unity Editor, select __Window &gt; Unity IAP &gt; Create IAP Button__.

![Creating a Codeless **IAP Button** in the Unity Editor](images/CreateButton.png)

## Handling OnProductFetched
This event will be triggered when IAP retrieves product information from the app stores. It is a good idea to update all text related to the product in the UI with this event such as title, description and price.

**On Product Fetched script example**:
```
public class IAPButtonView : MonoBehaviour
{
[SerializeField]
Text title;
[SerializeField]
TMP_Text price;

public void OnProductFetched(Product product)
{
if (title != null)
{
title.text = product.metadata.localizedTitle;
}

if (price != null)
{
price.text = product.metadata.localizedPriceString;
}
}
}
```

A script like above can be added to the IAPButton to link different views with this event.

## Restore Button
Some app stores, including iTunes, require apps to have a __Restore__ button. Codeless IAP provides an easy way to implement a restore button in your app.

To add a __Restore__ button:

1. Add an __IAP Button__ to your Scene (**Services** &gt; **In-App Purchasing** &gt; **Create IAP Button**).
2. With your __IAP Button__ selected, locate its **IAP Button (Script)** component in the Inspector, then select **Restore** from the **Button Type** drop-down menu (most of the component's other fields will disappear from the Inspector view).
![Modifying an IAP Button to restore purchases](images/CodelessIAPButtonRestoreButton.png)
3. (Optional) You can add a script by clicking the plus (**+**) button to add a script to the **On Transactions Restored (Boolean, String)**.
4. (Optional) Drag the GameObject with the restore transactions script onto the event field in the component’s Inspector, then select your function from the dropdown menu.

**On Transactions Restored script example**:

```
public void OnTransactionsRestored(bool success, string? error)
{
Debug.Log($"TransactionsRestored: {success} {error}");
}
```

When a user selects this button at run time, the button calls the purchase restoration API for the current store. This functionality works on the iOS App Store, the Mac App Store and the Windows Store. You may want to hide the __Restore__ button on other platforms.

Unity IAP will always invoke the __On Transactions Restored (Boolean, String)__ function on the __Restore IAP Button__ with the result and the associated error message if the restore fails.
If the restore succeeds, Unity IAP invokes the __On Purchase Complete (Product)__ function on the __IAP Button__ associated with that Product.
2 changes: 1 addition & 1 deletion Documentation~/DefiningProductsCoded.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Defining Products in scripts

You can declare your Product list programmatically using the [Purchasing Configuration Builder](xref:UnityEngine.Purchasing.ConfigurationBuilder).
You can declare your Product list programmatically using the [Purchasing Configuration Builder](xref:UnityEngine.Purchasing.ConfigurationBuilder).
You must provide a unique cross-store __Product ID__ and __Product Type__ for each Product:

````
Expand Down
7 changes: 3 additions & 4 deletions Documentation~/DefiningProductsOverview.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Defining products

## Product ID
Enter a cross-platform unique identifier to serve as the Product’s default ID when communicating with an app store.
Enter a cross-platform unique identifier to serve as the Product’s default ID when communicating with an app store.

**Important**: The ID may only contain lowercase letters, numbers, underscores, or periods.

Expand Down Expand Up @@ -34,12 +34,11 @@ Use this section to add local, fixed definitions for the content you pay out to
| __Payout Type__ | Enum | Defines the category of content the purchaser receives. There are four possible Types. | * Currency <br/> * Item<br/> * Resource <br/> * Other|
| __Payout Subtype__ | String | Provides a level of granularity to the content category. |* “Gold” and “Silver” subtypes of a __Currency__ type <br/> * “Potion” and “Boost” subtypes of an __Item__ type |
| __Quantity__ | Int | Specifies the number of items, currency, and so on, that the purchaser receives in the payout. | * 1 <br/> * &gt;25<br/>* 100|
| __Data__ | | Use this field any way you like as a property to reference in code. | * Flag for a UI element<br/> * Item rarity |
| __Data__ | | Use this field any way you like as a property to reference in code. | * Flag for a UI element<br/> * Item rarity |

**Note**: You can add multiple Payouts to a single Product.
**Note**: You can add multiple Payouts to a single Product.

For more information on the PayoutDefinition class, see the [Scripting Reference](xref:UnityEngine.Purchasing.PayoutDefinition). You can always add Payout information to a Product in a script using this class. For example:

### Store ID Overrides
By default, Unity IAP assumes that your Product has the same identifier (specified in the **ID** field, above) across all app stores. Unity recommends doing this where possible. However, there are occasions when this is not possible, such as when publishing to both iOS and Mac stores, which prohibit developers from using the same product ID across both.

2 changes: 1 addition & 1 deletion Documentation~/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@

7. Click the toggle next to **In-App Purchasing Settings** to **ON**.

This will automatically install the IAP package from the Package Manager, providing you with new features and menu items to help you manage IAP.
This will automatically install the IAP package from the Package Manager, providing you with new features and menu items to help you manage IAP.
2 changes: 1 addition & 1 deletion Documentation~/GooglePublicKey.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ It is possible to set the Google Public Key in two different places either in th
2. Open the left menu and select `Settings` then `Project Settings` under `Project`
![GooglePublicKeyDashboardSetting](images/IAPGooglePublicKeyDashboardSetting.png) and select the project
3. In the section `In-app purchase (IAP) settings` edit the field `Google License Key`
![GooglePublicKeyDashboard](images/IAPGooglePublicKeyDashboard.png)
![GooglePublicKeyDashboard](images/IAPGooglePublicKeyDashboard.png)
2 changes: 1 addition & 1 deletion Documentation~/GoogleReceipt.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ Payload is a JSON hash with the following keys and values:
|Key|Value|
|:---|:---|
|__json__|A JSON encoded string provided by Google; [`INAPP_PURCHASE_DATA`](http://developer.android.com/google/play/billing/billing_reference.html)|
|__signature__|A signature for the json parameter, as provided by Google; [`INAPP_DATA_SIGNATURE`](http://developer.android.com/google/play/billing/billing_reference.html)|
|__signature__|A signature for the json parameter, as provided by Google; [`INAPP_DATA_SIGNATURE`](http://developer.android.com/google/play/billing/billing_reference.html)|
2 changes: 1 addition & 1 deletion Documentation~/HowToTest.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ This option display no dialog.
This option will show a simple dialog is shown when Purchasing.

### 3. DeveloperUser
This option will show a dialog giving options for failure reason code selection when Initializing/Retrieving Products and when Purchasing.
This option will show a dialog giving options for failure reason code selection when Initializing/Retrieving Products and when Purchasing.
18 changes: 16 additions & 2 deletions Documentation~/IAPButton.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# IAP Button
# IAP Button (Legacy)

IAP Button (Legacy) is obsolete. Please use [IAP Button](CodelessIAPButton.md). This new button allows for more UI customization and new events such as `OnProductFetched(Product)`.

IAP Button is a way to purchase or restore products without writing code.

## Adding IAP Button to the Scene

To add an __IAP Button__ to your Scene, in the Unity Editor, select __Window &gt; Unity IAP &gt; Create IAP Button__.
To add an __IAP Button__ to your Scene, in the Unity Editor, select __Window &gt; Unity IAP &gt; Create IAP Button (Legacy)__.

![Creating a Codeless **IAP Button** in the Unity Editor](images/CreateButton.png)

Expand All @@ -16,7 +18,19 @@ To add a __Restore__ button:
1. Add an __IAP Button__ to your Scene (**Services** &gt; **In-App Purchasing** &gt; **Create IAP Button**).
2. With your __IAP Button__ selected, locate its **IAP Button (Script)** component in the Inspector, then select **Restore** from the **Button Type** drop-down menu (most of the component's other fields will disappear from the Inspector view).
![Modifying an IAP Button to restore purchases](images/RestoreButton.png)
3. (Optional) You can add a script by clicking the plus (**+**) button to add a script to the **On Transactions Restored (Boolean, String)**.
4. (Optional) Drag the GameObject with the restore transactions script onto the event field in the component’s Inspector, then select your function from the dropdown menu.

**On Transactions Restored script example**:

```
public void OnTransactionsRestored(bool success, string? error)
{
Debug.Log($"TransactionsRestored: {success} {error}");
}
```

When a user selects this button at run time, the button calls the purchase restoration API for the current store. This functionality works on the iOS App Store, the Mac App Store and the Windows Store. You may want to hide the __Restore__ button on other platforms.

Unity IAP will always invoke the __On Transactions Restored (Boolean, String)__ function on the __Restore IAP Button__ with the result and the associated error message if the restore fails.
If the restore succeeds, Unity IAP invokes the __On Purchase Complete (Product)__ function on the __IAP Button__ associated with that Product.
2 changes: 1 addition & 1 deletion Documentation~/IAPListener.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ When your catalog contains at least one Product, you can define __IAP Button__ b
public void GrantCredits (int credits){
userCredits = userCredits + credits;
Debug.Log(“You received “ + credits “ Credits!”);
}
}
```

Run your game to test the __IAP Button__.
6 changes: 6 additions & 0 deletions Documentation~/InitializationOverview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Initialization

In order to use the **Unity In-App Purchasing** package, **Unity Gaming Services** needs to be initialized first followed by the initialization of **Unity In-App Purchasing**.

The following diagram visually describes steps to initialize Unity In-App Purchasing.
![Initialization flow diagram](images/UGSInitializationFlowDiagram.png)
2 changes: 1 addition & 1 deletion Documentation~/Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ More information can be found in the `Stores` section of this manual

#### Unity Learn IAP classes

[Refer to the Unity Learn IAP classes](https://learn.unity.com/tutorial/unity-iap) for more guidance.
[Refer to the Unity Learn IAP classes](https://learn.unity.com/tutorial/unity-iap) for more guidance.
4 changes: 2 additions & 2 deletions Documentation~/StoresSupported.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ The following is the full list of stores supported by the In-App Purchasing pack

|Store Name|Platform|Version|Website|
|---|---|---|---|
|Google Billing|Android|3.0.3|[Google Release Notes](https://developer.android.com/google/play/billing/release-notes)|
|Google Billing|Android| 5.1.0|[Google Release Notes](https://developer.android.com/google/play/billing/release-notes)|
|Amazon Appstore|Android|2.0.76|[Amazon SDK](https://developer.amazon.com/docs/in-app-purchasing/iap-get-started.html#download-the-iap-sdk)|
|Samsung|Android|Removed use [UDP](https://unity.com/products/unity-distribution-portal) instead| [UDP](https://unity.com/products/unity-distribution-portal)|
|Unity Distribution Portal|Android|2.0.0 and higher|[UDP](https://unity.com/products/unity-distribution-portal)|
|App Store|MacOS / iOS / tvOS|Store Kit v1|[Apple Store Kit](https://developer.apple.com/documentation/storekit)|
|Microsoft Store|Windows||[Microsoft SDK](https://docs.microsoft.com/en-us/windows/uwp/monetize/in-app-purchases-and-trials)|
|Microsoft Store|Windows||[Microsoft SDK](https://docs.microsoft.com/en-us/windows/uwp/monetize/in-app-purchases-and-trials)|
9 changes: 7 additions & 2 deletions Documentation~/TableOfContents.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@
* [Overview](DefiningProductsOverview.md)
* [Coded](DefiningProductsCoded.md)
* [IAP Catalog](UnityIAPDefiningProducts.md)
* [Initialize IAP](UnityIAPInitialization.md)
* Initialization
* [Overview](InitializationOverview.md)
* [Initialize Unity Gaming Services](UnityIAPInitializeUnityGamingServices.md)
* [Initialize IAP](UnityIAPInitialization.md)
* [Fetching Additional Products](UnityIAPFetchingProductsIncrementally.md)
* Creating a Purchasing Button
* [Browsing Product Metadata](UnityIAPBrowsingMetadata.md)
* [IAP Button](IAPButton.md)
* [IAP Button](CodelessIAPButton.md)
* [IAP Button (Legacy)](IAPButton.md)
* [Coded](UnityIAPInitiatingPurchases.md)
* The Purchasing Flow
* Processing Purchases
Expand Down Expand Up @@ -44,6 +48,7 @@
* [Extensions and Configuration](UnityIAPiOSMAS.md)
* [Purchase Receipt](AppleReceipt.md)
* [Testing](AppleTesting.md)
* [Family Sharing](UnityIAPAppleFamilySharing.md)
* Microsoft Store (UWP)
* [How to Set Up](UnityIAPWindowsConfiguration.md)
* [Purchase Receipt](MicrosoftReceipt.md)
Expand Down
11 changes: 4 additions & 7 deletions Documentation~/UnityIAPAmazonConfiguration.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Introduction

This guide describes the process of setting up the Amazon Appstore for use with the Unity in-app purchasing (IAP) system. This includes establishing the digital records and relationships that are required to interact with the Unity IAP API, setting up an Amazon developer account, and testing and publishing a Unity IAP application.
This guide describes the process of setting up the Amazon Appstore for use with the Unity in-app purchasing (IAP) system. This includes establishing the digital records and relationships that are required to interact with the Unity IAP API, setting up an Amazon developer account, and testing and publishing a Unity IAP application.

As with other platforms, the Amazon store allows for the purchase of virtual goods and managed products. These digital products are identified using a string identifier and an additional type to define durability, with choices including subscription (capable of being subscribed to), consumable (capable of being rebought), and non-consumable (capable of being bought once).

Expand All @@ -19,15 +19,15 @@ As with other platforms, the Amazon store allows for the purchase of virtual goo
2. For FireOS devices, the Amazon Appstore should come pre-installed.<br/><br/>**Note**: Though you may freely target FireOS devices, FireOS is not a Unity-supported platform.<br/><br/>
3. Once you have installed the Amazon Appstore, install the [Amazon App Tester](http://www.amazon.com/Amazon-App-Tester/dp/B00BN3YZM2/).

![](images/AmazonConfiguration-AmazonAppTester.png)
![](images/AmazonConfiguration-AmazonAppTester.png)
1. Set up the Android SDK
1. To install and watch the Android debug log, ensure you have the [Android SDK](https://developer.android.com/studio/install.html) installed. Download the relevant command line tools package from the Android SDK install page and extract them to your computer.
1. Confirm that the SDK recognizes the attached Android device through the command-line adb tool. For example:

````
|[11:07:01] user@laptop:/Applications | $ adb devices
List of devices attached
00DA0807526300W5 device
00DA0807526300W5 device
````

### Unity app setup
Expand All @@ -48,6 +48,3 @@ It's not necessary to download Amazon's native IAP plug-in when preparing to use
1. Set up your catalog. Using the product descriptions you prepared earlier, add the items to the Amazon catalog using the Amazon Developer Portal. Navigate to your app's page, and find the __In-App Items section__. Use the __Add a Consumable__, __Add an Entitlement__, or __Add a Subscription__ buttons to set up your catalog.

![](images/AmazonConfiguration-SetUpCatalog.png)



3 changes: 1 addition & 2 deletions Documentation~/UnityIAPAmazonExtendedFunctionality.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ To fetch the current Amazon User ID for other Amazon services, use the `IAmazonE
public void OnInitialized
(IStoreController controller, IExtensionProvider extensions)
{
string amazonUserId =
string amazonUserId =
extensions.GetExtension<IAmazonExtensions>().amazonUserId;
// ...
}
````

Loading