FonsecaFramework.PayPal
2026.5.20.1
dotnet add package FonsecaFramework.PayPal --version 2026.5.20.1
NuGet\Install-Package FonsecaFramework.PayPal -Version 2026.5.20.1
<PackageReference Include="FonsecaFramework.PayPal" Version="2026.5.20.1" />
<PackageVersion Include="FonsecaFramework.PayPal" Version="2026.5.20.1" />
<PackageReference Include="FonsecaFramework.PayPal" />
paket add FonsecaFramework.PayPal --version 2026.5.20.1
#r "nuget: FonsecaFramework.PayPal, 2026.5.20.1"
#:package FonsecaFramework.PayPal@2026.5.20.1
#addin nuget:?package=FonsecaFramework.PayPal&version=2026.5.20.1
#tool nuget:?package=FonsecaFramework.PayPal&version=2026.5.20.1
FonsecaFramework.PayPal
A simplified PayPal REST API client for .NET with invoicing and PDF generation.
Overview
FonsecaFramework.PayPal is a .NET 9 library that wraps the PayPal REST API to provide a streamlined experience for common payment operations. It supports purchasing products, creating and managing invoices, handling subscriptions, and generating professional invoice PDFs using iText.
Installation
dotnet add package FonsecaFramework.PayPal
Features
| Area | Key Classes |
|---|---|
| PayPal Client | PayPalClient — authenticate, purchase products, capture payments, create/send invoices, manage subscriptions |
| Configuration | PayPalSettings — holds PayPalClientId, PayPalClientSecret, and PayPalUrl |
| Products | Product — name, price, currency code, and quantity |
| Receipts | Reciept — tracks order ID, checkout URL, status, subtotal, tax, and total |
| Invoicing | Invoice, BillingParty, BillableParty — full invoice model with line items and party details |
| PDF Generation | InvoicePdfGenerator — generates formatted invoice PDFs with line-item tables and watermarks |
Examples
Configure and Start a Purchase
using FonsecaFramework.PayPal;
var settings = new PayPalSettings
{
PayPalClientId = "<your-client-id>",
PayPalClientSecret = "<your-client-secret>",
PayPalUrl = "https://api-m.sandbox.paypal.com"
};
var client = new PayPalClient(new HttpClient(), settings, logger);
var products = new List<Product>
{
new Product { Name = "Widget", Price = 25.00m, CurrencyCode = "USD", Quantity = 2 },
new Product { Name = "Gadget", Price = 15.50m, CurrencyCode = "USD", Quantity = 1 }
};
Reciept? receipt = await client.StartPurchaseProducts(
products,
SuccessUrl: "https://mysite.com/success",
FailureUrl: "https://mysite.com/cancel",
InvoiceNumber: "INV-001",
TaxRate: 0.08m);
if (receipt != null)
{
Console.WriteLine($"Order: {receipt.OrderID}");
Console.WriteLine($"Checkout: {receipt.CheckoutUrl}");
Console.WriteLine($"Total: {receipt.Total:C}");
}
Generate an Invoice PDF
using FonsecaFramework.PayPal;
var invoice = new Invoice
{
InvoiceNumber = "INV-2025-001",
InvoiceDate = DateTime.Today,
DueDate = DateTime.Today.AddDays(30),
TaxRate = 0.07m,
BillingParty = new BillingParty
{
FirstName = "Acme Corp",
StreetAddress = "123 Main St",
City = "Springfield",
State = "IL",
PostalCode = "62704",
CountryCode = "US"
},
BillableParties = new List<BillableParty>
{
new BillableParty
{
FirstName = "Jane",
LastName = "Doe",
Email = "jane@example.com",
StreetAddress = "456 Oak Ave",
City = "Chicago",
State = "IL",
PostalCode = "60601",
CountryCode = "US"
}
},
Products = new List<Product>
{
new Product { Name = "Consulting", Price = 150.00m, CurrencyCode = "USD", Quantity = 4 }
}
};
InvoicePdfGenerator.GenerateInvoice("invoice.pdf", invoice);
Console.WriteLine("Invoice PDF generated.");
Requirements
- .NET 9.0
- PayPal developer account (sandbox or live credentials)
License
Copyright 2025 Steven Fonseca / VLR Creations
Licensed under the Apache License, Version 2.0. You may use this library free of charge, provided you include the required attribution notices. See the LICENSE file for full terms.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. 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. |
-
net9.0
- BouncyCastle.Cryptography (>= 2.6.2)
- BouncyCastle.NetCore (>= 2.2.1)
- FonsecaFramework (>= 2026.5.20.1)
- itext (>= 9.6.0)
- itext.bouncy-castle-adapter (>= 9.6.0)
- itext.bouncy-castle-fips-adapter (>= 9.6.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on FonsecaFramework.PayPal:
| Package | Downloads |
|---|---|
|
FonsecaFramework.Stripe
A simple client for the payment processor Stripe.net |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.5.20.1 | 42 | 5/20/2026 |
| 2026.5.12.1 | 102 | 5/13/2026 |
| 2026.5.11.1 | 116 | 5/11/2026 |
| 2026.5.7.2 | 108 | 5/7/2026 |
| 2026.5.7.1 | 104 | 5/7/2026 |
| 2026.5.6.1 | 109 | 5/6/2026 |
| 2026.5.5.1 | 110 | 5/5/2026 |
| 2026.5.2.1 | 105 | 5/2/2026 |
| 2026.4.30.1 | 100 | 4/30/2026 |
| 2026.4.29.1 | 125 | 4/29/2026 |
| 2026.4.27.1 | 110 | 4/28/2026 |
| 2026.4.22.1 | 109 | 4/22/2026 |
| 2026.4.21.1 | 109 | 4/21/2026 |
| 2026.4.20.1 | 115 | 4/20/2026 |
| 2026.4.15.1 | 114 | 4/15/2026 |
| 2026.4.13.1 | 118 | 4/13/2026 |
| 2026.4.10.1 | 112 | 4/10/2026 |
| 2026.4.8.1 | 110 | 4/8/2026 |
| 2026.4.7.1 | 117 | 4/7/2026 |
| 2026.4.3.1 | 115 | 4/3/2026 |