rigdonmr rigdonmr - 4 months ago 9
iOS Question

iOS: How to subscribe a customer to an Automatically Renewable Subscription

What are the most basic steps you need to subscribe to an Automatically Renewable Subscription?

Answer

Figured it out. Assuming you know the productID:

First

import StoreKit

Then in your code

let productID: Set = ["monthly"]
let request = SKProductsRequest(productIdentifiers: productID)
request.delegate = self
request.start()

and in the SKProductsRequestDelegate:

if response.products.count > 0 {
  let product = response.products[0]
  let payment = SKPayment(product: product)
  SKPaymentQueue.defaultQueue().addPayment(payment)
}

Your're all welcome

Comments