Purchases 1.0.4

Purchases 1.0.4

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Jul 2018

Maintained by Jacob Eiting.


Downloads

Total355
Week0
Month0

Installs

Apps40
Test Targets2
powered by Segment

GitHub

Stars0
Watchers0
Forks0
Issues0
Contributors1
Pull Requests0

Code

Files18
LOCLines of Code 763


Purchases 1.0.4

  • By
  • RevenueCat, Inc.

RevenueCat

Purchases.framework

Version License

Purchases is a client for the RevenueCat subscription and purchase tracking system. It is an open source framework that provides a wrapper around StoreKit and the RevenueCat backend to make implementing iOS in app purchases easy.

Check out the getting started guide.

Installation

Purchases is available through CocoaPods and Carthage

CocoaPods

pod "Purchases"

Carthage

github "revenuecat/purchases-ios"

Getting Started

1. Create a RevenueCat Account

Go to RevenueCat, create an account, and obtain an API key for your application.

2. In your app instantiate an RCPurchases object with your secret.

import Purchases

let purchases = RCPurchases(apiKey: "myappapikey")!
purchases.delegate = self;
@import Purchases

RCPurchases *purchases = [[RCPurchases alloc] initWithAPIKey:@"myappAPIKey"];
purchases.delegate = self;

3. Make a purchase

purchases.entitlements({ (entitlements) in
  let product = entitlements["pro"].offerings["monthly"]!.activeProduct
  purchases.makePurchase(product)
})
[purchases entitlements:^(NSDictionary *entitlements) {
  SKProduct *product = entitlements[@"pro"].offerings[@"monthly"].activeProduct;
  [purchases makePurchase:product];
}];

4. Unlock Entitlements

func purchases(_ purchases: RCPurchases, completedTransaction transaction: SKPaymentTransaction, withUpdatedInfo purchaserInfo: RCPurchaserInfo) {
  if (purchaseInfo.activeEntitlements.contains("pro")) {
    // Unlock that great "pro" content.
  }
}
- (void)purchases:(RCPurchases *)purchases
completedTransaction:(SKPaymentTransaction *)transaction
  withUpdatedInfo:(RCPurchaserInfo *)purchaserInfo {  
  [purchaserInfo.activeEntitlements containsObject:@"pro"];
}