Skip to content

Inofficial C# Revenuecat SDK for your Backend (WebAPI, ...)

License

Notifications You must be signed in to change notification settings

srcmkr/revenuecat

Repository files navigation

GitHub Nuget Nuget Nuget CI/CD Pipeline

RevenueCat C# SDK

Inofficial C# Revenuecat SDK for your Backend (WebAPI, ...)
Nothing special (yet), but at least a navigatable response from the revenuecat API

Installation

Install via Nuget (Srcmkr.RevenueCat) or CLI

dotnet add package Srcmkr.RevenueCat

Usage

using Srcmkr.RevenueCat;

...

// Your secret API key
var client = RevenueCatClient.WithApiSecret("sk_XXXXXXXXXXXXXXXXXXXXXXXXXXXXX");

// Any subscriber ID (auto-generated or alias)
var subscription = await client.GetSubscriber("$RCAnonymousID:71bae8c5044f4728a71c1781b5f59a87");

// Check if user has any subscriptions at all
var hasSubscription = subscription.Entitlements.ContainsKey("subscriptions");
if (!hasSubscription) 
{ 
    //handle no subscription 
}

// Check if user has any entitlement of the group "subscriptions" (<- change that)
// then checks if subscription is expired
var lastSubscription = subscription.Entitlements["subscriptions"];
if (lastSubscription.ExpiresDate < DateTime.UtcNow)
{
    return BadRequest(new ErrorResponse
    {
        Success = false,
        Message = "register.subscription_expired"
    });
}
 

Roadmap

  • Get subscriber
  • Native / preconfigured checkups
    • Expired subscription
    • Has specific (non-) subscription
  • Delete Subscriber
  • Add / Update User Attribution Data
  • Entitlements
    • Grant a promotional entitlement
    • Revoke a promotional entitlement
  • Support of API v2

See the open issues for a full list of proposed features (and known issues).

License

Distributed under the MIT License. See LICENSE for more information.

About

Inofficial C# Revenuecat SDK for your Backend (WebAPI, ...)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages