Coflnet.Payments.Client
0.32.0
See the version list below for details.
dotnet add package Coflnet.Payments.Client --version 0.32.0
NuGet\Install-Package Coflnet.Payments.Client -Version 0.32.0
<PackageReference Include="Coflnet.Payments.Client" Version="0.32.0" />
<PackageVersion Include="Coflnet.Payments.Client" Version="0.32.0" />
<PackageReference Include="Coflnet.Payments.Client" />
paket add Coflnet.Payments.Client --version 0.32.0
#r "nuget: Coflnet.Payments.Client, 0.32.0"
#:package Coflnet.Payments.Client@0.32.0
#addin nuget:?package=Coflnet.Payments.Client&version=0.32.0
#tool nuget:?package=Coflnet.Payments.Client&version=0.32.0
Payments
Handles payments, and access to digital goods and services
Configuration
Configuration is handled via asp.net configuration providers
Keys with defaults are set in appsettings.json
Active premium plus owners
The existing /metrics endpoint exports payments_active_product_owners{product="premium_plus"}
once per minute. It preserves GET /Products/service/premium_plus/count: count distinct
OwnerShips.UserId groups whose ownership has not expired and whose product slug or product
group slug matches premium_plus. Multiple matching ownerships count once. The legacy nullable
user group also counts once. Tier slots alone do not count; this is the existing ownership cohort.
payments_active_product_owners_last_success_timestamp_seconds{product="premium_plus"}
records a successful computation. Neither metric publishes an initial zero, and database errors
leave the previous count and timestamp unchanged. Consumers must filter stale computations,
even while Prometheus continues scraping successfully. For a Prometheus target identified by
job and instance, the equivalent fresh average is:
avg(
payments_active_product_owners{product="premium_plus"}
and on(job, instance, product)
(time() - payments_active_product_owners_last_success_timestamp_seconds{product="premium_plus"} < 180)
)
These aggregate metrics use the existing scrape endpoint and contain no user identifiers.
How purchases work
- Start top up
- wait till payment is verified
- (optional) plan purchase (locks some amount of balance)
- purchase product/service
Setup
Becuase it is the esiest by default stripe is used.
To configure stripe get your stripe KEY and SIGNING_SECRET from stripe.com and set them as configuration.
(either modify appsettings.json or set the enviromentvariables STRIPE__KEY and STRIPE__SIGNING_SECRET)
Next create a webhook callback to /Callback/stripe that triggers on confirmed purchase.
Stripe — Minimal API Key Permissions
The Stripe API key (STRIPE__KEY) is used for Checkout Sessions and pre-capture country validation:
| Operation | API Call | Permission |
|---|---|---|
| Create checkout session with dynamic payment methods | SessionService.CreateAsync() |
Write |
| List sessions by PaymentIntent | SessionService.ListAsync() |
Read |
| Expire stale sessions | SessionService.ExpireAsync() |
Write |
| Read provider country and capture/cancel supported authorizations | PaymentIntentService |
Read & Write |
| Read the expanded payment method country | PaymentIntent payment_method expansion |
Read |
Webhook verification uses the signing secret. Card and Link use per-method manual capture without disabling other methods. When Stripe supplies a payment-method country it is authoritative; otherwise the country or locale supplied at session creation must match the independently looked-up IP country. Disallowed automatically captured payments are marked for manual refund and are not credited.
Restricted key: Enable only Checkout Sessions → Read & Write, Payment Intents → Read & Write, and Payment Methods → Read.
CoinGate country verification
CoinGate requests must set TopUpOptions.Country from an explicit user selection and
TopUpOptions.UserIp from the trusted ingress. The service looks up the IP country using
IP_COUNTRY__BASE_URL (default: https://ipapi.co/) and falls back to
IP_COUNTRY__FALLBACK_BASE_URL (default: https://api.country.is/). It creates the order only
when both ISO country codes match and the country is eligible.
Paypal
Paypal can be configured with PAYPAL__SECRET, PAYPAL__ID and PAYPAL__IS_SANDBOX
Create a webhook callback to /Callback/paypal to allow for payments to be verified.
PayPal — Minimal API Permissions
PayPal uses the Orders API v2 (PayPalCheckoutSdk). The REST API app credentials (PAYPAL__ID / PAYPAL__SECRET) are used for three operations:
| Operation | API Call | Permission |
|---|---|---|
| Create order | OrdersCreateRequest |
Accept payments |
| Capture order (complete payment) | OrdersCaptureRequest |
Accept payments |
| Get order details | OrdersGetRequest |
Accept payments |
The code handles these webhook events (no API key needed — events carry their own data):
CHECKOUT.ORDER.APPROVED→ triggers capturePAYMENT.CAPTURE.COMPLETED→ updates transaction referencePAYMENT.CAPTURE.REFUNDED→ reverts purchase locally
Direct subscriptions (see docs/direct-subscriptions.md) additionally use the Subscriptions API:
create catalog products and billing plans (/v1/catalogs/products, /v1/billing/plans, created automatically on the first
checkout of a plan), create/get/cancel subscriptions and list their transactions (/v1/billing/subscriptions), and get/refund
subscription sales (/v1/payments/sale). Webhook events: BILLING.SUBSCRIPTION.*, PAYMENT.SALE.COMPLETED,
PAYMENT.SALE.REFUNDED, PAYMENT.SALE.REVERSED.
No PayPal Payouts, Disputes, Invoicing, Vault, or Transaction Search APIs are used.
Live app features: In the PayPal Developer Dashboard, enable only the "Accept payments" and "Subscriptions" features for the live REST API app. Disable Payouts, Customer disputes, Transaction search, Invoicing, Partner referrals, Vault, and Webhooks management.
Events
This microservice can produce transaction events into a Kafka Topic.
To configure it set the configuration variables KAFKA_HOST and KAFKA__TRANSACTION_TOPIC__NAME.
The format and fields of the events can be seen in the TransactionEvent class
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 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. |
-
net8.0
- JsonSubTypes (>= 2.0.1)
- Newtonsoft.Json (>= 13.0.3)
- Polly (>= 8.1.0)
- RestSharp (>= 112.0.0)
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 |
|---|---|---|
| 0.35.0 | 0 | 11/20/2026 |
| 0.34.0 | 0 | 11/20/2026 |
| 0.33.0 | 52 | 11/19/2026 |
| 0.32.0 | 57 | 11/17/2026 |
| 0.31.0 | 47 | 11/17/2026 |
| 0.30.0 | 54 | 11/17/2026 |
| 0.29.1 | 319 | 11/3/2026 |
| 0.29.0 | 802 | 10/20/2026 |
| 0.28.0 | 713 | 9/12/2026 |
| 0.27.0 | 195 | 9/7/2026 |
| 0.26.0 | 405 | 8/8/2026 |
| 0.25.0 | 136 | 8/7/2026 |
| 0.24.1 | 150 | 8/2/2026 |
| 0.24.0 | 137 | 8/2/2026 |
| 0.23.0 | 190 | 7/25/2026 |
| 0.22.0 | 1,183 | 4/8/2026 |
| 0.21.0 | 1,372 | 2/8/2026 |
| 0.20.0 | 646 | 1/4/2026 |
| 0.19.0 | 773 | 11/30/2025 |
| 0.18.1 | 553 | 10/31/2025 |
Minor update