Skip to content

Commit eca3576

Browse files
committed
Update readme.
1 parent 2102add commit eca3576

2 files changed

Lines changed: 58 additions & 4 deletions

File tree

Docs/RN_PurchaseConnector.md

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,39 @@ To properly set up the configuration object, you must specify certain parameters
8787
- `logSubscriptions`: If set to `true`, the connector logs all subscription events.
8888
- `logInApps`: If set to `true`, the connector logs all in-app purchase events.
8989
- `sandbox`: If set to `true`, transactions are tested in a sandbox environment. Be sure to set this to `false` in production.
90+
- `storeKitVersion`: (iOS only) Specifies which StoreKit version to use. Defaults to `StoreKitVersion.SK1` if not specified. Use `StoreKitVersion.SK2` for iOS 15.0+ features.
9091

9192
Here's an example usage:
9293

9394
```javascript
9495
import appsFlyer, {
9596
AppsFlyerPurchaseConnector,
9697
AppsFlyerPurchaseConnectorConfig,
98+
StoreKitVersion,
9799
} from 'react-native-appsflyer';
98100

101+
// Example 1: StoreKit1 (default if storeKitVersion is not specified)
99102
const purchaseConnectorConfig: PurchaseConnectorConfig = AppsFlyerPurchaseConnectorConfig.setConfig({
100103
logSubscriptions: true,
101104
logInApps: true,
102105
sandbox: true,
106+
// storeKitVersion defaults to StoreKit1 if not specified
107+
});
108+
109+
// Example 2: Explicitly setting StoreKit1
110+
const purchaseConnectorConfigSK1: PurchaseConnectorConfig = AppsFlyerPurchaseConnectorConfig.setConfig({
111+
logSubscriptions: true,
112+
logInApps: true,
113+
sandbox: true,
114+
storeKitVersion: StoreKitVersion.SK1
115+
});
116+
117+
// Example 3: StoreKit2 (iOS 15.0+)
118+
const purchaseConnectorConfigSK2: PurchaseConnectorConfig = AppsFlyerPurchaseConnectorConfig.setConfig({
119+
logSubscriptions: true,
120+
logInApps: true,
121+
sandbox: true,
122+
storeKitVersion: StoreKitVersion.SK2
103123
});
104124

105125
//Create the object
@@ -126,7 +146,7 @@ For example:
126146
logSubscriptions: true,
127147
logInApps: true,
128148
sandbox: true,
129-
storeKitVersion: StoreKitVersion.SK2
149+
storeKitVersion: StoreKitVersion.SK1 // This will be ignored since instance already exists
130150
});
131151

132152
// purchaseConnector1 and purchaseConnector2 point to the same instance
@@ -147,16 +167,27 @@ Start the SDK instance to observe transactions. </br>
147167
import appsFlyer, {
148168
AppsFlyerPurchaseConnector,
149169
AppsFlyerPurchaseConnectorConfig,
170+
StoreKitVersion,
150171
} from 'react-native-appsflyer';
151172

152173
appsFlyer.startSdk();
174+
175+
// StoreKit1 example (default behavior)
153176
const purchaseConnectorConfig: PurchaseConnectorConfig = AppsFlyerPurchaseConnectorConfig.setConfig({
154177
logSubscriptions: true,
155178
logInApps: true,
156179
sandbox: true,
157-
storeKitVersion: StoreKitVersion.SK2
180+
// storeKitVersion: StoreKitVersion.SK1 // Optional - SK1 is default
158181
});
159182

183+
// StoreKit2 example (iOS 15.0+)
184+
// const purchaseConnectorConfig: PurchaseConnectorConfig = AppsFlyerPurchaseConnectorConfig.setConfig({
185+
// logSubscriptions: true,
186+
// logInApps: true,
187+
// sandbox: true,
188+
// storeKitVersion: StoreKitVersion.SK2
189+
// });
190+
160191
//Create the object
161192
AppsFlyerPurchaseConnector.create(purchaseConnectorConfig);
162193
//Start listening to transactions
@@ -202,10 +233,20 @@ const purchaseConnectorConfig = {
202233
And integrating both options into the example you provided would look like this:
203234

204235
```javascript
236+
// StoreKit1 configuration (default)
205237
const purchaseConnectorConfig = AppsFlyerPurchaseConnectorConfig.setConfig({
206238
logSubscriptions: true, // Enable automatic logging of subscription events
207239
logInApps: true, // Enable automatic logging of in-app purchase events
208240
sandbox: true, // Additional configuration option
241+
// storeKitVersion: StoreKitVersion.SK1 // Optional - defaults to SK1
242+
});
243+
244+
// StoreKit2 configuration (iOS 15.0+)
245+
const purchaseConnectorConfigSK2 = AppsFlyerPurchaseConnectorConfig.setConfig({
246+
logSubscriptions: true, // Enable automatic logging of subscription events
247+
logInApps: true, // Enable automatic logging of in-app purchase events
248+
sandbox: true, // Additional configuration option
249+
storeKitVersion: StoreKitVersion.SK2 // Required for StoreKit2
209250
});
210251
```
211252

@@ -584,13 +625,22 @@ AppsFlyerPurchaseConnector.logConsumableTransaction(transactionId: string): void
584625

585626
```javascript
586627
// 1. Create the connector
628+
// StoreKit1 (default)
587629
AppsFlyerPurchaseConnector.create({
588630
logSubscriptions: true,
589631
logInApps: true,
590632
sandbox: __DEV__,
591-
storeKitVersion: StoreKitVersion.SK2
633+
// storeKitVersion: StoreKitVersion.SK1 // Optional - defaults to SK1
592634
});
593635

636+
// OR for StoreKit2 (iOS 15.0+)
637+
// AppsFlyerPurchaseConnector.create({
638+
// logSubscriptions: true,
639+
// logInApps: true,
640+
// sandbox: __DEV__,
641+
// storeKitVersion: StoreKitVersion.SK2
642+
// });
643+
594644
// 2. Set up data sources
595645
setupPurchaseDataSources();
596646

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818

1919
## <a id="release-updates"> Release Updates
2020

21-
- Starting with version 6.17.1 the plugin supports the Purchase Connector for validating and measuring Subscription and In-app purchase events. Integration guide can be found [here](https://github.com/AppsFlyerSDK/appsflyer-react-native-plugin/blob/master/Docs/RN_PurchaseConnector.md).
21+
- Starting with version `6.17.1` the plugin supports the Purchase Connector for validating and measuring Subscription and In-app purchase events. Integration guide can be found [here](https://github.com/AppsFlyerSDK/appsflyer-react-native-plugin/blob/master/Docs/RN_PurchaseConnector.md).
22+
23+
- Starting with version `6.17.1` the TypeScript interfaces for Purchase Connector data sources have been simplified and are now **breaking changes**:
24+
- `PurchaseRevenueDataSource.purchaseRevenueAdditionalParametersForProducts()` function has been replaced with `additionalParameters` object
25+
- `PurchaseRevenueDataSourceStoreKit2.purchaseRevenueAdditionalParametersStoreKit2ForProducts()` function has been replaced with `additionalParameters` object
2226

2327
- Starting with version `6.16.2`, `AppsFlyerConsent.forGDPRUser` and `AppsFlyerConsent.forNonGDPRUser` have been **deprecated**. Use the new `AppsFlyerConsent` constructor instead. See [Deprecation Notice](/Docs/RN_CMP.md#deprecation-notice).
2428

0 commit comments

Comments
 (0)