Mac SDK v4 Setup

Paddle’s Mac SDK has two primary components (and a handful of auxillery / customization objects); the main Paddle class where most things are centralized and the Product class which represents your Paddle product(s) for you to work with them in your app.

Download the latest version of the Mac SDK here

Paddle Singleton (Paddle)

The center of the Paddle SDK experience; where you do general configuration and control, things like; initialize the SDK, control the SDK UI, and trigger actions like license recovery.

Paddle Product (PADProduct)

A local representation of your Paddle Product or Subscription, with details like trial days remaining, activation date, price and actions on the Product to refresh it’s data from the vendor dashboard, verify license, deactivate, etc.

Most Paddle SDK methods will require a Paddle Product and you can have multiple in play at once.

Xcode Setup

The SDK is available through CocoaPods and Carthage or follow steps 1 to 4 to add to your project manually.

1 Add to project

Add the Paddle framework to your Xcode project by dragging from the finder. macsdk-addtoproject

2 Add to target

Add the Paddle framework to your Xcode project by dragging from the finder. macsdk-addtotarget

3 Copy files

Now you need to tell Xcode to copy the framework into your project. Still within ‘Build Phases’ add a build phase (New Copy Files Build Phase), make sure ‘Destination’ is set to ‘Frameworks’. macsdk-copyfilesbuildphase

4 Sandbox settings

If your app is sandboxed you should enable Outgoing Connection in your Capabilities/Entitlements to allow the framework to send data to Paddle. macsdkmas-sandboxing

Example Paddle SDK Setup

The Paddle SDK requires that you initialize it with an SDK Product, which you’ll need to create via the Vendor Dashboard. Once initialized you can work with any type of Product or Subscription, we’ll never assume the SDK Product used to initialize the SDK is the relevant one.

Import the Paddle Singleton to your class:


@import Paddle
// or
#import <Paddle/Paddle.h>

Configure and initialize the SDK and your Product


// Your Paddle SDK Config from the Vendor Dashboard:
NSString *myPaddleProductID = @"678910";
NSString *myPaddleVendorID = @"12345";
NSString *myPaddleAPIKey = @"1234abc5678defg";

// Default Product Config in case we're unable to reach our servers on first run:
PADProductConfiguration *defaultProductConfig = [[PADProductConfiguration alloc] init];
defaultProductConfig.productName = @"My v4 Product";
defaultProductConfig.vendorName = @"My Company";

// Initialize the SDK singleton with the config:
Paddle *paddle = [Paddle sharedInstanceWithVendorID:myPaddleVendorID
											 apiKey:myPaddleAPIKey
										  productID:myPaddleProductID
									  configuration:defaultProductConfig];
								
// Initialize the Product you'd like to work with:	  
PADProduct *paddleProduct = [[PADProduct alloc] initWithProductID:myPaddleProductID productType:PADProductTypeSDKProduct configuration:nil];

// Ask the Product to get it's latest state and info from the Paddle Platform:
[paddleProduct refresh:^(NSDictionary * _Nullable productDelta, NSError * _Nullable error) {
	// Optionally show the default "Product Access" UI to gatekeep your app
	[paddle showProductAccessDialogWithProduct:paddleProduct];
}];

Customization

The SDK has various customization objects that allow you to futher configure and customize the experience:

Paddle Checkout Options

Further customize and configure the checkout experience:

  • Prefill various checkout fields (email, country, etc)
  • Coupons
  • Accepts Paddle Price Overrides
  • Passthrough
  • Custom parameters etc

Paddle Display Configuration

Control how you’d like Paddle SDK UI to be shown and configured:

  • Presentation type (window, sheet, etc)
  • If navigational buttons should be hidden (prevent default SDK UI flow)

Paddle Product Configuration

  • Set the default values to be shown in SDK UI if triggered while offline without a local Paddle Product.
  • Let the SDK know what the trial configuration should be if launched offline.