In-App Checkout (Windows)

A checkout can be shown at any time, provided you have already initialized the SDK singleton and the Product you’d like to be purchased:

Paddle.Instance.ShowCheckoutWindowForProduct(product);

A full implementation would look something like this:

using PaddleSDK;
using PaddleSDK.Checkout;
using PaddleSDK.Product;

namespace MyNamespace
{
    public class MyClass
    {
        public void StartPaddle()
        {
            // Your Paddle SDK Config from the Vendor Dashboard
            string vendorId = "12345";
            string productId = "678910";
            string apiKey = "1234abc5678defg";

            // Default Product Config in case we're unable to reach our servers on first run
            var productInfo = new PaddleProductConfig { ProductName = "My v2 product", VendorName = "My Company" };

            // Initialize the SDK singleton with the config
            Paddle.Configure(apiKey, vendorId, productId, productInfo);

            // Set up events for Checkout
            Paddle.Instance.TransactionCompleteEvent += PaddleCheckoutForm_TransactionCompleteEvent;
            Paddle.Instance.TransactionErrorEvent += PaddleCheckoutForm_TransactionErrorEvent;
            Paddle.Instance.TransactionBeginEvent += PaddleCheckoutForm_TransactionBeginEvent;

            // Initialize the Product you'd like to work with
            PaddleProduct product = PaddleProduct.CreateProduct(productId);

            // Ask the Product to get it's latest state and info from the Paddle Platform
            product.Refresh((success) =>
            {
                // Show the checkout for your refreshed Product
                Paddle.Instance.ShowCheckoutWindowForProduct(product);
            });
        }
    }
}

Checkout Options

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 CheckoutOptions object.

// Create a new CheckoutOptions instance and set the properties you want to pre-fill
CheckoutOptions options = new CheckoutOptions();

options.Email = "example@email.com";
options.Country = "us";
options.PostCode = "SE1";
options.Coupon = "My-coupon";

// Pass the CheckoutOptions object when you open the CheckoutWindow
Paddle.Instance.ShowCheckoutWindowForProduct(product, options);

Additional checkout options that can be set directly on the CheckoutOptions.options field include:

  • Quantity and AllowQuantity
  • DisableLogout
  • Passthrough
  • Locale
  • Title
  • Message

Additional Parameters

If you need to pass additional checkout parameters you can also use the AddCheckoutParameters method of a CheckoutOptions object.

// Create a new CheckoutOptions instance and add the custom parameters you need
CheckoutOptions options = new CheckoutOptions();

options.AddCheckoutParameters("custom_message", "A short message displayed below the product name on the checkout.");

// Pass the CheckoutOptions object when you open the CheckoutWindow
Paddle.Instance.ShowCheckoutWindowForProduct(product, options);

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