Skip to content

handya/rc-kit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RCKit

RCKit is a simple tool kit to add basic RevenueCat support to your Vapor server.

It currently only supports the V1 API for getting or creating a subscriber and webhooks.

PRs welcome :)

Config

import RCKit

public func configure(_ app: Application) throws {
  app.revenueCat.configuration = .init(token: "<Your RevenueCat Token>")
}

Get or Create Subscriber

struct YourEntitlements: Content {
    let pro: RCEntitlement?
}

let subscriber: RCSubscriber<YourEntitlements> = try await req.application.revenueCat.getSubscriber("<userID>")
...

Webhook

func post(_ req: Request) async throws -> HTTPStatus {
  let eventBody: RCEventBody = try req.content.decode(RCEventBody.self)
  ...
}

About

Vapor tool kit for RevenueCat

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages