add(_:)
Adds a payment request to the queue.
Declaration
func add(_ payment: SKPayment)Parameters
- payment:
A payment request.
Discussion
An application should always have at least one observer of the payment queue before adding payment requests.
The payment request must have a product identifier registered with the Apple App Store and a quantity greater than 0. If either property is invalid, add(_:) throws an exception.
When a payment request is added to the queue, the payment queue processes that request with the Apple App Store and arranges for payment from the user. When that transaction is complete or if a failure occurs, the payment queue sends the SKPaymentTransaction object that encapsulates the request to all transaction observers.