payments (1.0.0)
Installation
dart pub add payments:1.0.0 --hosted-url=About this package
Dart.Package.Payments
Payment session/product/receipt DTOs and HTTP clients for Stripe-backed checkout (ported from the old platform).
Quick start
import 'package:payments/payments.dart';
final service = PaymentService('https://payments.example.com');
service.setAuthToken(token);
final products = await service.products.list();
final session = await service.receipts.checkout(productId: products.first.id);
PaymentService is a singleton keyed by whichever base URL first constructs
it — PaymentService(baseUrl) returns the existing instance on subsequent
calls with a different URL, it does not reconfigure it. WebClient wraps
package:http with bearer-token auth and a shared ensureSuccess status
check.
Project structure
pubspec.yaml
Version.txt
lib/
├── payments.dart public API — exports
└── src/
├── models.dart PaymentSession, ProductDto, ReceiptDto
├── web_client.dart WebClient — GET/POST/DELETE with bearer auth
├── payment_service.dart PaymentService singleton
├── products_client.dart ProductsClient
├── receipts_clients.dart ReceiptsClient
└── stripe_client.dart StripeClient
test/
└── payments_test.dart DTO JSON round-trips, WebClient/PaymentService logic
example/
└── example.dart
Versioning and publishing
Version.txt is the exact version that gets published — a push to main
publishes it only when that version isn't on the feed yet. Pushes to any
other branch only resolve and test.
CI
.forgejo/workflows/build.yml installs the Dart SDK, resolves dependencies,
and runs dart test on every push. On main, it also publishes via
dart pub publish, tags the commit v<version>, and creates a matching
Release — via the shared
Platform/Forgejo.Package.Actions/dart-publish
composite action. .forgejo/workflows/cleanup.yml removes prerelease Pub
versions when their branch is deleted.