Skip to content

Commit 3a5ddd7

Browse files
committed
Update SDK to Android 6.17.5/iOS 6.17.8 and deprecate validateAndLog v1
1 parent 1fb3b48 commit 3a5ddd7

9 files changed

Lines changed: 43 additions & 29 deletions

File tree

Docs/RN_API.md

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,9 @@ appsFlyer.setSharingFilterForPartners(['googleadwords_int', 'all']);
596596

597597
### validateAndLogInAppPurchase
598598
`validateAndLogInAppPurchase(purchaseInfo, successC, errorC): Response<string>`
599+
600+
> ⚠️ **Deprecated**: This API is deprecated. Use `validateAndLogInAppPurchaseV2` instead.
601+
599602
Receipt validation is a secure mechanism whereby the payment platform (e.g. Apple or Google) validates that an in-app purchase indeed occurred as reported.
600603
Learn more - https://support.appsflyer.com/hc/en-us/articles/207032106-Receipt-validation-for-in-app-purchases
601604
❗Important❗ for iOS - set SandBox to ```true```
@@ -628,20 +631,22 @@ appsFlyer.validateAndLogInAppPurchase(info, res => console.log(res), err => cons
628631
```
629632

630633
---
631-
<!--
632-
## New In-App Purchase Validation API
633-
The new `validateAndLogInAppPurchase` API uses `AFPurchaseDetails` and `AFPurchaseType` enum for structured purchase validation.
634634

635-
### AFPurchaseType Enum
635+
### validateAndLogInAppPurchaseV2
636+
`validateAndLogInAppPurchaseV2(purchaseDetails, additionalParameters, callback): void`
637+
638+
The `validateAndLogInAppPurchaseV2` API uses `AFPurchaseDetails` and `AFPurchaseType` enum for structured purchase validation.
639+
640+
#### AFPurchaseType Enum
636641

637642
```javascript
638643
import { AFPurchaseType } from 'react-native-appsflyer';
639644

640645
AFPurchaseType.SUBSCRIPTION // "subscription"
641-
AFPurchaseType.ONE_TIME_PURCHASE // "one-time-purchase"
646+
AFPurchaseType.ONE_TIME_PURCHASE // "one_time_purchase"
642647
```
643648

644-
### AFPurchaseDetails Interface
649+
#### AFPurchaseDetails Interface
645650

646651
```typescript
647652
interface AFPurchaseDetails {
@@ -651,15 +656,15 @@ interface AFPurchaseDetails {
651656
}
652657
```
653658

654-
### Usage Example
659+
#### Usage Example
655660

656661
```javascript
657662
import appsFlyer, { AFPurchaseType } from 'react-native-appsflyer';
658663

659664
const purchaseDetails = {
660-
purchaseType: AFPurchaseType.SUBSCRIPTION,
661-
transactionId: "google_play_purchase_token_123",
662-
productId: "com.example.app.premium_monthly"
665+
purchaseType: AFPurchaseType.ONE_TIME_PURCHASE,
666+
transactionId: "2000000569065806",
667+
productId: "deviceIdconsumableid"
663668
};
664669

665670
const additionalParams = {
@@ -670,10 +675,19 @@ const additionalParams = {
670675
appsFlyer.validateAndLogInAppPurchaseV2(
671676
purchaseDetails,
672677
additionalParams,
673-
(result) => console.log(result)
678+
(result) => {
679+
if (result.error) {
680+
console.error('Validation failed:', result.error);
681+
} else {
682+
console.log('Validation success:', result);
683+
}
684+
}
674685
);
675686
```
676-
-->
687+
**Important Notes:**
688+
- The callback receives both `result` and `error` parameters
689+
- Always check for `error` first before processing `result`
690+
- Handle the case where `AFSDKPurchaseDetails` creation might fail
677691
---
678692

679693
### updateServerUninstallToken

Docs/RN_InAppEvents.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ appsFlyer.logEvent(
5454

5555
---
5656
## In-app purchase validation
57+
58+
> ⚠️ **Deprecated**: The `validateAndLogInAppPurchase` API is deprecated. Use `validateAndLogInAppPurchaseV2` instead. See the [API reference](/Docs/RN_API.md#validateandloginapppurchasev2) for details.
59+
5760
Receipt validation is a secure mechanism whereby the payment platform (e.g. Apple or Google) validates that an in-app purchase indeed occurred as reported.
5861
Learn more [here](https://support.appsflyer.com/hc/en-us/articles/207032106-Receipt-validation-for-in-app-purchases).
5962

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ repositories {
7070
dependencies {
7171
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.7.10" // Add Kotlin standard library
7272
implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
73-
api "com.appsflyer:af-android-sdk:${safeExtGet('appsflyerVersion', '6.17.3')}"
73+
api "com.appsflyer:af-android-sdk:${safeExtGet('appsflyerVersion', '6.17.5')}"
7474
implementation "com.android.installreferrer:installreferrer:${safeExtGet('installReferrerVersion', '2.2')}"
7575
if (includeConnector){
7676
implementation 'com.appsflyer:purchase-connector:2.1.1'

android/src/main/java/com/appsflyer/reactnative/RNAppsFlyerConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
public class RNAppsFlyerConstants {
88

9-
final static String PLUGIN_VERSION = "6.17.7";
9+
final static String PLUGIN_VERSION = "6.17.8";
1010
final static String NO_DEVKEY_FOUND = "No 'devKey' found or its empty";
1111
final static String UNKNOWN_ERROR = "AF Unknown Error";
1212
final static String SUCCESS = "Success";

index.d.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,23 +358,22 @@ declare module "react-native-appsflyer" {
358358
successC?: SuccessCB
359359
): void;
360360
/**
361-
* [LEGACY WARNING] This is the legacy validateAndLogInAppPurchase API.
361+
* @deprecated This API is deprecated. Use validateAndLogInAppPurchaseV2 instead.
362362
*/
363363
validateAndLogInAppPurchase(
364364
purchaseInfo: InAppPurchase,
365365
successC: SuccessCB,
366366
errorC: ErrorCB
367367
): Response<string>;
368368
/**
369-
* [NEW API] This is the new validateAndLogInAppPurchase API with AFPurchaseDetails.
369+
* validateAndLogInAppPurchase API with AFPurchaseDetails.
370370
* Uses event emitter pattern for callback handling.
371-
371+
*/
372372
validateAndLogInAppPurchaseV2(
373373
purchaseDetails: AFPurchaseDetails,
374374
additionalParameters?: { [key: string]: any },
375375
callback?: (data: any) => void
376376
): void;
377-
*/
378377

379378
updateServerUninstallToken(token: string, successC?: SuccessCB): void;
380379
sendPushNotificationData(pushPayload: object, errorC?: ErrorCB): void;

index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -741,9 +741,8 @@ appsFlyer.onDeepLink = (callback) => {
741741

742742

743743
/**
744-
* TODO: Remove comment when the API is stable
745-
* New validateAndLogInAppPurchase API with AFPurchaseDetails support.
746-
*
744+
* validateAndLogInAppPurchase API with AFPurchaseDetails support.
745+
*/
747746
appsFlyer.validateAndLogInAppPurchaseV2 = (purchaseDetails, additionalParameters , callback) => {
748747
const listener = appsFlyerEventEmitter.addListener("onValidationResult", (_data) => {
749748
if (callback && typeof callback === 'function') {
@@ -769,7 +768,6 @@ appsFlyer.validateAndLogInAppPurchaseV2 = (purchaseDetails, additionalParameters
769768
listener.remove();
770769
};
771770
};
772-
*/
773771

774772
/**
775773
* Anonymize user Data.
@@ -885,10 +883,10 @@ export const AFPurchaseType = {
885883
};
886884

887885
/**
888-
* [LEGACY WARNING] This is the legacy validateAndLogInAppPurchase API.
886+
* @deprecated This API is deprecated. Use validateAndLogInAppPurchaseV2 instead.
889887
*/
890888
appsFlyer.validateAndLogInAppPurchase = (purchaseInfo, successCallback, errorCallback) => {
891-
console.log('[AppsFlyer] Using legacy validateAndLogInAppPurchase API');
889+
console.warn('[AppsFlyer] validateAndLogInAppPurchase is deprecated. Use validateAndLogInAppPurchaseV2 instead.');
892890
return RNAppsFlyer.validateAndLogInAppPurchase(purchaseInfo, successCallback, errorCallback);
893891
};
894892

ios/RNAppsFlyer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
@end
2323

2424

25-
static NSString *const kAppsFlyerPluginVersion = @"6.17.7";
25+
static NSString *const kAppsFlyerPluginVersion = @"6.17.8";
2626
static NSString *const NO_DEVKEY_FOUND = @"No 'devKey' found or its empty";
2727
static NSString *const NO_APPID_FOUND = @"No 'appId' found or its empty";
2828
static NSString *const NO_EVENT_NAME_FOUND = @"No 'eventName' found or its empty";

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-appsflyer",
3-
"version": "6.17.7",
3+
"version": "6.17.8",
44
"description": "React Native Appsflyer plugin",
55
"main": "index.js",
66
"types": "index.d.ts",

react-native-appsflyer.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ Pod::Spec.new do |s|
3030
# AppsFlyerPurchaseConnector
3131
if defined?($AppsFlyerPurchaseConnector) && ($AppsFlyerPurchaseConnector == true)
3232
Pod::UI.puts "#{s.name}: Including PurchaseConnector."
33-
s.dependency 'PurchaseConnector', '6.17.7'
33+
s.dependency 'PurchaseConnector', '6.17.8'
3434
end
3535

3636
# AppsFlyerFramework
3737
if defined?($RNAppsFlyerStrictMode) && ($RNAppsFlyerStrictMode == true)
3838
Pod::UI.puts "#{s.name}: Using AppsFlyerFramework/Strict mode"
39-
s.dependency 'AppsFlyerFramework/Strict', '6.17.7'
39+
s.dependency 'AppsFlyerFramework/Strict', '6.17.8'
4040
s.xcconfig = {'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) AFSDK_NO_IDFA=1' }
4141
else
4242
if !defined?($RNAppsFlyerStrictMode)
4343
Pod::UI.puts "#{s.name}: Using default AppsFlyerFramework. You may require App Tracking Transparency. Not allowed for Kids apps."
4444
Pod::UI.puts "#{s.name}: You may set variable `$RNAppsFlyerStrictMode=true` in Podfile to use strict mode for kids apps."
4545
end
46-
s.dependency 'AppsFlyerFramework', '6.17.7'
46+
s.dependency 'AppsFlyerFramework', '6.17.8'
4747
end
4848
end

0 commit comments

Comments
 (0)