In App Store Connect, there is an App Store Promotion section in which you can choose to have your In-App Purchase appear on your app's product page. In that section it says, "Make sure your app supports the SKPaymentTransactionObserver method to process this transaction."
That link sends you to the docs for paymentQueue(_:shouldAddStorePayment:for:)
.
So, I implemented that method as follows:
class StoreObserver: NSObject, SKPaymentTransactionObserver, SKProductsRequestDelegate {
func paymentQueue(_ queue: SKPaymentQueue, shouldAddStorePayment payment: SKPayment, for product: SKProduct) -> Bool {
return true
}
...
}
I'm returning true
because, as it says in the documentation, "Return true to continue the transaction in your app."
I'm not posting the rest of my In-App Purchase code because I don't think it's relevant to my question: Is there anything else besides returning true
that I need to do inside this method to correctly complete an In-App Purchase initiated on the App Store?
Thank you.
After googling around a bit, I found this article, which seems to answer my question: No, there's nothing else you need to do; returning true
or false
should do it, assuming the rest of your IAP code is set up correctly.
From the article:
To continue an in-app purchase transaction, implement the delegate method in the SKPaymentTransactionObserver protocol and return true. StoreKit then displays the payment sheet, and the user can complete the transaction.