{"id":31589398,"url":"https://github.com/odinsoft-lab/polar.net","last_synced_at":"2026-05-18T09:05:48.355Z","repository":{"id":311206147,"uuid":"1042661811","full_name":"odinsoft-lab/polar.net","owner":"odinsoft-lab","description":"Thin C# client library for Polar API (https://docs.polar.sh/). Supports sandbox and production with simple, typed access.","archived":false,"fork":false,"pushed_at":"2025-08-26T15:40:38.000Z","size":1202,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-14T05:56:04.417Z","etag":null,"topics":["api","client","payments","polar","subscriptions"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/odinsoft-lab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"docs/ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-22T11:22:27.000Z","updated_at":"2025-10-19T09:46:42.000Z","dependencies_parsed_at":"2025-08-27T04:15:22.675Z","dependency_job_id":"62ad6a1e-b40d-4c3d-90a0-26f5743f85c8","html_url":"https://github.com/odinsoft-lab/polar.net","commit_stats":null,"previous_names":["lisa3907/polar.net","odinsoft-lab/polar.net"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/odinsoft-lab/polar.net","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odinsoft-lab%2Fpolar.net","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odinsoft-lab%2Fpolar.net/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odinsoft-lab%2Fpolar.net/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odinsoft-lab%2Fpolar.net/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/odinsoft-lab","download_url":"https://codeload.github.com/odinsoft-lab/polar.net/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odinsoft-lab%2Fpolar.net/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33172173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T05:43:36.989Z","status":"ssl_error","status_checked_at":"2026-05-18T05:43:19.133Z","response_time":71,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","client","payments","polar","subscriptions"],"created_at":"2025-10-06T02:52:28.114Z","updated_at":"2026-05-18T09:05:48.320Z","avatar_url":"https://github.com/odinsoft-lab.png","language":"C#","funding_links":["https://polar.sh","https://sandbox-api.polar.sh","https://api.polar.sh","https://docs.polar.sh/api-reference","https://sandbox.polar.sh"],"categories":[],"sub_categories":[],"readme":"# PolarNet\n\n[![NuGet](https://img.shields.io/nuget/v/PolarNet.svg)](https://www.nuget.org/packages/PolarNet/)\n[![.NET](https://img.shields.io/badge/.NET-8.0%20%7C%209.0-blue.svg)](https://dotnet.microsoft.com/)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md)\n[![Downloads](https://img.shields.io/nuget/dt/PolarNet.svg)](https://www.nuget.org/packages/PolarNet/)\n[![API Coverage](https://img.shields.io/badge/API%20Coverage-55%25-yellow.svg)](docs/TASK.md)\n\n Thin C# client library for [Polar.sh](https://polar.sh) API - Modern billing infrastructure for developers.\n\n 🚀 **v1.1.2** - Now with Payments, Refunds, and Webhook management!\n\n Supported frameworks: `.NET Standard 2.0`, `.NET Standard 2.1`, `.NET 8`, `.NET 9`\n\n## 📋 Features\n\n- ✅ **Core Payment Processing** - Checkout sessions, orders, payments, and refunds\n- ✅ **Subscription Management** - Full subscription lifecycle with customer state tracking\n- ✅ **Webhook Infrastructure** - Complete webhook endpoint management with signature verification\n- ✅ **Customer Management** - CRUD operations with state and meter usage tracking\n- ⚠️ **Products \u0026 Benefits** - Read-only access (full CRUD coming in v1.2.0)\n- 🔜 **Coming Soon** - Discounts, License Keys, Files, OAuth2/OIDC authentication\n\n## Project structure\n\n```\npolar.net/\n├── src/                      # Class library (NuGet package)\n│   ├── Models/               # Typed API models\n│   │   ├── Resources/        # API resources (Product, Order, etc.)\n│   │   ├── Requests/         # Request DTOs\n│   │   ├── Webhooks/         # Webhook event models\n│   │   └── CustomerState/    # Customer state models\n│   ├── Services/             \n│   │   ├── PolarClient/      # API endpoint implementations\n│   │   └── Webhooks/         # Webhook handling services\n│   └── polar.net.csproj\n├── samples/\n│   ├── polar.sample/         # Console app demonstrating API calls\n│   └── polar.webhook/        # ASP.NET webhook receiver with event store\n├── tests/                    # xUnit tests with 90%+ coverage\n├── docs/                     \n│   ├── TASK.md              # Implementation status vs official API\n│   ├── ROADMAP.md           # Development roadmap\n│   └── releases/            # Release notes\n└── README.md\n```\n\n## 🚀 Quick start\n\n### Install from NuGet\n\n```powershell\ndotnet add package PolarNet --version 1.1.2\n```\n\nOr via Package Manager:\n```powershell\nInstall-Package PolarNet -Version 1.1.2\n```\n\n### Build from source\n\n```powershell\ngit clone https://github.com/odinsoft-lab/polar.net.git\ncd polar.net\ndotnet restore\ndotnet build -c Release\n```\n\n### Run samples\n\n```powershell\n# Console sample\ncd samples/polar.sample\ndotnet run\n\n# Webhook receiver (ASP.NET)\ncd samples/polar.webhook\ndotnet run\n```\n\nNotes:\n- The samples read configuration from `appsettings.json` (no code edits required). Set your values in:\n\t- `samples/polar.sample/appsettings.json`\n\t- `samples/polar.webhook/appsettings.json`\n- Start the ASP.NET webhook sample from `samples/polar.webhook` with `dotnet run`.\n\nMinimal config used by samples/tests:\n\n```json\n{\n\t\"PolarSettings\": {\n        \"AccessToken\": \"\u003cYOUR_SANDBOX_OAT\u003e\",\n        \"WebhookSecret\": \"\u003cYOUR_WEBHOOK_SECRET\u003e\",\n        \"OrganizationId\": \"\u003cYOUR_ORGANIZATION_ID\u003e\",\n        \"ProductId\": \"\u003cYOUR_PRODUCT_ID\u003e\",\n        \"PriceId\": \"\u003cYOUR_PRICE_ID\u003e\",\n        \"WebhookBaseUrl\": \"\u003cYOUR_WEBHOOK_BASE_URL\u003e\",\n        \"SandboxApiUrl\": \"https://sandbox-api.polar.sh\",\n        \"ProductionApiUrl\": \"https://api.polar.sh\",\n        \"UseSandbox\": true\n\t}\n}\n```\n\n## 💻 Using the library\n\n### Basic setup\n\n```csharp\nusing PolarNet;\n\nvar client = new PolarClient(new PolarClientOptions\n{\n    AccessToken = \"\u003cYOUR_ACCESS_TOKEN\u003e\",\n    BaseUrl = \"https://sandbox-api.polar.sh\", // or production URL\n    OrganizationId = \"\u003cYOUR_ORG_ID\u003e\"\n});\n\n// Get organization details\nvar org = await client.GetOrganizationAsync();\nConsole.WriteLine($\"Organization: {org.Name}\");\n```\n\n### Example: Create checkout and process payment\n\n```csharp\n// Create a checkout session\nvar checkout = await client.CreateCheckoutAsync(new CreateCheckoutRequest\n{\n    OrganizationId = client.Options.OrganizationId,\n    ProductId = \"product_123\",\n    PriceId = \"price_456\",\n    SuccessUrl = \"https://example.com/success\",\n    CustomerEmail = \"customer@example.com\"\n});\n\n// Later, check payment status\nvar payments = await client.ListPaymentsAsync(new ListPaymentsRequest\n{\n    OrderId = checkout.OrderId\n});\n\nif (payments.Items.Any(p =\u003e p.Status == \"succeeded\"))\n{\n    Console.WriteLine(\"Payment successful!\");\n}\n```\n\n### Example: Handle webhooks\n\n```csharp\n// In your ASP.NET controller\n[HttpPost(\"webhook\")]\npublic async Task\u003cIActionResult\u003e HandleWebhook(\n    [FromBody] string payload,\n    [FromHeader(Name = \"X-Polar-Signature\")] string signature)\n{\n    var service = new PolarWebhookService(\"your_webhook_secret\");\n    \n    if (!service.VerifySignature(payload, signature))\n        return Unauthorized();\n    \n    var envelope = service.ParseEnvelope(payload);\n    \n    switch (envelope.Event)\n    {\n        case \"order.created\":\n            var order = JsonSerializer.Deserialize\u003cPolarOrder\u003e(envelope.Data);\n            // Process order...\n            break;\n        case \"subscription.updated\":\n            var subscription = JsonSerializer.Deserialize\u003cPolarSubscription\u003e(envelope.Data);\n            // Handle subscription change...\n            break;\n    }\n    \n    return Ok();\n}\n```\n\n## 📊 API Implementation Status\n\n### ✅ Fully Implemented (8/22 endpoints)\n- **Checkout** - Create and retrieve custom checkout sessions\n- **Customers** - Full CRUD operations with state management\n- **Subscriptions** - Complete lifecycle management (create, list, get, cancel, revoke)\n- **Orders** - List and retrieve order details\n- **Refunds** - Create (full/partial), list, and retrieve refunds\n- **Payments** - List and retrieve payment details with filtering\n- **Webhook Endpoints** - Full CRUD + testing capabilities\n- **Customer State** - Track usage meters and granted benefits\n\n### ⚠️ Partially Implemented (3/22 endpoints)\n- **Products** - Read-only (list, get) - *Full CRUD in v1.2.0*\n- **Benefits** - List only - *Full management in v1.2.0*\n- **Organizations** - Get only - *Update operations in v1.3.0*\n\n### 🔜 Coming Soon (11/22 endpoints)\n- **v1.2.0** - Discounts, License Keys, Files, Product CRUD\n- **v1.3.0** - OAuth2/OIDC, Customer Portal, Sessions\n- **v1.4.0** - Metrics, Events, Meters, Custom Fields\n\nFor detailed implementation status, see [docs/TASK.md](docs/TASK.md).  \nFor development roadmap, see [docs/ROADMAP.md](docs/ROADMAP.md).\n\n## 🧪 Testing\n\n### Test cards for Sandbox\n\nStripe test cards for payment testing:\n\n| Card Number | Scenario |\n|-------------|----------|\n| `4242 4242 4242 4242` | Success |\n| `4000 0000 0000 0002` | Failure |\n| `4000 0025 0000 3155` | 3D Secure authentication |\n| `4000 0000 0000 9995` | Decline |\n\n### Running tests\n\n```powershell\ncd tests/PolarNet.Tests\ndotnet test --logger \"console;verbosity=detailed\"\n```\n\n## 🔧 Troubleshooting\n\n| Error | Cause | Solution |\n|-------|-------|----------|\n| `401 Unauthorized` | Invalid/expired token | Verify token is valid for environment (sandbox/production) |\n| `404 Not Found` | Resource doesn't exist | Check IDs exist in your environment |\n| `422 Unprocessable Entity` | Invalid request | Verify required fields and data types |\n| `429 Too Many Requests` | Rate limit exceeded | Implement retry with exponential backoff |\n\n## ⚙️ Configuration\n\n### Authentication\n- **Organization Access Token (OAT)** - Server-side operations\n- **Customer Access Token** - Customer-specific operations (coming in v1.3.0)\n- **OAuth2/OIDC** - Third-party integrations (coming in v1.3.0)\n\n### Environment URLs\n- **Production**: `https://api.polar.sh`\n- **Sandbox**: `https://sandbox-api.polar.sh`\n\n### Rate Limits\n- 300 requests/minute per organization\n- 1 request/second for license key validation\n\n## 📚 Documentation\n\n- 📖 [Implementation Status](docs/TASK.md) - Current API coverage details\n- 🗺️ [Development Roadmap](docs/ROADMAP.md) - Future release plans\n- 📝 [Release Notes](docs/releases/) - Version history and changes\n- 🌐 [Polar API Reference](https://docs.polar.sh/api-reference) - Official API documentation\n- 🧪 [Polar Sandbox](https://sandbox.polar.sh) - Test environment\n\n\n## 🤝 Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](docs/CONTRIBUTING.md) for details.\n\n### Development setup\n```powershell\ngit clone https://github.com/odinsoft-lab/polar.net.git\ncd polar.net\ndotnet restore\ndotnet build\ndotnet test\n```\n\n## 👥 Team\n\n### Core Development Team\n- **SEONGAHN LEE** - Lead Developer \u0026 Project Architect ([lisa@odinsoft.co.kr](mailto:lisa@odinsoft.co.kr))\n- **YUJIN** - Senior Developer \u0026 Integration Specialist ([yoojin@odinsoft.co.kr](mailto:yoojin@odinsoft.co.kr))\n- **SEJIN** - Software Developer \u0026 API Implementation ([saejin@odinsoft.co.kr](mailto:saejin@odinsoft.co.kr))\n\n## 📞 Support\n\n- 🐛 **Issues**: [GitHub Issues](https://github.com/odinsoft-lab/polar.net/issues)\n- 💬 **Discussions**: [GitHub Discussions](https://github.com/odinsoft-lab/polar.net/discussions)\n- 📧 **Email**: help@odinsoft.co.kr\n- 📖 **Documentation**: [Wiki](https://github.com/odinsoft-lab/polar.net/wiki)\n\n## 📄 License\n\nMIT License - see [LICENSE.md](LICENSE.md) for details.\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n**Built with ❤️ by the ODINSOFT Team**\n\n[⭐ Star us on GitHub](https://github.com/odinsoft-lab/polar.net) | \n[📦 NuGet Package](https://www.nuget.org/packages/PolarNet/) | \n[🌐 Polar.sh](https://polar.sh)\n\n\u003c/div\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fodinsoft-lab%2Fpolar.net","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fodinsoft-lab%2Fpolar.net","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fodinsoft-lab%2Fpolar.net/lists"}