public interface PurchaseCallback

Known subtypesPendingPurchaseCallback

Callback interface that the main class must implement in order for in-app-purchasing to work. Once the main class implements this interface the methods within it are invoked to indicate the various purchase states.

Methods

public abstract void itemPurchased(String sku)Indicates a the given SKU was purchased by a user.
public abstract void itemPurchaseError(String sku, String errorMessage)Callback indicating a the given SKU purchase failed
public abstract void itemRefunded(String sku)Deprecated Invoked if a refund was granted for a purchase
public abstract void subscriptionStarted(String sku)Deprecated Invoked when a subscription SKU is started
public abstract void subscriptionCanceled(String sku)Deprecated Invoked when a subscription SKU is canceled
public abstract void paymentFailed(String paymentCode, String failureReason)Indicates that a manual payment has failed
public abstract void paymentSucceeded(String paymentCode, double amount, String currency)Indicates that a manual payment has passed

Method details

itemPurchased

public abstract void itemPurchased(String sku)
Indicates a the given SKU was purchased by a user. When purchasing multiple SKU’s at once multiple calls to this method will be performed.

Parameters

sku String
the sku purchased

itemPurchaseError

public abstract void itemPurchaseError(String sku, String errorMessage)
Callback indicating a the given SKU purchase failed

Parameters

sku String
the id
errorMessage String
Not documented.

itemRefunded

public abstract void itemRefunded(String sku)
Deprecated. This callback is no longer used. Use the Receipts API to check if the user currently “owns” a product. See https://www.codenameone.com/blog/intro-to-in-app-purchase.html for a guide into how to set up in-app purchase for all scenarios including subscriptions.
Invoked if a refund was granted for a purchase

Parameters

sku String
the sku purchased

subscriptionStarted

public abstract void subscriptionStarted(String sku)
Deprecated. Subscriptions should be handled directly in the associated store (iOS/Google Play, etc..). See https://www.codenameone.com/blog/intro-to-in-app-purchase.html for a guide into how to set up in-app purchase for all scenarios including subscriptions.
Invoked when a subscription SKU is started

Parameters

sku String
the sku purchased

subscriptionCanceled

public abstract void subscriptionCanceled(String sku)
Deprecated. Subscriptions should be handled directly in the associated store (iOS/Google Play, etc..). See https://www.codenameone.com/blog/intro-to-in-app-purchase.html for a guide into how to set up in-app purchase for all scenarios including subscriptions.
Invoked when a subscription SKU is canceled

Parameters

sku String
the sku purchased

paymentFailed

public abstract void paymentFailed(String paymentCode, String failureReason)
Indicates that a manual payment has failed

Parameters

paymentCode String
the transaction id of the payment
failureReason String
Not documented.

paymentSucceeded

public abstract void paymentSucceeded(String paymentCode, double amount, String currency)
Indicates that a manual payment has passed

Parameters

paymentCode String
the transaction id of the payment
amount double
Not documented.
currency String
Not documented.