首页 > 解决方案 > AppsFlyer 的 SDK 收据验证失败

问题描述

尝试使用 AppsFlyer 的 SDK 进行应用内购买服务器收据验证。validateAndTrackInAppPurchase在 SKStoreKit 的completeTransaction:回调中调用方法。但是它失败并总是返回以下响应。

{
    environment = Sandbox;

    status = 21004;

}

21004回应说The shared secret you provided does not match the shared secret on file for your account.

但我对此没有太多想法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;
                                                                }
                                                            }];

标签: iosobjective-cin-app-purchasereceipt-validationappsflyer-ios-sdk

解决方案


如你所知,Auto-Renewable Subscription要求App-Specific Shared Secret

请参阅appstoreconnect.apple.com-> My Apps->Features选项卡 -> In-App Purchases->Auto-Renewable Subscription项目部分:

在此处输入图像描述

共享秘密如下所示:e21e428f20db4d6d90c9192b9b7b2a75

1)21004表示您尝试测试 Auto-Renewable Subscription 并且 AppsFlyer 没有共享密钥。

请联系 support@appsflyer.com 以获取更多详细信息。


如果您不使用Auto-Renewable Subscription但仍然出现此错误会发生什么: 21004:

Apple 在沙盒模式下的测试存在一些问题。尝试创建一个新的测试人员帐户并再次进行测试。过去,一旦您使用帐户A进行测试Auto-Renewable Subscription,所有其他尝试使用帐户测试其他类型的购买,例如 Consumable、Non-Consumable、Non-Renewing Subscription A- Apple 都会返回相同的错误21004

希望能帮到你


推荐阅读