FonsecaFramework.PayPal
2026年7月1日.1
dotnet add package FonsecaFramework.PayPal --version 2026年7月1日.1
NuGet\Install-Package FonsecaFramework.PayPal -Version 2026年7月1日.1
<PackageReference Include="FonsecaFramework.PayPal" Version="2026年7月1日.1" />
<PackageVersion Include="FonsecaFramework.PayPal" Version="2026年7月1日.1" />Directory.Packages.props
<PackageReference Include="FonsecaFramework.PayPal" />Project file
paket add FonsecaFramework.PayPal --version 2026年7月1日.1
#r "nuget: FonsecaFramework.PayPal, 2026年7月1日.1"
#:package FonsecaFramework.PayPal@2026年7月1日.1
#addin nuget:?package=FonsecaFramework.PayPal&version=2026年7月1日.1Install as a Cake Addin
#tool nuget:?package=FonsecaFramework.PayPal&version=2026年7月1日.1Install as a Cake Tool
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 | net10.0 is compatible. 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. |
-
net10.0
- BouncyCastle.Cryptography (>= 2.6.2)
- BouncyCastle.NetCore (>= 2.2.1)
- FonsecaFramework (>= 2026年7月1日.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年7月1日.1 | 88 | 7/1/2026 |
| 2026年6月28日.1 | 104 | 6/29/2026 |
| 2026年6月18日.1 | 116 | 6/18/2026 |
| 2026年6月13日.1 | 106 | 6/13/2026 |
| 2026年6月4日.2 | 107 | 6/4/2026 |
| 2026年6月4日.1 | 126 | 6/4/2026 |
| 2026年6月3日.3 | 116 | 6/4/2026 |
| 2026年6月3日.2 | 116 | 6/4/2026 |
| 2026年6月3日.1 | 118 | 6/3/2026 |
| 2026年5月21日.1 | 122 | 5/22/2026 |
| 2026年5月20日.1 | 121 | 5/20/2026 |
| 2026年5月12日.1 | 120 | 5/13/2026 |
| 2026年5月11日.1 | 129 | 5/11/2026 |
| 2026年5月7日.2 | 122 | 5/7/2026 |
| 2026年5月7日.1 | 121 | 5/7/2026 |
| 2026年5月6日.1 | 120 | 5/6/2026 |
| 2026年5月5日.1 | 123 | 5/5/2026 |
| 2026年5月2日.1 | 116 | 5/2/2026 |
| 2026年4月30日.1 | 115 | 4/30/2026 |
| 2026年4月29日.1 | 137 | 4/29/2026 |