purchase

suspend fun purchase(product: ProductDetails): Result<PurchaseResult>(source)

Initiates a purchase of ProductDetails.

Use this function to purchase any ProductDetails, regardless of whether you have a paywall or not. Superwall will handle the purchase with GooglePlayBilling and return the PurchaseResult. You'll see the data associated with the purchase on the Superwall dashboard.

Return

A `PurchaseResult`.

  • Note: You do not need to finish the transaction yourself after this. `Superwall` will handle this for you.

Parameters

product

: The ProductDetails you wish to purchase.


Initiates a purchase of StoreProduct.

Use this function to purchase any StoreProduct, regardless of whether you have a paywall or not. Superwall will handle the purchase with GooglePlayBilling and return the PurchaseResult. You'll see the data associated with the purchase on the Superwall dashboard.

Return

A `PurchaseResult`.

  • Note: You do not need to finish the transaction yourself after this. `Superwall` will handle this for you.

Parameters

product

: The StoreProduct you wish to purchase.


suspend fun purchase(productId: String): Result<PurchaseResult>(source)

Initiates a purchase of a product with the given productId.

Use this function to purchase any product with a given product ID, regardless of whether you have a paywall or not. Superwall will handle the purchase with GooglePlayBilling and return the PurchaseResult. You'll see the data associated with the purchase on the Superwall dashboard.

Return

A `PurchaseResult`.

  • Note: You do not need to finish the transaction yourself after this. `Superwall` will handle this for you.

Parameters

product

: The produdctId you wish to purchase.


fun purchase(product: StoreProduct, onFinished: (Result<PurchaseResult>) -> Unit)(source)

Initiates a purchase of a StoreProduct with a callback.

Use this function to purchase any StoreProduct, regardless of whether you have a paywall or not. Superwall will handle the purchase with GooglePlayBilling and return the PurchaseResult in onFinished. You'll see the data associated with the purchase on the Superwall dashboard.

Parameters

product

: The StoreProduct you wish to purchase.

onFinished

: A callback that will receive the PurchaseResult.

  • Note: You do not need to finish the transaction yourself after this. `Superwall` will handle this for you.


fun purchase(product: ProductDetails, onFinished: (Result<PurchaseResult>) -> Unit)(source)
fun purchase(productId: String, onFinished: (Result<PurchaseResult>) -> Unit)(source)