Allow developers who have their own purchase logic with StoreKit to use our paywalls.
Adds a new API purchasesAreCompletedBy: PurchasesAreCompletedBy to Purchases, which replaces finishTransactions, and observerMode which have been marked as deprecated (public APIs only).
Internal references to finishTransactions and observerMode will be done as a separate PR.
Todo
[x] Update any doc on new method to make sure its SUPER CLEAR on what its doing and that it will only work if finishTransactions (trying to not call it observer mode) is disabled
[x] Maybe add some debug logs so developer knows which path paywalls purchase buttons are taking if finish transaction is disabled
[x] Fix broken unit/integration tests
[x] Add new tests
[x] Add new API tests
[x] Also add a similar method for handleRestore()
Description
Adds new . handlePurchaseAndRestore modifier that can be used to complete purchases initiated via a paywall:
.handlePurchaseAndRestore(
performPurchase: { storeProduct, purchaseResultReporter in
// make purchase for `storeProduct`
// report result to RevenueCat
purchaseResultReporter.reportResult(userCancelled: false, error: nil)
}, performRestore: { restoreResultReporter in
// restore purchases
// report result to RevenueCat
restoreResultReporter.reportResult(success: true, error: nil)
})
Motivation
purchasesAreCompletedBy: PurchasesAreCompletedBy
toPurchases
, which replacesfinishTransactions
, andobserverMode
which have been marked as deprecated (public APIs only).finishTransactions
andobserverMode
will be done as a separate PR.Todo
finishTransactions
(trying to not call it observer mode) is disabledhandleRestore()
Description
Adds new
. handlePurchaseAndRestore
modifier that can be used to complete purchases initiated via a paywall: