consume

suspend fun consume(purchaseToken: String): Result<String>(source)

Initiates a consumption of an In-App product.

Use this function to consume an In-App product after processing it in your application. Returns a Result.success if finished, or a Result.failure with a BillingError If the error is not a BillingError, something went wrong in communication with the store itself.

Return

Result.success with the purchase token or a Result.failure

Parameters

purchaseToken

: The purchaseToken related to the purchase you wish to consume.


fun consume(purchaseToken: String, onConsumed: (Result<String>) -> Unit)(source)

Initiates a consumption of an In-App product.

Use this function to consume an In-App product after processing it in your application. Returns a Result.success if finished, or a Result.failure with a BillingError If the error is not a BillingError, something went wrong in communication with the store itself.

Parameters

purchaseToken

: The purchaseToken related to the purchase you wish to consume.

onConsumed

: A callback that will receive the Result<String>, containing Result.success with the purchase token or a Result.failure