Class PaymentsKit
PaymentsKit can be used to integrate in-app purchases in your game.
Inheritance
Namespace: Pley
Assembly: Pley.dll
Syntax
public static class PaymentsKit : object
Methods
DangerouslyConsumeEntitlementsAsync(String[])
Consume entitlements.
Use this method to check if you cannot use the TODO: good definition
Declaration
public static async Task<(PleyResult, PleyResult[])> DangerouslyConsumeEntitlementsAsync(string[] entitlementIds)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String[] | entitlementIds |
Returns
| Type | Description |
|---|---|
| Task<System.ValueTuple<PleyResult, PleyResult[]>> |
GetEntitlementsAsync()
Retrieves the player's entitlements that are neither consumed nor refunded.
Use this method to check if there are any unconsumed entitlements from previous sessions that still need to be sent to your backend to be consumed This happens in situations where the game or your backend are interrupted, i.e. crashes, connectivity, user quitting, etc. You should call this method as soon as the game has finished booting.
Declaration
public static async Task<(PleyResult, PaymentsKit.Entitlement[])> GetEntitlementsAsync()
Returns
| Type | Description |
|---|---|
| Task<System.ValueTuple<PleyResult, PaymentsKit.Entitlement[]>> |
GetProductsAsync(String[])
Used to get list of products. The products ID can be found in the Game Manager after you have created the product.
Declaration
public static async Task<(PleyResult, PaymentsKit.GetProductData[])> GetProductsAsync(string[] productIds)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String[] | productIds | Product IDs for the products. |
Returns
| Type | Description |
|---|---|
| Task<System.ValueTuple<PleyResult, PaymentsKit.GetProductData[]>> |
RequestPaymentAsync(String)
Used to start a purchase. The product ID can be found in the Game Manager after you have created the product.
Declaration
public static async Task<(PleyResult, PaymentsKit.PaymentData)> RequestPaymentAsync(string productId)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | productId | Product ID for the product you want to request a purchase for. |
Returns
| Type | Description |
|---|---|
| Task<System.ValueTuple<PleyResult, PaymentsKit.PaymentData>> | Possible errors are the following: PmkProductNotFound, PmkPaymentCancelledByUser, PmkPaymentFailed |
RequestPaymentAsync(String, String)
Used to start a purchase. The product ID can be found in the Game Manager after you have created the product.
Declaration
public static async Task<(PleyResult, PaymentsKit.PaymentData)> RequestPaymentAsync(string productId, string invoiceEmail)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | productId | Product ID for the product you want to request a purchase for. |
| System.String | invoiceEmail | Invoice email the user will be prompt with |
Returns
| Type | Description |
|---|---|
| Task<System.ValueTuple<PleyResult, PaymentsKit.PaymentData>> | Possible errors are the following: PmkProductNotFound, PmkPaymentCancelledByUser, PmkPaymentFailed |