Getting started with RevenueCat in-app billing on Xamarin Forms / MAUI

Viewed 89

I couldn't find any documentation on using RevenueCat bindings in Xamarin Forms, or any examples. How to get started? I think it's supposed to be obvious, but it wasn't for me.

Answering my own question below, I've made a small start, haven't tested any code yet. Please feel free to expand or correct.

This is for Xamarin Forms iOS on Visual Studio 2022 for Mac; MAUI could be similar.

1 Answers
  1. In your iOS project, add the Nuget packages Xamarin.RevenueCat.iOS and Xamarin.RevenueCat.iOS.Extensions.

[Edit] I removed my suggestion to bind the Swift library, as it does not seem to be necessary.

A few sample code lines:

using RevenueCat;
using Xamarin.RevenueCat.iOS.Extensions;
....
RCPurchases.DebugLogsEnabled = true;
RCPurchases.ConfigureWithAPIKey( "my api key" );
RCPurchases.SharedPurchases.AllowSharingAppStoreAccount = true;
RCCustomerInfo purchaserInfo = await RCPurchases.SharedPurchases.RestoreTransactionsAsync ();
RCOfferings offerings = await RCPurchases.SharedPurchases.GetOfferingsAsync ();
Related