PolarNet 1.1.2
dotnet add package PolarNet --version 1.1.2
NuGet\Install-Package PolarNet -Version 1.1.2
<PackageReference Include="PolarNet" Version="1.1.2" />
<PackageVersion Include="PolarNet" Version="1.1.2" />
<PackageReference Include="PolarNet" />
paket add PolarNet --version 1.1.2
#r "nuget: PolarNet, 1.1.2"
#:package PolarNet@1.1.2
#addin nuget:?package=PolarNet&version=1.1.2
#tool nuget:?package=PolarNet&version=1.1.2
PolarNet
Thin C# client library for Polar API with samples (console + ASP.NET webhook).
Supported frameworks: netstandard2.0, netstandard2.1, .NET 8, .NET 9
Project structure
polar.net/
├── src/ # Class library (packable)
│ ├── Models/ # Typed API models (split per class)
│ ├── Services/ # Low-level HTTP service
│ ├── PolarClient.cs # Public client facade
│ ├── PolarClientOptions.cs # Client options
│ └── polar.net.csproj
├── samples/
│ ├── polar.sample/ # Console app demonstrating API calls
│ └── polar.webhook/ # ASP.NET webhook receiver sample
├── tests/ # xUnit tests
└── README.md
Quick start
- Clone & restore
git clone https://github.com/lisa3907/polar.net.git
cd polar.net
dotnet restore
- Build the solution
dotnet build -c Debug
- Run the console sample (dotnet run uses the sample project)
cd samples/polar.sample
dotnet run
Notes:
- The samples read configuration from
appsettings.json
(no code edits required). Set your values in:samples/polar.sample/appsettings.json
samples/polar.webhook/appsettings.json
- Start the ASP.NET webhook sample from
samples/polar.webhook
withdotnet run
.
Minimal config used by samples/tests:
{
"PolarSettings": {
"UseSandbox": true,
"SandboxApiUrl": "https://sandbox-api.polar.sh",
"ProductionApiUrl": "https://api.polar.sh",
"AccessToken": "<SANDBOX_OAT>",
"OrganizationId": "<ORG_ID>",
"ProductId": "<PRODUCT_ID>",
"PriceId": "<PRICE_ID>"
}
}
Using the library (programmatic)
Add a project reference to src/polar.net.csproj
(already wired for samples), then:
var client = new PolarNet.PolarClient(new PolarNet.PolarClientOptions
{
AccessToken = "<SANDBOX_OAT>",
BaseUrl = "https://sandbox-api.polar.sh", // no trailing slash
OrganizationId = "<ORG_ID>",
DefaultProductId = "<PRODUCT_ID>",
DefaultPriceId = "<PRICE_ID>"
});
var org = await client.GetOrganizationAsync();
Implemented endpoints (current)
- Organization: GET
/v1/organizations/{organization_id}
- Products: GET
/v1/products?organization_id={org}
· GET/v1/products/{id}
- Prices: GET
/v1/prices?organization_id={org}[&product_id={pid}]
· GET/v1/prices/{id}
- Customers: POST
/v1/customers
· GET/v1/customers?organization_id={org}
· GET/v1/customers/{id}
· GET/v1/customers/{id}/state
· DELETE/v1/customers/{id}
- Subscriptions: POST
/v1/subscriptions
· GET/v1/subscriptions?organization_id={org}
· GET/v1/subscriptions/{id}
· DELETE/v1/subscriptions/{id}
· POST/v1/subscriptions/{id}/revoke
- Checkouts (custom): POST
/v1/checkouts/custom
· GET/v1/checkouts/custom/{id}
- Orders: GET
/v1/orders?organization_id={org}
· GET/v1/orders/{id}
- Benefits: GET
/v1/benefits?organization_id={org}
- Payments (NEW): GET
/v1/payments?organization_id={org}
· GET/v1/payments/{id}
· GET/v1/payments?order_id={oid}
· GET/v1/payments?customer_id={cid}
- Refunds (NEW): POST
/v1/refunds
· GET/v1/refunds?organization_id={org}
· GET/v1/refunds/{id}
- Webhook Endpoints (NEW): POST
/v1/webhooks/endpoints
· GET/v1/webhooks/endpoints
· GET/v1/webhooks/endpoints/{id}
· PATCH/v1/webhooks/endpoints/{id}
· DELETE/v1/webhooks/endpoints/{id}
· POST/v1/webhooks/endpoints/{id}/test
Test card info
Stripe test cards useful in Sandbox when testing paid products:
- Success: 4242 4242 4242 4242
- Failure: 4000 0000 0000 0002
- 3D Secure: 4000 0025 0000 3155
Troubleshooting
- 401 Unauthorized: Verify the token is sandbox, valid scopes, and not expired.
- 404 Not Found: Verify IDs exist in your sandbox.
- 422 Unprocessable Entity: Check request payload and required fields.
Configuration notes
- Authentication uses a Bearer Organization Access Token in the
Authorization
header. - Set
BaseUrl
to the host (sandbox:https://sandbox-api.polar.sh
, production:https://api.polar.sh
). - Some helper methods use defaults from options (
OrganizationId
,DefaultProductId
,DefaultPriceId
).
License
MIT License — see LICENSE.md
References
- Polar Documentation: https://docs.polar.sh
- Polar Sandbox: https://sandbox.polar.sh
- Polar API Reference: https://docs.polar.sh/api-reference
- Polar: https://polar.sh
👥 Team
Core Development Team
- SEONGAHN - Lead Developer & Project Architect (lisa@odinsoft.co.kr)
- YUJIN - Senior Developer & Exchange Integration Specialist (yoojin@odinsoft.co.kr)
- SEJIN - Software Developer & API Implementation (saejin@odinsoft.co.kr)
📞 Support & Contact
- 🐛 Issues: GitHub Issues
- 📧 Email: help@odinsoft.co.kr
📄 License
MIT License - see LICENSE.md for details.
Built with ❤️ by the ODINSOFT Team | ⭐ Star us on GitHub
Product | Versions 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 is compatible. 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 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. |
.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. |
-
.NETStandard 2.0
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.Json (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- System.Net.Http (>= 4.3.4)
-
.NETStandard 2.1
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.Json (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- System.Net.Http (>= 4.3.4)
-
net8.0
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.Json (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- System.Net.Http (>= 4.3.4)
-
net9.0
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.Json (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- System.Net.Http (>= 4.3.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
PolarNet v1.1.2 — 2025-08-23
🚀 New Features
- ✅ Payments API: Complete payment listing and retrieval operations
- ✅ Refunds API: Full refund operations including partial refunds support
- ✅ Webhook Endpoints API: Complete webhook management (CRUD operations + testing)
- ✅ Benefits API: Benefits listing functionality
- ✅ Customer State API: Customer state and meter usage management
🛠 Improvements
- Enhanced model structures for Payments, Refunds, and Webhook Endpoints
- Added comprehensive webhook testing infrastructure with 13 test cases
- Improved error handling and validation across all new APIs
- Extended support for customer meter usage tracking
📝 Documentation
- Added TASK.md: Implementation status tracking against official Polar.sh API
- Added ROADMAP.md: Comprehensive development roadmap for future releases
- Updated all documentation to align with official Polar.sh API reference
- API coverage now at ~45% of official Polar.sh endpoints
🔄 Breaking Changes
- None - all existing APIs remain backward compatible
📦 Dependencies
- No new dependencies added
- Maintains compatibility with netstandard2.0, netstandard2.1, net8.0, net9.0
🐛 Bug Fixes
- Fixed invalid webhook event type (payment.succeeded → order.paid)
- Corrected test expectations for unreachable webhook URLs
- Resolved compilation warnings in webhook tests
📊 Current Implementation Status
- Core Payment Flow: 75% Complete
- Customer Management: 60% Complete
- Overall API Coverage: 45% Complete
- Ready for production use with basic e-commerce and subscription scenarios
For detailed implementation status, see docs/TASK.md
For future development plans, see docs/ROADMAP.md
Thank you for using PolarNet!