Skip to content

Commit 6e1438d

Browse files
authored
Merge pull request #88 from AppsFlyerSDK/dev/addedUseReceiptValidationSandbox
Added useReceiptValidationSandbox API
2 parents b31c00a + 90a1df0 commit 6e1438d

File tree

5 files changed

+34
-14
lines changed

5 files changed

+34
-14
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Versions
22

3+
## 6.2.1+5
4+
- Added support for useReceiptValidationSandbox API
5+
36
## 6.2.1+4
47
- Seperated purchase validation API to iOS/Android
58

doc/API.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ _Example:_
305305
appsFlyerSdk.updateServerUninstallToken("token");
306306
```
307307
---
308-
**<a id="validateAndLogInAppAndroidPurchase"> `Stream validateAndLogInAppAndroidPurchase(
308+
**<a id="validateAndLogInAppAndroidPurchase"> `Future<dynamic> validateAndLogInAppAndroidPurchase(
309309
String publicKey,
310310
String signature,
311311
String purchaseData,
@@ -321,14 +321,10 @@ appsFlyerSdk.validateAndLogInAppAndroidPurchase(
321321
"purchaseData",
322322
"price",
323323
"currency",
324-
{"fs": "fs"}).listen((data) {
325-
print(data);
326-
}).onError((error) {
327-
print(error);
328-
});
324+
{"fs": "fs"});
329325
```
330326
---
331-
**<a id="validateAndLogInAppIosPurchase"> `Stream validateAndLogInAppIosPurchase(
327+
**<a id="validateAndLogInAppIosPurchase"> `Future<dynamic> validateAndLogInAppIosPurchase(
332328
String productIdentifier,
333329
String price,
334330
String currency,
@@ -342,11 +338,17 @@ appsFlyerSdk.validateAndLogInAppIosPurchase(
342338
"price",
343339
"currency",
344340
"transactionId",
345-
"additionalParameters").listen((data) {
346-
print(data);
347-
}).onError((error) {
348-
print(error);
349-
});
341+
"additionalParameters");
342+
```
343+
344+
345+
***To use the purchase validation feature in sandbox mode call the follow API:***
346+
347+
`void useReceiptValidationSandbox(bool isSandboxEnabled)`
348+
349+
_Example:_
350+
```dart
351+
appsFlyerSdk.useReceiptValidationSandbox(true);
350352
```
351353
---
352354
**<a id="setPushNotification"> `void setPushNotification(bool isEnabled)`**

ios/Classes/AppsflyerSdkPlugin.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ @implementation AppsflyerSdkPlugin {
1111
static BOOL _oaoaCallback = false;
1212
static BOOL _udpCallback = false;
1313
static BOOL _isPushNotificationEnabled = false;
14+
static BOOL _isSandboxEnabled = false;
1415

1516
+ (FlutterMethodChannel*)callbackChannel{
1617
return _callbackChannel;
@@ -111,12 +112,21 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
111112
[self setOneLinkCustomDomain:call result:result];
112113
}else if([@"setPushNotification" isEqualToString:call.method]){
113114
[self setPushNotification:call result:result];
115+
}else if([@"useReceiptValidationSandbox" isEqualToString:call.method]){
116+
[self useReceiptValidationSandbox:call result:result];
114117
}
115118
else{
116119
result(FlutterMethodNotImplemented);
117120
}
118121
}
119122

123+
- (void)useReceiptValidationSandbox:(FlutterMethodCall*)call result:(FlutterResult)result{
124+
bool isSandboxEnabled = call.arguments;
125+
_isSandboxEnabled = isSandboxEnabled;
126+
[AppsFlyerLib shared].useReceiptValidationSandbox = _isSandboxEnabled;
127+
result(nil);
128+
}
129+
120130
- (void)setPushNotification:(FlutterMethodCall*)call result:(FlutterResult)result{
121131
bool isPushNotificationEnabled = call.arguments;
122132
_isPushNotificationEnabled = isPushNotificationEnabled;

lib/src/appsflyer_sdk.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ class AppsflyerSdk {
380380
});
381381
}
382382

383-
///Returns `Stream`. Accessing AppsFlyer purchase validation data
383+
///Accessing AppsFlyer purchase validation data
384384
Future<dynamic> validateAndLogInAppIosPurchase(
385385
String productIdentifier,
386386
String price,
@@ -398,6 +398,11 @@ class AppsflyerSdk {
398398
});
399399
}
400400

401+
/// set sandbox for iOS purchase validation
402+
void useReceiptValidationSandbox(bool isSandboxEnabled) {
403+
_methodChannel.invokeMethod("useReceiptValidationSandbox", isSandboxEnabled);
404+
}
405+
401406
/// Set additional data to be sent to AppsFlyer.
402407
void setAdditionalData(Map<String, dynamic> customData) {
403408
_methodChannel

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: appsflyer_sdk
22
description: A Flutter plugin for AppsFlyer SDK. Supports iOS and Android.
3-
version: 6.2.1+4
3+
version: 6.2.1+5
44

55
homepage: https://github.com/AppsFlyerSDK/flutter_appsflyer_sdk
66

0 commit comments

Comments
 (0)