Foundational concepts: provider interfaces, entity model, payment lifecycle, statuses, methods, tokenization, and the provider capability matrix.
Authorize, capture, refund, and void operations with complete state tracking across each payment source.
Credit cards, ACH/eCheck, and credit memos supported with type-specific fields and validation.
BIN-based surcharge calculation and tracking with full status lifecycle and decline handling.
Core interface for all payment transaction operations. Every payment gateway must implement this interface to handle authorization, capture, and refund workflows.
public interface IPaymentProvider {
Task<TransactionResult> AuthorizeTransactionAsync(PaymentTransactionModel model, ...);
Task<TransactionResult> CaptureTransactionAsync(CapturePaymentInput input, ...);
Task<TransactionResult> AuthorizeAndCaptureTransactionAsync(...);
Task<TransactionResult> RefundPaymentAsync(...);
}
Interface for managing tokenized payment instruments. Handles wallet operations including adding, removing, and retrieving payment methods from the provider.
public interface IPaymentsMethodProvider {
Task<PipelineResult<PaymentMethod>> AddPaymentMethodAsync(CreatePaymentMethodInput input, ...);
Task<PipelineResult> RemovePaymentMethodAsync(RemovePaymentMethodInput input, ...);
Task<PipelineResult<PaymentMethod>> GetPaymentMethodInfoAsync(object paymentMethodId, ...);
}
On startup, the base class ensures a PaymentMethodProvider record exists in the database for this provider key.
Each provider plugin is registered in the client's Startup.cs alongside its settings and DI configuration.
public class MockPaymentsProviderPlugin : BasePaymentsProviderPlugin
{
public override string Key => "Mock";
}
// In Client/Startup.cs
services.AddPlugin<MockPaymentsProviderPlugin>();
The payment system is composed of a rich entity model that tracks every aspect of payment processing, from the top-level payment record through individual sources, methods, and surcharges.
| Entity | Purpose |
|---|---|
| Payment | Core payment record — Amount, AmountIsValid, IsEmulated, Status, Type |
| PaymentMethod | Tokenized payment instrument — Token, CardLastFour, BankName, etc. |
| PaymentMethodProvider | Configured provider instance — Mock, Nuvei, Stripe, etc. |
| PaymentMethodSource | Individual payment source within a payment |
| PaymentMethodSourceStatus | Status per source — Pending, Authorized, Captured, etc. |
| PaymentMethodType | Type classification — CreditCard, ACH, Credit |
| PaymentCardType | Card type — Visa, Mastercard, Amex, Discover |
| PaymentCreditMemoSource | Credit memo applied to payment |
| PaymentStatus | Aggregate payment status |
| PaymentTarget | Invoice or target being paid |
| PaymentType | Payment type classification |
| Surcharge | Fee or surcharge on payment |
| SurchargeStatus | Surcharge lifecycle status |
IsForOneTimeUse
IsPrimary
ProviderId
ExpirationDate
UpdateSurchargeForDeclinedPaymentPipeline reverses or adjusts surcharge records when payments are declined.
The first 6-8 digits of the card number (BIN) determine card type and applicable surcharge rate. Stored in the BankIdNumber field.
Surcharges track their own lifecycle (Pending, Assigned, Authorized, Completed, Refunded, Declined, Cancelled, Abandoned) independent of the parent payment status.
All sensitive payment data is tokenized before entering the Phoenix system. The full card number or bank account number never touches the server — only provider-issued tokens and display-safe fields are stored.
Provider-issued token that represents the payment method. Format and lifecycle vary by provider.
Provider-specific identifier for the payment method within the gateway system.
Only the last 4 digits of the card number, for display purposes. No full PAN ever enters the system.
All sensitive data is tokenized before entering any persistence layer. Combined with TDE/encryption at rest, this provides defense in depth.
| Provider | Wallet | Auth CC | Auth ACH | Cap CC | Cap ACH | A+C CC | A+C ACH | Subs |
|---|---|---|---|---|---|---|---|---|
| Authorize.Net | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No |
| ChasePaymentTech | Yes | Yes | No | Yes | No | Yes | No | No |
| CyberSource | Yes | Yes | No | Yes | No | Yes | No | No |
| Heartland | Yes | Yes | No | Yes | No | Yes | No | No |
| MagnifyPayments | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No |
| Mock | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No |
| Nuvei | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| Payengine | Yes | Yes | Yes | Yes | Yes | Yes | Yes | No |
| Payliance | Yes | No | Yes | No | Yes | No | Yes | No |
| PayPal | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| PayTrace | Yes | Yes | No | Yes | No | Yes | No | No |
| Stripe | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |