Trials, Licensing & Checkout

Setup in-app checkout, with a time or feature-limited trial.

Getting Started

After completing SDK Basic Setup you will need to create an NSDictionary containing the default values for your product in applicationDidFinishLaunching.


NSDictionary *productInfo = [NSDictionary dictionaryWithObjectsAndKeys:
	  @"10.00", kPADCurrentPrice,
	  @"Test Developer", kPADDevName,
	  @"USD", kPADCurrency,
	  @"http://www.macupdate.com/util/iconlg/17227.png", kPADImage,
	  @"Test Product 2", kPADProductName,
	  @"7", kPADTrialDuration,
	  @"Thanks for downloading a trial of our product", kPADTrialText,
	  @"paddleicon.png", kPADProductImage, //Image file in your project
	  nil];

var productInfo:NSDictionary = [
	        kPADCurrentPrice: "10.00",
	        kPADDevName: "Test Developer",
	        kPADCurrency: "USD",
	        kPADImage: "http://www.macupdate.com/util/iconlg/17227.png",
	        kPADProductName: "Test Product 2",
	        kPADTrialDuration: "7",
	        kPADTrialText: "Thanks for downloading a trial of our product",
	        kPADProductImage: "paddleicon.png" //Image file in your project
  ]

Now you can start the Paddle licencing process with the startLicencing method. This method accepts your product information and main window to display the sheet from.

The complete method in your AppDelegate.h, would look like:


- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
	    NSDictionary *productInfo = [NSDictionary dictionaryWithObjectsAndKeys:
	         @"10.00", kPADCurrentPrice,
	         @"Test Developer", kPADDevName,
	         @"USD", kPADCurrency,
	         @"http://www.macupdate.com/util/iconlg/17227.png", kPADImage,
	         @"Test Product 2", kPADProductName,
	         @"7", kPADTrialDuration,
	         @"Thanks for downloading a trial of our product", kPADTrialText,
	         @"paddleicon.png", kPADProductImage, //Image file in your project
	         nil];
	
	    [[Paddle sharedInstance] startLicensing:productInfo timeTrial:YES withWindow:self.window];
}

func applicationDidFinishLaunching(aNotification: NSNotification) {
	    var productInfo:NSDictionary = [
	        kPADCurrentPrice: "10.00",
	        kPADDevName: "Test Developer",
	        kPADCurrency: "USD",
	        kPADImage: "http://www.macupdate.com/util/iconlg/17227.png",
	        kPADProductName: "Test Product 2",
	        kPADTrialDuration: "7",
	        kPADTrialText: "Thanks for downloading a trial of our product",
	        kPADProductImage: "paddleicon.png" //Image file in your project
	    ]
	    
	    Paddle.sharedInstance().startLicensing(productInfo as! [String : String], timeTrial: true, withWindow: window)
}

Feature Limited Trials

If you’d like to offer a trial of your product limited by features instead of time you can instead pass NO to timeTrial:. You should also ensure that you have disabled the time trial in your vendor dashboard for this to function correctly. For example:


- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
	    NSDictionary *productInfo = [NSDictionary dictionaryWithObjectsAndKeys:
	         @"10.00", kPADCurrentPrice,
	         @"Test Developer", kPADDevName,
	         @"USD", kPADCurrency,
	         @"http://www.macupdate.com/util/iconlg/17227.png", kPADImage,
	         @"Test Product 2", kPADProductName,
	         @"Thanks for downloading a trial of our product", kPADTrialText,
	         @"paddleicon.png", kPADProductImage, //Image file in your project
	         nil];
	
	    [[Paddle sharedInstance] startLicensing:productInfo timeTrial:NO withWindow:self.window];
}

func applicationDidFinishLaunching(aNotification: NSNotification) {
	    var productInfo:NSDictionary = [
	        kPADCurrentPrice: "10.00",
	        kPADDevName: "Test Developer",
	        kPADCurrency: "USD",
	        kPADImage: "http://www.macupdate.com/util/iconlg/17227.png",
	        kPADProductName: "Test Product 2",
	        kPADTrialText: "Thanks for downloading a trial of our product",
	        kPADProductImage: "paddleicon.png" //Image file in your project
	    ]
	    
	    Paddle.sharedInstance().startLicensing(productInfo as! [String : String], timeTrial: false, withWindow: window)
}

Once you have done this you can check if your product has been activated and enable/disable features accordingly. For example:


if ([[Paddle sharedInstance] productActivated]) {
        //Product has been activated, enable feature
        
    }

if Paddle.sharedInstance().productActivated() {
        //Product has been activated, enable feature
        
    }
Was this page helpful?