Apphud.purchase(product){...}
method. You can read more about StoreKit Configuration File set up in our blog post. trial period
field is missing, as well as pending_renewal_info
, which is a special sub-json containing important fields about the state of subscription, like auto-renew, in billing retry, etc.trial
status of the subscription. That means after purchasing subscription with trial period, you will get ApphudSubscripton
model with regular
status in the response. But don't worry, that is only local receipt issue, everything will work fine in production!ApphudSubscripton
models generated from local receipts will always have isInRetryBilling
= false
and isAutorenewEnabled
= true
, unless expired.expired
state after the first transaction is expired. When launching the app again in simulator, a new receipt will be automatically sent to Apphud, and subscriptions data will be updated. No actions required on developer side. Again, everything will work just fine in production.checkEligibilityForIntroductoryOffer
method please do the following:Apphud.migratePurchasesIfNeeded{}
or by tapping restore purchases button in your App's UI. This is required only in Sandbox, because apps running from Xcode/TestFlight initially don't have App Store Receipts and Apphud doesn't automatically refresh missing App Store receipts to avoid Apple ID password prompt. At production, however, everything will work okay, because App Store receipts always exist in apps downloaded from the App Store.true
because you didn't yet use introductory offer. After you have used introductory offer, method will return false
.checkEligibilityForPromotionalOffer
method please do the following:Apphud.migratePurchasesIfNeeded{}
or by tapping restore purchases button in your App's UI. This is required only in Sandbox, because apps running from Xcode/TestFlight initially don't have App Store Receipts and Apphud doesn't automatically refresh missing App Store receipts to avoid Apple ID password prompt. At production, however, everything will work okay, because App Store receipts always exist in apps downloaded from the App Store.true
if Apphud User has any subscription and false
if user doesn't have any subscriptions.Apphud.hasActiveSubscription
method still returns true
Apphud.hasActiveSubscription
returns false
Apphud.enableDebugLogs()
before SDK initialisation. If you have any issues with in-app purchase, the error will populate in console.ApphudPurchaseResult
object. If purchase failed, you get error that may be of three classes:SKError
from StoreKit with SKErrorDomain
codes. This is a system error when purchasing transaction. Apphud is not responsible for SKError
domain codes, because they are returned directly from App Store.NSError
from HTTP Client with NSURLErrorDomain
codes. This is a network/server issue when uploading receipt to Apphud.ApphudError
without codes. For example, if couldn't sign promo offer or couldn't get App Store receipt. This is SDK level error.SKError.code
= unknown
SKPaymentTransaction
fails with SKError.code
= unknown
, it is a generic error message that App Store generates. This may be one of:SKError.code
= paymentCancelled
, then the payment was cancelled by user, do nothing in this case. In other cases you may want to display the error message to user.failed
transactions is Strong Customer Authentication (SCA) for European Economic Area, which requires all payments to be verified. In this case current transaction goes to failed
state, and once payment is approved, a new transaction with purchased
state is created. Apphud SDK automatically handles interrupted purchases for this case as well, you have nothing to do about it.SKReceiptRefreshRequest
, but if receipt is still missing "Failed to get App Store Receipt" error will be thrown. Apphud SDK is unable to recover this issue and due to iOS / Sandbox bug. Unfortunately, this often happens to Apple Reviewers.SKError.code = unknown
SKProducts
were actually loaded in reviewer's paywall screen. In most cases reviewer attaches a screenshot of their error / paywall screen.When validating receipts on your server, your server needs to be able to handle a production-signed app getting its receipts from Apple’s test environment. The recommended approach is for your production server to always validate receipts against the production App Store first. If validation fails with the error code "Sandbox receipt used in production," you should validate against the test environment instead.
2.1.0
ASIdentifierManager
is no longer used as well as AdSupport
framework:Failed to load SKProducts from the App Store, because product identifiers are invalid
error means that Product IDs provided in Apphud Product Hub are invalid. Please check the following:Attempted to decode store response
" error while fetching productsFailed to load SKProducts from the App Store, error
with reason Attempted to decode store response
, that probably means that you are running the app in iOS Simulator which doesn't support App Store features. Try running on physical device instead.
On iOS Simulator you can test App Store features using Local StoreKit configuration file.Apphud.didFetchProductsNotification()
func productsDidFetchCallback(_ callback: @escaping ([SKProduct]) -> Void)
func apphudDidFetchStoreKitProducts(_ products: [SKProduct])
delegate method.func apphudProductIdentifiers() -> [String]
delegate method. See ApphudDelegate
for details.