tr_payment_hub_client library
TR Payment Hub - Client SDK
Secure client SDK for Flutter applications. Does NOT contain API credentials - works with backend proxy.
Quick Start
import 'package:tr_payment_hub/tr_payment_hub_client.dart';
// Create proxy provider (no credentials needed!)
final provider = TrPaymentHub.createProxy(
baseUrl: 'https://api.yourbackend.com/payment',
provider: ProviderType.iyzico,
authToken: 'user_jwt_token', // Optional
);
await provider.initializeWithProvider(ProviderType.iyzico);
// Validate card before sending
final validation = CardValidator.validate(
cardNumber: '5528790000000008',
expireMonth: '12',
expireYear: '2030',
cvv: '123',
holderName: 'Ahmet Yilmaz',
);
if (!validation.isValid) {
print(validation.errors);
return;
}
// Create payment (request goes to your backend)
final result = await provider.createPayment(request);
What's Included
- ProxyPaymentProvider - Backend proxy provider
- CardValidator - Client-side card validation
- RequestValidator - Client-side request validation
- All models - PaymentRequest, PaymentResult, etc.
- Enums - Currency, CardType, ProviderType, etc.
- Exceptions - PaymentException, ValidationException
What's NOT Included
- Provider implementations (IyzicoProvider, PayTRProvider, etc.)
- Config classes with credentials (IyzicoConfig, PayTRConfig, etc.)
For full SDK with direct provider access, use tr_payment_hub.dart instead.
Classes
- AddressInfo
- Address information for shipping or billing.
- BasketItem
- Represents a single item in the shopping basket.
- BuyerInfo
- Buyer information for payment requests.
- CardInfo
- Card information for payment processing.
- CardValidationResult
- Result of card validation.
- CardValidator
- Client-side card validation utilities.
- HttpNetworkClient
-
Default NetworkClient implementation using the
httppackage. - InstallmentInfo
- Installment information for a specific card BIN.
- InstallmentOption
- Single installment option with pricing details.
- LogSanitizer
- Log temizleme - hassas verileri maskeler.
- MockPaymentProvider
- Mock payment provider for testing.
- NetworkClient
- Abstract HTTP client interface for making network requests.
- NetworkResponse
- HTTP response from network operations.
- PaymentProvider
- Ana payment provider interface
- PaymentRequest
- Payment request containing all data needed to process a payment.
- PaymentResult
- Result of a payment transaction.
- PaymentWebView
- Built-in WebView widget for 3D Secure payment flows.
- PaymentWebViewResult
- Result from 3DS WebView interaction.
- PaymentWebViewTheme
- Theme configuration for PaymentWebView widget.
- ProxyConfig
- Backend proxy configuration for Flutter + Custom Backend architecture.
- ProxyPaymentProvider
- Backend proxy payment provider for Flutter + Custom Backend architecture.
- RefundRequest
- Request model for processing refunds.
- RefundResult
- Result of a refund operation.
- RequestValidationResult
- Result of payment request validation.
- RequestValidator
- Client-side payment request validation utilities.
- SavedCard
- Represents a saved/tokenized card for recurring payments.
- ThreeDSInitResult
- Result of 3D Secure payment initialization.
- TrPaymentHub
- TR Payment Hub - Main Factory Class
Enums
- CardAssociation
- Kart şeması
- CardBrand
- Card brand/network identifier.
- CardType
- Kart tipleri
- Currency
- Para birimleri
- ItemType
- Ürün tipi
- MockErrorScenario
- Simulated error scenarios for testing.
- PaymentStatus
- Ödeme durumu
- PaymentWebViewStatus
- Status of the WebView payment interaction.
- ProviderType
- Desteklenen ödeme sağlayıcıları
- ThreeDSStatus
- 3DS durumu
Exceptions / Errors
- NetworkException
- Exception thrown when a network operation fails.
- PaymentException
- Ödeme hatası.
- ValidationException
- Input validation exception - thrown when validation fails