If you’re using Superwall for revenue tracking, but want a hand with making purchases in your implementation, you can use our purchase methods:

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:

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.