diff --git a/README.md b/README.md index 7baffaf..770eeed 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,39 @@ -# rc-kit -Vapor tool kit for RevenueCat +# RCKit +RCKit is a simple tool kit to add basic RevenueCat support to your Vapor server. + +It currently only supports the [V1 API](https://www.revenuecat.com/reference/subscribers) for getting or creating a subscriber and webhooks. + +PRs welcome :) + +#### Config + +```swift +import RCKit + +public func configure(_ app: Application) throws { + app.revenueCat.configuration = .init(token: "") +} + +``` + +#### Get or Create Subscriber + +```swift + +struct YourEntitlements: Content { + let pro: RCEntitlement? +} + +let subscriber: RCSubscriber = try await req.application.revenueCat.getSubscriber("") +... + +``` + +#### Webhook + +```swift +func post(_ req: Request) async throws -> HTTPStatus { + let eventBody: RCEventBody = try req.content.decode(RCEventBody.self) + ... +} +```