Currently, I am not a RevenueCat user.
I use pure StoreKit2, to handle subscription and in-app purchase, without any issue.
I also do not have a server, to handle any purchase related thingy.
However, due to the frustrated high approved refund rate, I am interested in RevenueCat’s offering - https://www.revenuecat.com/blog/company/handle-apple-refund-requests-automatically/
But, I wish to keep my existing StoreKit2 untouched, because they are working without issue.
- My sole goal is to able to handle CONSUMPTION_REQUEST, to reduce refund rate.
- I am only concerning on the upcoming new users, if we ever integrating RevenueCat. I am not concerning existing users. Hence, can I skip this step, as it seems complicated to me - https://www.revenuecat.com/docs/migrating-to-revenuecat/migrating-existing-subscriptions.
- Is it as simple as having this line of code?
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
Purchases.configure(
with: .init(withAPIKey: "<public_sdk_key>")
.with(purchasesAreCompletedBy: .myApp, storeKitVersion: .storeKit2)
)
}
- Currently, this is our pure StoreKit2 code. Do we need to pass any information to RevenueCat?
func purchase(_ shop: Shop) async -> Bool {
if !isProductsReady() {
// Retry again.
await postInit()
}
guard let product = products.filter({ $0.id == shop.identifier }).first else { return false }
do {
//Begin a purchase.
let result = try await product.purchase()
switch result {
case .success(let verification):
let transaction = try checkVerified(verification)
//Deliver content to the user.
await updatePurchasedIdentifiers(transaction)
//Always finish a transaction.
await transaction.finish()
return true
case .userCancelled, .pending:
return false
default:
return false
}
} catch {
error_log(error)
}
return false
}
- My concern is the generated data for `ConsumptionRequest`
For instance, how are we going to generate the data for appAccountToken?
Do we need more modify our code from
let result = try await product.purchase()
to
let token = createUUID(...)
let purchaseOption = Product.PurchaseOption.appAccountToken(token)
let result = try await product.purchase(options: [purchaseOption])
- Where we can store this token, so that we can respond to CONSUMPTION_REQUEST with the same token?
- How can we perform sandbox testing for CONSUMPTION_REQUEST case? I guess during the testing, we need server to send us a valid transaction id, so that we can retrieve sandbox purchasing information, via API https://developer.apple.com/documentation/appstoreserverapi/get_transaction_info ?
Sorry for the long question. Thank you for reading.