polybrainz_now_payments 1.0.0
polybrainz_now_payments: ^1.0.0 copied to clipboard
A type-safe Dart API wrapper for NOWPayments cryptocurrency payment gateway. Accept 300+ cryptocurrencies with payments, invoices, payouts, and IPN webhooks.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.0.0 - 2026-01-22 #
Added #
-
NowPaymentsClient - Main API client with full endpoint coverage
getStatus()- Check API availabilitygetCurrencies()- List all available cryptocurrenciesgetSelectedCurrencies()- List merchant's enabled currenciesgetEstimatePrice()- Get price estimates for currency conversiongetMinimumPaymentAmount()- Get minimum payment thresholdscreatePayment()- Create cryptocurrency paymentsgetPaymentStatus()- Check payment status by IDgetPayments()- List payments with filteringcreateInvoice()- Generate payment invoices with URLsauthenticate()- JWT authentication for payout operationsgetBalance()- Check custody account balancecreatePayout()- Create cryptocurrency payoutsverifyPayout()- Verify payouts with 2FAgetPayoutStatus()- Check payout statusgetPayouts()- List payouts with filteringvalidateAddress()- Validate wallet addresses
-
Enums - Type-safe constants (no magic strings)
PaymentStatus- waiting, confirming, confirmed, sending, partiallyPaid, finished, failed, refunded, expiredPayoutStatus- creating, processing, sending, finished, failed, rejectedFiatCurrency- USD, EUR, GBP, and 30+ fiat currenciesSortOrder- asc, descNowPaymentsEnvironment- production, sandbox
-
Request Models - Type-safe request builders with
toJson()CreatePaymentRequestCreateInvoiceRequestCreatePayoutRequestVerifyPayoutRequestListPaymentsRequestListPayoutsRequestEstimatePriceRequestMinimumAmountRequest
-
Response Models - Type-safe responses with
fromJson()andtoJson()PaymentResponsewith helper methods (isComplete,isPending,isFailed)PaymentListResponseInvoiceResponsePayoutResponsewith helper methodsPayoutListResponseApiStatusResponseCurrenciesResponseEstimatePriceResponseMinimumAmountResponseBalanceResponseAuthResponse
-
Exceptions - Typed exception handling
NowPaymentsException- Base exceptionAuthenticationException- 401 errorsBadRequestException- 400 errorsNotFoundException- 404 errorsRateLimitException- 429 errors with retry infoRequestFailedException- 402 errorsServerException- 5xx errors
-
Utilities
IpnValidator- HMAC-SHA512 signature validation for webhooksNowPaymentsConfig- Configuration with environment, timeout, and loggingNowPaymentsEndpoints- API endpoint constants
-
Features
- Dependency injection for HTTP client (enables testing)
- Sandbox and production environment support
- Optional debug logging
- Configurable request timeouts
- Flexible JSON parsing (handles string/number variations from API)