Skip to content
You're viewing guides for Paddle Classic, which is no longer available for new signups. Head to developer.paddle.com for Paddle Billing guides.

In-app checkout (Mac)

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
}];
paddle?.showCheckout(for: paddleProduct,
options: nil,
checkoutStatusCompletion: {
(state: PADCheckoutState, checkoutData: PADCheckoutData?) in
// 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
}];
}];
}
// Your Paddle SDK Config from the Vendor Dashboard
let myPaddleVendorID = "12345"
let myPaddleAPIKey = "1234abc5678defg"
let myPaddleProductID = "678910"
// Default Product Config in case we're unable to reach our servers on first run
let defaultProductConfig = PADProductConfiguration()
defaultProductConfig.productName = "My v4 Product"
defaultProductConfig.vendorName = "My Company"
// Initialize the SDK singleton with the config
let paddle = Paddle.sharedInstance(
withVendorID: myPaddleVendorID, apiKey: myPaddleAPIKey, productID: myPaddleProductID,
configuration: defaultProductConfig, delegate: nil)
// Initialize the Product you'd like to work with
let paddleProduct = PADProduct(
productID: myPaddleProductID, productType: PADProductType.sdkProduct,
configuration: defaultProductConfig)
// Ask the Product to get its latest state and info from the Paddle Platform
paddleProduct?.refresh(
{
(delta: [AnyHashable: Any]?, error: Error?) in
// Launch the checkout:
paddle?.showCheckout(
for: paddleProduct!, options: nil,
checkoutStatusCompletion: {
(
state: PADCheckoutState,
checkoutData: PADCheckoutData?
) in
// Examine checkout state to determine the checkout result
})
})

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.

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];
// Create a new checkout options object and set the properties you want to pre-fill
let options = PADCheckoutOptions()
options.email = "example@email.com"
options.country = "GB"
options.postcode = "SE1"
options.coupon = "My-coupon"
// Pass the checkout options to the checkout.
paddle.showCheckout(for: 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

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];
// Create a new checkout options object and set the custom parameters you require.
let options = PADCheckoutOptions()
options.additionalCheckoutParameters = ["quantity": 32]
// Pass the checkout options to the checkout.
paddle.showCheckout(for: product, options: options, checkoutStatusCompletion: nil)

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