syncPurchasesWith

fun Purchases.syncPurchasesWith(onError: (error: PurchasesError) -> Unit = ON_ERROR_STUB, onSuccess: (CustomerInfo) -> Unit)

This method will send all the purchases to the RevenueCat backend. Call this when using your own implementation for subscriptions anytime a sync is needed, such as when migrating existing users to RevenueCat. The onSuccess callback will be called if all purchases have been synced successfully or there are no purchases. Otherwise, the onError callback will be called with a PurchasesError indicating the first error found.

Parameters

onError

Called when there was an error syncing one or more of the purchases. Will return the first error found syncing the purchases.

onSuccess

Called when all purchases have been successfully synced with the backend or if no purchases are present.