In-App Checkout (Mac)

Sell one-time or recurring products from within your desktop app

A Paddle in-app checkout can be shown at any time, provided you have already initialized both the SDK singleton and the Product you’d like to load in the checkout.

Call the showCheckoutForProduct method to load the checkout:

[paddle showCheckoutForProduct:paddleProduct
                       options:nil
      checkoutStatusCompletion:^(PADCheckoutState state, ADCheckoutData * _Nullable checkoutData)
{
	// Examine checkout state to determine the checkout result
}];

A full implementation would look something like:

#import <Paddle/Paddle.h>
  
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {

  // Your Paddle SDK Config from the Vendor Dashboard
  NSString *myPaddleProductID = @"12345";
  NSString *myPaddleVendorID = @"56791";
  NSString *myPaddleAPIKey = @"abc123def345hij678";

  // Populate a local object in case we're unable to retrieve data
  // from the Vendor Dashboard
  PADProductConfiguration *defaultProductConfig = [[PADProductConfiguration alloc] init];
  defaultProductConfig.productName = @"My v4 Product";
  defaultProductConfig.vendorName = @"My Company";

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

  // Ask the Product to get its latest state and info from the Paddle Platform
  [paddleProduct refresh:^(NSDictionary * _Nullable productDelta, NSError * _Nullable error) {
    // Launch the checkout
    [paddle showCheckoutForProduct:paddleProduct
                           options:nil
          checkoutStatusCompletion:^(PADCheckoutState state, PADCheckoutData * _Nullable checkoutData) {
      // Examine checkout state to determine the checkout result
    }];
  }];
}

Checkout Options

The Checkout is quite flexible and supports numerous configuration, pre-fill, and pricing options. These can be leveraged by passing a PADCheckoutOptions object to the Checkout.

Override Prices

To override prices in the checkout you will need to use the Custom Checkout API and pass in prices to override the initial checkout price or recurring_prices if you wish to override a subscription’s subsequent recurring payment amount.

Pre-fill Checkout Fields

You can also pre-fill certain checkout fields such as the email and the postcode by setting their appropriate properties in the PADCheckoutOptions object.

// Create a new checkout options object and set the properties you want to pre-fill
PADCheckoutOptions *options = [PADCheckoutOptions options];

options.email = @"example@email.com";
options.country = @"GB";
options.postcode = @"SE1";
options.coupon = @"My-coupon";

// Pass the checkout options to the checkout.
[Paddle.sharedInstance showCheckoutForProduct:product options:options checkoutStatusCompletion:nil];

Additional checkout options that can be set directly on the PADCheckoutOptions object include:

  • quantity and allowQuantity
  • disableLogout
  • passthrough
  • locale
  • title
  • message

Additional Parameters

If you need to pass additional checkout parameters you can also use the PADCheckoutOptions.additionalCheckoutParameters property.

// Create a new checkout options object and set the custom parameters you require.
PADCheckoutOptions *options = [PADCheckoutOptions options];

options.additionalCheckoutParameters = @{@"quantity": @32};

// Pass the checkout options to the checkout.
[Paddle.sharedInstance showCheckoutForProduct:product options:options checkoutStatusCompletion:nil];

This property accepts any JS parameter value from the Checkout Parameters used in the web version of the checkout.