Invoking the Checkout with the Windows SDK C# v2

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 th checkout for your refreshed Product
                Paddle.Instance.ShowCheckoutWindowForProduct(product);
            });
        }
    }
}

Questions about Paddle?

If you need any help regarding your Paddle integration, please get in touch with our Customer Success team using the form below.