Trying to do in‐app purchase server receipt validation using AppsFlyer’s SDK. Called the validateAndTrackInAppPurchase method inside the SKStoreKit’s completeTransaction: callback. However it fails and always returns following response.
{
environment = Sandbox;
status = 21004;
}
21004 response says The shared secret you provided does not match the shared secret on file for your account.
But I don't have much idea about this shared secret
[[AppsFlyerTracker sharedTracker] validateAndTrackInAppPurchase:productId price:priceString
currency:@"USD"
transactionId:transaction.transactionIdentifier
additionalParameters:@{@"test": @"val" , @"test1" : @"val 1"}
success:^(NSDictionary *result){
NSLog(@"Purchase succeeded And verified!!! response: %@", result[@"receipt"]);
} failure:^(NSError *error, id response) {
NSLog(@"response = %@", response);
if([response isKindOfClass:[NSDictionary class]]) {
if([response[@"status"] isEqualToString:@"in_app_arr_empty"]){
// retry with 'SKReceiptRefreshRequest' because
// Apple has returned an empty response
// <YOUR CODE HERE>
}
} else {
//handle other errors
return;
}
}];
As you know
Auto-Renewable SubscriptiondemandsApp-Specific Shared Secret,See
appstoreconnect.apple.com->My Apps->Featurestab ->In-App Purchases->Auto-Renewable SubscriptionItem section:Shared secret looks like:
e21e428f20db4d6d90c9192b9b7b2a751)
21004means you try to test Auto-Renewable Subscription and AppsFlyer doesn't have the Shared Secret key.Please contact the [email protected] to get more details.
What happens if you do not use
Auto-Renewable Subscriptionbut still get this error:21004:Apple has some issues with testing in sandbox mode. Try to create a new tester account and do your test again. In the past, once you used account
Afor testingAuto-Renewable Subscription, all other attempts to test other types of purchase such Consumable, Non-Consumable, Non-Renewing Subscription with accountA- Apple returns the same error21004.Hope it can help you,