Skip to main content
Samsung Developer Program

Purchase

public class Purchase

This class represents an in-app billing purchase.

Purchase Constructor Summary

Modifier

Constructor

private

Purchase()

public

Purchase(string jsonString)

public

Purchase(JSON json)

Purchase Constructor Details

Purchase

private Purchase()

Empty constructor

Purchase

public Purchase(string jsonString)

Creates a Purchase object from a JSON string.

Parameters:

jsonString String in JSON format
Purchase

public Purchase(JSONjson)

Creates a Purchase object from a JSON object.

Parameters:

json JSON object instance

Purchase Method Summary

Modifier and Type

Method

public static Purchase

CreateFromSku(string sku)

public static Purchase

CreateFromSku(string sku, string developerPayload)

public override string

ToString()

private static void

AddIOSHack(Purchase p)

public string

Serialize()

Purchase Method Details

CreateFromSku

public static Purchase CreateFromSku(string sku)

Creates a purchase from the specified SKU item ID for debug purposes and in editor mode.

Parameters:

sku SKU identifier of the item
CreateFromSku

public static Purchase CreateFromSku(string sku, string developerPayload)

For debug purposes and editor mode.

Parameters:

sku SKU identifier of the item

developerPayload

This assigned with a blank string; not supported by Samsung IAP.
This string is used for verification purposes to check if the purchase is legitimate or not. The app store returns the developer payload and is matched with the developer payload from the app.

ToString

public override string ToString()

Gets a string of the original JSON sent by the current app store for the SKU.

Returns:

Returns a string of the original JSON sent by the current app store for the SKU.

AddIOSHack

private static void AddIOSHack(Purchase p)

For iOS® Unity app, this method checks if the app store name, item type, or the order ID is null or empty.

When one of the variables is empty or null, this method sets the respective variables accordingly based on Apple app store settings.

Parameters:

p Purchase object instance
Serialize

public string Seralize()

Creates a JSON object instance that contains the item type, order ID, package name, SKU, purchase time, purchase state, developer payload, token, original JSON, signature, app store name, and receipt.

Returns:

Returns a serialized JSON object in string form.

  • Was this article helpful?