You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/offerings/virtual-currency.mdx
+19-10Lines changed: 19 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,11 +46,7 @@ SDK support for virtual currencies is currently in beta, and as such requires th
46
46
47
47
### iOS
48
48
49
-
Use the `virtual-currency-beta` branch of the purchases-ios SDK to access the virtual currency beta features. If you’re using Swift Package Manager, you can do this in Xcode like so:
@@ -158,12 +154,8 @@ import content5 from "@site/code_blocks/virtual-currency/balance-response.json?r
158
154
159
155
#### From the SDK
160
156
161
-
If you're using the virtual currency SDK betas, you can fetch the virtual currency balances from the [CustomerInfo](https://www.revenuecat.com/docs/customers/customer-info) object in the SDK:
162
-
157
+
##### iOS
163
158
import fetchVCBalancesSwift from "@site/code_blocks/virtual-currency/vc-balance-sdk-ios.swift?raw";
164
-
import fetchVCBalancesKotlin from "@site/code_blocks/virtual-currency/vc-balance-sdk-android.kt?raw";
165
-
import fetchVCBalancesReactNative from "@site/code_blocks/virtual-currency/vc-balance-sdk-react-native.ts.txt?raw";
166
-
import fetchVCBalancesFlutter from "@site/code_blocks/virtual-currency/vc-balance-sdk-flutter.dart?raw";
167
159
168
160
<RCCodeBlock
169
161
tabs={[
@@ -172,6 +164,23 @@ import fetchVCBalancesFlutter from "@site/code_blocks/virtual-currency/vc-balanc
172
164
content: fetchVCBalancesSwift,
173
165
name: "Swift",
174
166
},
167
+
]}
168
+
/>
169
+
170
+
:::warning VirtualCurrencies does not update automatically when balance changes
171
+
When a customer's balance is updated from your backend, the VirtualCurrencies object remains cached and is not automatically updated. In order to get the updated balance, you need to call `Purchases/invalidateVirtualCurrenciesCache()` and fetch the VirtualCurrencies object again.
172
+
:::
173
+
174
+
##### Android, React Native, and Flutter
175
+
176
+
If you're using the virtual currency SDK betas for Android, React Native, and Flutter, you can fetch the virtual currency balances from the [CustomerInfo](https://www.revenuecat.com/docs/customers/customer-info) object in the SDK:
177
+
178
+
import fetchVCBalancesKotlin from "@site/code_blocks/virtual-currency/vc-balance-sdk-android.kt?raw";
179
+
import fetchVCBalancesReactNative from "@site/code_blocks/virtual-currency/vc-balance-sdk-react-native.ts.txt?raw";
180
+
import fetchVCBalancesFlutter from "@site/code_blocks/virtual-currency/vc-balance-sdk-flutter.dart?raw";
0 commit comments