Initializer

init(product:)

Returns a new payment for the specified product.

Declaration

convenience init(product: SKProduct)

Parameters

product

The product the user wishes to purchase.

Return Value

A new payment object.

Discussion

This Object creation uses the productIdentifier property obtained from the product parameter to create and return a new payment with that identifier. The quantity property defaults to 1.

To create a SKPayment object with a quantity greater than 1, create a SKMutablePayment object, adjust its quantity property and then add it to the payment queue.

SKMutablePayment *myPayment = [SKMutablePayment paymentWithProduct: myProduct];
myPayment.quantity = 2;
[[SKPaymentQueue defaultQueue] addPayment:myPayment];

See Also