Skip to content

Latest commit

 

History

History
39 lines (26 loc) · 807 Bytes

README.md

File metadata and controls

39 lines (26 loc) · 807 Bytes

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)
  ...
}