Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
handya authored Nov 2, 2023
1 parent 0161cdf commit 8da0c3a
Showing 1 changed file with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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: "<Your RevenueCat Token>")
}

```

#### Get or Create Subscriber

```swift

struct YourEntitlements: Content {
let pro: RCEntitlement?
}

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

```

#### Webhook

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

0 comments on commit 8da0c3a

Please sign in to comment.