PaddleWrapper 1.0.0.1

dotnet add package PaddleWrapper --version 1.0.0.1
                    
NuGet\Install-Package PaddleWrapper -Version 1.0.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PaddleWrapper" Version="1.0.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PaddleWrapper" Version="1.0.0.1" />
                    
Directory.Packages.props
<PackageReference Include="PaddleWrapper" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PaddleWrapper --version 1.0.0.1
                    
#r "nuget: PaddleWrapper, 1.0.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PaddleWrapper@1.0.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PaddleWrapper&version=1.0.0.1
                    
Install as a Cake Addin
#tool nuget:?package=PaddleWrapper&version=1.0.0.1
                    
Install as a Cake Tool

PaddleWrapper

A .NET SDK for the Paddle API. This wrapper provides a simple and intuitive way to interact with Paddle's API services.

Installation

You can install the package via NuGet:

dotnet add package PaddleWrapper

Usage

First, initialize the PaddleClient with your API key:

var client = new PaddleClient("your-api-key");

Working with Products

// List all products
var products = await client.Products.ListAsync();

// Get a specific product
var product = await client.Products.GetAsync("prod_123");

// Create a new product
var newProduct = await client.Products.CreateAsync(new Product 
{
    Name = "My Product",
    Description = "Product description"
});

// Update a product
var updatedProduct = await client.Products.UpdateAsync("prod_123", product);

Working with Prices

// List all prices
var prices = await client.Prices.ListAsync();

// Get a specific price
var price = await client.Prices.GetAsync("pri_123");

// Create a new price
var newPrice = await client.Prices.CreateAsync(new Price 
{
    ProductId = "prod_123",
    Description = "Monthly subscription",
    UnitPrice = new PriceAmount 
    {
        Amount = 9.99m,
        CurrencyCode = "USD"
    }
});

// Update a price
await client.Prices.UpdateAsync("pri_123", price);

Working with Discounts

// List all discounts
var discounts = await client.Discounts.ListAsync();

// Get a specific discount
var discount = await client.Discounts.GetAsync("dsc_123");

// Create a new discount
var newDiscount = await client.Discounts.CreateAsync(new Discount 
{
    Code = "SUMMER2023",
    Type = "percentage",
    Description = "Summer Sale",
    Amount = new DiscountAmount 
    {
        Value = 20,
        Type = "percentage"
    }
});

// Update a discount
await client.Discounts.UpdateAsync("dsc_123", discount);

Working with Addresses

// List all addresses
var addresses = await client.Addresses.ListAsync();

// Get a specific address
var address = await client.Addresses.GetAsync("add_123");

// Create a new address
var newAddress = await client.Addresses.CreateAsync(new Address 
{
    CountryCode = "US",
    PostalCode = "94105",
    City = "San Francisco",
    FirstLine = "123 Main St",
    Description = "Main Office"
});

// Update an address
await client.Addresses.UpdateAsync("add_123", address);

Working with Businesses

// List all businesses
var businesses = await client.Businesses.ListAsync();

// Get a specific business
var business = await client.Businesses.GetAsync("biz_123");

// Create a new business
var newBusiness = await client.Businesses.CreateAsync(new Business 
{
    Name = "Acme Corp",
    CompanyNumber = "12345678",
    Contacts = new[] 
    {
        new BusinessContact 
        {
            IsPrimary = true,
            Name = "John Doe",
            Email = "john@acme.com"
        }
    }
});

// Update a business
await client.Businesses.UpdateAsync("biz_123", business);

Working with Customers

// List all customers
var customers = await client.Customers.ListAsync();

// Get a specific customer
var customer = await client.Customers.GetAsync("ctm_123");

// Create a new customer
var newCustomer = await client.Customers.CreateAsync(new Customer 
{
    Name = "John Doe",
    Email = "customer@example.com"
});

Working with Transactions

// List all transactions
var transactions = await client.Transactions.ListAsync();

// Get a specific transaction
var transaction = await client.Transactions.GetAsync("txn_123");

// Create a new transaction
var newTransaction = await client.Transactions.CreateAsync(new Transaction 
{
    CustomerId = "ctm_123",
    Items = new[] 
    {
        new TransactionItem 
        {
            Quantity = 1,
            PriceId = "pri_123"
        }
    }
});

// Preview a transaction
var preview = await client.Transactions.PreviewAsync(transaction);

Working with Subscriptions

// List all subscriptions
var subscriptions = await client.Subscriptions.ListAsync();

// Get a specific subscription
var subscription = await client.Subscriptions.GetAsync("sub_123");

// Create a new subscription
var newSubscription = await client.Subscriptions.CreateAsync(new Subscription 
{
    CustomerId = "ctm_123",
    Items = new[] 
    {
        new SubscriptionItem 
        {
            Quantity = 1,
            PriceId = "pri_123"
        }
    }
});

// Pause a subscription
await client.Subscriptions.PauseAsync("sub_123");

// Resume a subscription
await client.Subscriptions.ResumeAsync("sub_123");

// Cancel a subscription
await client.Subscriptions.CancelAsync("sub_123");

Working with Webhooks

// List all webhooks
var webhooks = await client.Webhooks.ListAsync();

// Get a specific webhook
var webhook = await client.Webhooks.GetAsync("whk_123");

// Create a new webhook
var newWebhook = await client.Webhooks.CreateAsync(new Webhook 
{
    Description = "My webhook",
    EndpointUrl = "https://your-domain.com/webhook",
    SubscribedEvents = new[] { "subscription.created", "subscription.updated" }
});

// Update a webhook
await client.Webhooks.UpdateAsync("whk_123", webhook);

// Delete a webhook
await client.Webhooks.DeleteAsync("whk_123");

// List webhook events
var events = await client.Webhooks.ListEventsAsync();

// Get a specific webhook event
var webhookEvent = await client.Webhooks.GetEventAsync("evt_123");

Working with Notifications

// List all notifications
var notifications = await client.Notifications.ListAsync();

// Get a specific notification
var notification = await client.Notifications.GetAsync("ntf_123");

// List notification attempts
var attempts = await client.Notifications.ListAttemptsAsync("ntf_123");

// Get a specific notification attempt
var attempt = await client.Notifications.GetAttemptAsync("ntf_123", "att_123");

// Replay a notification
await client.Notifications.ReplayAsync("ntf_123");

Error Handling

The SDK uses standard HTTP status codes and throws exceptions when API calls fail. You should wrap API calls in try-catch blocks:

try 
{
    var product = await client.Products.GetAsync("prod_123");
} 
catch (HttpRequestException ex) 
{
    // Handle API errors
    Console.WriteLine($"API error: {ex.Message}");
}

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the GPL-3.0 License - see the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0.1 278 1/9/2025
1.0.0 237 1/9/2025