RevenueCat / purchases-hybrid-common

Common files for the Hybrid SDKs
MIT License
21 stars 10 forks source link

Require STOREKIT_VERSION when PURCHASES_ARE_COMPLETED_BY is MY_APP #884

Closed fire-at-will closed 4 months ago

fire-at-will commented 4 months ago

As of iOS native SDK 5.0.0, developers must specify the StoreKit version they're using when setting PurchasesAreCompletedBy. This PR adjusts the typescript APIs to:

Code Samples

Setting purchasesAreCompletedBy to REVENUECAT:

Purchases.configure({
 apiKey: "123",
 purchasesAreCompletedBy: PURCHASES_ARE_COMPLETED_BY_TYPE.REVENUECAT,
});

Settings purchasesAreCompletedBy to MY_APP:

Purchases.configure({
 apiKey: "123",
 purchasesAreCompletedBy: {
    type: PURCHASES_ARE_COMPLETED_BY_TYPE.MY_APP,
    storeKitVersion: STOREKIT_VERSION.STOREKIT_1
 },
});

Android-Only Apps with PURCHASES_ARE_COMPLETED_BY == MY_APP

Android-only apps that want to complete their own purchases can specify any StoreKit version as that parameter is ignored by the Android SDK. This fact has been detailed in PURCHASES_ARE_COMPLETED_BY_MY_APP's docstring.

Acknowledgements

Huge thanks to @vegaro for coming up with the idea and prototyping it!