Unclaimed Package Is this your package? Claim it to unlock full analytics and manage your listing.
Claim This Package

Install via UPM

Add to Unity Package Manager using this URL

https://www.pkglnk.dev/kongregate-iap.git

README Markdown

Copy this to your project's README.md

Style
Preview
pkglnk installs badge
## Installation

Add **Kongregate Purchasing** to your Unity project via Package Manager:

1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/kongregate-iap.git
```

[![pkglnk](https://www.pkglnk.dev/badge/kongregate-iap.svg?style=pkglnk)](https://www.pkglnk.dev/pkg/kongregate-iap)

README

Unity IAP Store for Kongregate

This package provides a Unity IAP store implementation for the Kongregate website. This allows you to easily add support in-app purchases through the Kongregate website if your game is setup to use Unity IAP.

Setup

To include kongregate-iap as a Unity package, you'll need to be on Unity 2018.3 or later. Open Packages/manifest.json in your project and add "com.kongregate.kongregate-iap" to the "dependencies" object:

{
  "dependencies": {
    "com.kongregate.kongregate-iap": "https://github.com/randomPoison/kongregate-iap.git"
  }
}

NOTE: You'll need to have Git installed on your development machine for Unity to be able to download the dependency. See https://git-scm.com/ for more information.

NOTE: If you're using an older version of Unity, you can still use kongregate-iap by copying the contents of Scripts into your project's Assets folder.

kongregate-iap depends on the kongregate-web package, which requires additional setup. If you're not already using kongregate-web directly, follow the kongregate-web setup instructions in order to get started.

Usage

When initializing Unity IAP, provide KongregatePurchasingModule.Instance() to ConfigurationBuilder.Instance() in order to setup the Kongregate store on WebGL:

var builder = ConfigurationBuilder.Instance(
    KongregatePurchasingModule.Instance(),
    StandardPurchasingModule.Instance());

Custom Purchasing Module

The basic setup described will always configure your game to use the Kongregate store when building a WebGL player. However, if you need more control over when you use the Kongregate store on WebGL, you can create a custom store module to do so. In your custom module's Configure() method, you should register KongregateStore as follows:

public override void Configure()
{
    RegisterStore(
        KongregateStore.STORE_NAME,
        UseKongregateStore ? new KongregateStore() : null);

    // Register any other stores...
}

Receipt Data

When using the Kongregate store, the Store field in the purchase receipt is "Kongregate". The Payload field is a JSON-encoded string containing the following fields:

  • AuthToken: string - The authorization token for the user who made the purchase.
  • Items: int[] - An array of unique item IDs.

You can use UnityEngine.JsonUtility.FromJson() to deserialize Payload into an instance of KongregateStore.Receipt if you need to inspect its contents.

Comments

No comments yet. Be the first!