iOS Most basic steps for purchasing/subscribing a user to an IAP


Example

Assuming you know the productID:

First

import StoreKit

Then in your code

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

and in the SKProductsRequestDelegate:

func productsRequest(request: SKProductsRequest, didReceiveResponse response: SKProductsResponse) {
    if response.products.count > 0 {
        let product = response.products[0]
        let payment = SKPayment(product: product)
        SKPaymentQueue.defaultQueue().addPayment(payment)
    }
}