Purchasing Products Outside of a Paywall
Buy Google Play products outside a paywall with the Superwall Android SDK's purchase method, pick a base plan and offer, and read the PurchaseResult.
If you're using Superwall for revenue tracking, but want a hand with making purchases in your implementation, you can use our purchase methods:
// Purchase product with first available baseplan
Superwall.instance.purchase("my_product_id")
// Purchase product with base plan and cheapest/free offer
Superwall.instance.purchase("my_product_id:base_plan:sw-auto")
// Purchase product with a specified offer
Superwall.instance.purchase("my_product_id:base_plan:offer")
// Purchase product with no offer
Superwall.instance.purchase("my_product_id:base_plan:sw-none")For iOS, the purchase() method supports StoreKit 1, 2 and Superwall's abstraction over a product, StoreProduct. You can fetch the products you've added to Superwall via the products(for:) method. Similarly, in Android, you can fetch a product using a product identifier — and the first base plan will be selected:
val products = Superwall.instance.getProducts("id1", "id2")If you already have your own product fetching code, simply pass the product representation to these methods. For example, in StoreKit 1 — an SKProduct instance, in StoreKit 2, Product, etc. Each purchase() implementation returns a PurchaseResult, which informs you of the transaction's resolution:
.cancelled: The purchase was cancelled..purchased: The product was purchased..pending: The purchase is pending/deferred and requires action from the developer..failed(Error): The purchase failed for a reason other than the user cancelling or the payment pending.
How is this guide?
Observer Mode
Report Google Play Billing purchases made outside Superwall on Android with observer mode, so the transactions show up in your Superwall dashboard.
Game Controller Support
Let players navigate Superwall paywalls with a game controller on Android. Set isGameControllerEnabled to true and the SDK forwards gamepad input for you.