I attempting to downgrade a purchase with DEFERRED, which was reinstated in Android SDK 8.2.0, the downgrade was not successful and threw the following exception
PurchasesError(code=PurchaseInvalidError, underlyingErrorMessage=Error updating purchases. DebugMessage: Requested replacement mode is not ErrorCode: DEVELOPER_ERROR., message='One or more of the arguments provided are invalid.)
I have tried three others.
- Specifying a GoogleReplacementMode other than DEFERRED.
- The downgrade here was successful.
- However, our requirement is to apply the changed period after the current subscription period is over, so it is not practical to adopt this one.
- Not specifying oldProductId.
- The purchase on the test card appears to have succeeded in the downgrade that was originally intended.
- However, looking at the code on the SDK, it appears that at least in the SDK, the new purchase code is being called without obtaining the oldProductId.
- (I don't know why it's working so well, maybe the PBL side is being clever?)
- Trying the same case with another app.
- This one succeeded, but the ID format is compliant with the old PBL
- The apps that succeeded had IDs like gold_6m, gold_1m
- The app that fails has a "productId:basePlanId" structure like gold:6m, gold:1m because the product is configured with the new PBL.
- This one succeeded, but the ID format is compliant with the old PBL
Reading the code on the SDK, it seems that only the productId before the ":" is extracted here, which I suspect is the cause of the failure.
https://github.com/RevenueCat/purchases-android/blob/ba5465f69c3e85792fd46ff65d562fdd080f98cc/purchases/src/main/kotlin/com/ revenuecat/purchases/PurchasesOrchestrator.kt#L1142-L1148