AlphaPay 0.0.6

dotnet add package AlphaPay --version 0.0.6
                    
NuGet\Install-Package AlphaPay -Version 0.0.6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AlphaPay" Version="0.0.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AlphaPay" Version="0.0.6" />
                    
Directory.Packages.props
<PackageReference Include="AlphaPay" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AlphaPay --version 0.0.6
                    
#r "nuget: AlphaPay, 0.0.6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AlphaPay@0.0.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AlphaPay&version=0.0.6
                    
Install as a Cake Addin
#tool nuget:?package=AlphaPay&version=0.0.6
                    
Install as a Cake Tool

AlphaPay

Unified payment abstraction for .NET — One clean interface for Stripe, PayPal, Checkout.com, M-Pesa, Microsoft Store, and more.

Why AlphaPay?

Global payment systems are incompatible by design. Each has its own authentication, signatures, webhook formats, and error codes. AlphaPay provides a clean abstraction layer so you can:

  • Switch payment providers without rewriting your code
  • Support multiple providers simultaneously
  • Mock payments easily for testing
  • Add new providers without touching existing code

Installation

One package includes everything:

dotnet add package AlphaPay

Includes 18 payment providers out of the box:

  • ✅ Stripe (Global)
  • ✅ PayPal (Global)
  • ✅ Checkout.com (Global)
  • ✅ M-Pesa (Africa - Kenya)
  • ✅ Paystack (Africa)
  • ✅ Flutterwave (Africa)
  • ✅ Razorpay (India)
  • ✅ Square (Global)
  • ✅ Adyen (Global)
  • ✅ Braintree (Global - PayPal)
  • ✅ Authorize.Net (Global)
  • ✅ Cryptocurrency (Global - Multi-crypto gateway)
  • ✅ Bitcoin (BTC) - Dedicated Bitcoin provider
  • ✅ Ethereum (ETH) - Dedicated Ethereum provider
  • ✅ Tether (USDT) - ERC-20 stablecoin on multiple chains
  • ✅ USD Coin (USDC) - ERC-20 stablecoin on multiple chains
  • ✅ Binance Coin (BNB) - Binance Smart Chain native token
  • ✅ Ripple (XRP) - XRP Ledger payments

Works with all .NET applications:

  • ✅ WPF (Windows Presentation Foundation)
  • ✅ MSIX packaged applications
  • ✅ Windows Forms
  • ✅ ASP.NET Core / Blazor
  • ✅ Console applications

For Microsoft Store integration (separate package):

dotnet add package AlphaPay.Providers.MicrosoftStore  # Windows Store in-app purchases

Quick Start

Single Provider (Stripe)

using AlphaPay;
using AlphaPay.Core;
using AlphaPay.Providers.Stripe;

var gateway = new PaymentGateway()
    .UseStripe("sk_test_YOUR_STRIPE_KEY");

var result = await gateway.CreatePaymentAsync(new PaymentRequest
{
    Amount = 50.00m,
    Currency = "USD",
    CustomerEmail = "customer@example.com",
    Reference = "ORDER-12345",
    Description = "Premium subscription"
});

if (result.Success)
{
    Console.WriteLine($"Payment successful! ID: {result.TransactionId}");
}
else
{
    Console.WriteLine($"Payment failed: {result.ErrorMessage}");
}

Multiple Providers

using AlphaPay.Providers.Stripe;
using AlphaPay.Providers.PayPal;
using AlphaPay.Providers.Checkout;
using AlphaPay.Providers.Mpesa;
using AlphaPay.Providers.Crypto;

var gateway = new PaymentGateway()
    .UseStripe("sk_test_STRIPE_KEY", setAsDefault: true)
    .UsePayPal("CLIENT_ID", "CLIENT_SECRET", useSandbox: true)
    .UseCheckout("sk_test_CHECKOUT_KEY", useSandbox: true)
    .UseMpesa(
        consumerKey: "YOUR_MPESA_KEY",
        consumerSecret: "YOUR_MPESA_SECRET",
        shortCode: "174379",
        passkey: "YOUR_PASSKEY",
        environment: MpesaEnvironment.Sandbox
    )
    .UseBitcoin("YOUR_CRYPTO_API_KEY", useSandbox: true);

// Use default provider (Stripe)
var stripePayment = await gateway.CreatePaymentAsync(new PaymentRequest
{
    Amount = 100.00m,
    Currency = "USD",
    CustomerEmail = "user@example.com",
    Reference = "ORDER-001"
});

// Use PayPal
var paypalPayment = await gateway.CreatePaymentAsync("PayPal", new PaymentRequest
{
    Amount = 50.00m,
    Currency = "USD",
    CustomerEmail = "customer@example.com",
    Reference = "ORDER-002"
});

// Use Checkout.com
var checkoutPayment = await gateway.CreatePaymentAsync("Checkout.com", new PaymentRequest
{
    Amount = 75.50m,
    Currency = "EUR",
    Reference = "ORDER-003"
});

// Use M-Pesa
var mpesaPayment = await gateway.CreatePaymentAsync("M-Pesa", new PaymentRequest
{
    Amount = 1000m,
    Currency = "KES",
    CustomerPhone = "254712345678",
    Reference = "ORDER-004"
});

// Use Bitcoin
var cryptoPayment = await gateway.CreatePaymentAsync("Cryptocurrency", new PaymentRequest
{
    Amount = 99.99m,
    Currency = "USD",
    CustomerEmail = "customer@example.com",
    Reference = "ORDER-005"
});

Core Features

1. Create Payment

var request = new PaymentRequest
{
    Amount = 25.99m,
    Currency = "USD",
    CustomerEmail = "john@example.com",
    CustomerPhone = "254712345678", // Required for M-Pesa
    Reference = "INV-2024-001",
    Description = "Product purchase",
    CallbackUrl = "https://yourapp.com/webhook",
    Metadata = new Dictionary<string, string>
    {
        ["user_id"] = "12345",
        ["product_id"] = "SKU-789"
    }
};

var result = await gateway.CreatePaymentAsync(request);

2. Verify Payment

var result = await gateway.VerifyPaymentAsync("txn_1234567890");

Console.WriteLine($"Status: {result.Status}");
Console.WriteLine($"Amount: {result.Amount} {result.Currency}");

3. Refund Payment

var refund = await gateway.RefundAsync(
    transactionId: "txn_1234567890",
    amount: 25.99m,
    reason: "Customer requested refund"
);

if (refund.Success)
{
    Console.WriteLine($"Refund ID: {refund.RefundId}");
}

4. Handle Webhooks

// In your ASP.NET Core controller
[HttpPost("webhook/stripe")]
public async Task<IActionResult> StripeWebhook()
{
    var payload = await new StreamReader(Request.Body).ReadToEndAsync();
    var headers = Request.Headers.ToDictionary(h => h.Key, h => h.Value.ToString());

    try
    {
        var webhookEvent = await gateway.ParseWebhookAsync("Stripe", payload, headers);

        if (webhookEvent.IsValid && webhookEvent.Status == PaymentStatus.Success)
        {
            // Update your database
            await UpdateOrder(webhookEvent.Reference, "paid");
        }

        return Ok();
    }
    catch (WebhookValidationException ex)
    {
        return BadRequest(ex.Message);
    }
}

Provider-Specific Examples

Stripe Configuration

using AlphaPay.Providers.Stripe;

var stripeConfig = new StripeConfiguration
{
    SecretKey = "sk_test_...",
    WebhookSecret = "whsec_...", // For webhook validation
    ApiVersion = "2023-10-16"
};

var gateway = new PaymentGateway().UseStripe(stripeConfig);

PayPal Configuration

using AlphaPay.Providers.PayPal;

var paypalConfig = new PayPalConfiguration
{
    ClientId = "YOUR_CLIENT_ID",
    ClientSecret = "YOUR_CLIENT_SECRET",
    UseSandbox = true,
    WebhookId = "YOUR_WEBHOOK_ID"
};

var gateway = new PaymentGateway().UsePayPal(paypalConfig);

// Create payment
var result = await gateway.CreatePaymentAsync("PayPal", new PaymentRequest
{
    Amount = 99.99m,
    Currency = "USD",
    Description = "Product Purchase",
    Reference = "ORDER-123"
});

// If payment requires customer approval
if (result.PaymentUrl != null)
{
    Console.WriteLine($"Redirect customer to: {result.PaymentUrl}");
}

Checkout.com Configuration

using AlphaPay.Providers.Checkout;

var checkoutConfig = new CheckoutConfiguration
{
    SecretKey = "sk_test_...",
    PublicKey = "pk_test_...",
    UseSandbox = true,
    WebhookSignatureKey = "YOUR_SIGNATURE_KEY"
};

var gateway = new PaymentGateway().UseCheckout(checkoutConfig);

// Create payment
var result = await gateway.CreatePaymentAsync("Checkout.com", new PaymentRequest
{
    Amount = 49.99m,
    Currency = "GBP",
    CustomerEmail = "customer@example.com",
    Reference = "INV-456"
});

M-Pesa Configuration

using AlphaPay.Providers.Mpesa;

var mpesaConfig = new MpesaConfiguration
{
    ConsumerKey = "YOUR_KEY",
    ConsumerSecret = "YOUR_SECRET",
    ShortCode = "174379",
    Passkey = "YOUR_PASSKEY",
    Environment = MpesaEnvironment.Sandbox,
    CallbackUrl = "https://yourapp.com/mpesa/callback"
};

var gateway = new PaymentGateway().UseMpesa(mpesaConfig);

Adyen Configuration

using AlphaPay.Providers.Adyen;

var adyenConfig = new AdyenConfiguration("test") // or "live" with liveUrlPrefix
{
    ApiKey = "YOUR_API_KEY",
    MerchantAccount = "YOUR_MERCHANT_ACCOUNT",
    HmacKey = "YOUR_HMAC_KEY" // For webhook validation
};

var gateway = new PaymentGateway().UseAdyen(adyenConfig);

// Create payment
var result = await gateway.CreatePaymentAsync("Adyen", new PaymentRequest
{
    Amount = 99.99m,
    Currency = "USD",
    CustomerEmail = "customer@example.com",
    Reference = "ORDER-123"
});

// Handle redirect for 3D Secure
if (result.PaymentUrl != null)
{
    Console.WriteLine($"Redirect customer to: {result.PaymentUrl}");
}

Braintree Configuration

using AlphaPay.Providers.Braintree;

var braintreeConfig = new BraintreeConfiguration(useSandbox: true)
{
    MerchantId = "YOUR_MERCHANT_ID",
    PublicKey = "YOUR_PUBLIC_KEY",
    PrivateKey = "YOUR_PRIVATE_KEY",
    WebhookSignatureKey = "YOUR_WEBHOOK_KEY"
};

var gateway = new PaymentGateway().UseBraintree(braintreeConfig);

// Create payment
var result = await gateway.CreatePaymentAsync("Braintree", new PaymentRequest
{
    Amount = 49.99m,
    Currency = "USD",
    CustomerEmail = "customer@example.com",
    Reference = "ORDER-456"
});

Authorize.Net Configuration

using AlphaPay.Providers.AuthorizeNet;

var authorizeNetConfig = new AuthorizeNetConfiguration(useSandbox: true)
{
    ApiLoginId = "YOUR_API_LOGIN_ID",
    TransactionKey = "YOUR_TRANSACTION_KEY",
    SignatureKey = "YOUR_SIGNATURE_KEY" // For webhook validation
};

var gateway = new PaymentGateway().UseAuthorizeNet(authorizeNetConfig);

// Create payment
var result = await gateway.CreatePaymentAsync("Authorize.Net", new PaymentRequest
{
    Amount = 75.00m,
    Currency = "USD",
    CustomerEmail = "customer@example.com",
    Reference = "ORDER-789"
});

Cryptocurrency Configuration

using AlphaPay.Providers.Crypto;

// Simple Bitcoin configuration
var gateway = new PaymentGateway()
    .UseBitcoin("YOUR_API_KEY", useSandbox: true);

// Or use Ethereum
var gateway = new PaymentGateway()
    .UseEthereum("YOUR_API_KEY", useSandbox: true);

// Advanced configuration with multiple cryptocurrencies
var cryptoConfig = new CryptoConfiguration("YOUR_API_KEY", useSandbox: true)
{
    DefaultCurrency = "BTC", // BTC, ETH, USDT, etc.
    WebhookSecret = "YOUR_WEBHOOK_SECRET",
    IpnCallbackUrl = "https://yourapp.com/crypto/webhook",
    SupportedCurrencies = new[]
    {
        "BTC",   // Bitcoin
        "ETH",   // Ethereum
        "USDT",  // Tether
        "USDC",  // USD Coin
        "BNB",   // Binance Coin
        "XRP",   // Ripple
        "ADA",   // Cardano
        "SOL",   // Solana
        "DOGE",  // Dogecoin
        "MATIC", // Polygon
        "LTC",   // Litecoin
        "TRX"    // Tron
    }
};

var gateway = new PaymentGateway().UseCrypto(cryptoConfig);

// Create Bitcoin payment
var result = await gateway.CreatePaymentAsync("Cryptocurrency", new PaymentRequest
{
    Amount = 99.99m,
    Currency = "USD", // Fiat currency - will be converted to crypto
    CustomerEmail = "customer@example.com",
    Reference = "ORDER-CRYPTO-001",
    Description = "Bitcoin Payment"
});

// Payment result includes crypto-specific details
if (result.Success || result.Status == PaymentStatus.Pending)
{
    Console.WriteLine($"Payment Address: {result.RawData["pay_address"]}");
    Console.WriteLine($"Amount to Pay: {result.RawData["pay_amount"]} {result.RawData["pay_currency"]}");
    Console.WriteLine($"Payment URL: {result.PaymentUrl}");
}

// Get available cryptocurrencies
var provider = new CryptoProvider(cryptoConfig);
var currencies = await provider.GetAvailableCurrenciesAsync();
Console.WriteLine($"Supported: {string.Join(", ", currencies)}");

// Check minimum payment amount
var minAmount = await provider.GetMinimumAmountAsync("USD", "BTC");
Console.WriteLine($"Minimum BTC payment: {minAmount} BTC");

Note: Cryptocurrency provider integrates with payment gateways like:

Key Features:

  • Automatic crypto-to-fiat conversion
  • Real-time payment tracking
  • Multiple cryptocurrency support
  • QR code payment addresses
  • Webhook notifications for payment status
  • Testnet support for development

Important: Cryptocurrency refunds require manual processing due to blockchain immutability. Process refunds through your crypto gateway dashboard.

Bitcoin (BTC) Configuration

using AlphaPay.Providers.Bitcoin;

// Bitcoin payment setup
var bitcoinConfig = new BitcoinConfiguration("YOUR_API_KEY", useTestnet: false)
{
    WalletAddress = "YOUR_BITCOIN_ADDRESS",
    RequiredConfirmations = 3 // Wait for 3 confirmations
};

var gateway = new PaymentGateway().UseBitcoin(bitcoinConfig);

// Create Bitcoin payment
var result = await gateway.CreatePaymentAsync("Bitcoin", new PaymentRequest
{
    Amount = 100.00m,
    Currency = "USD", // Will be converted to BTC
    CustomerEmail = "customer@example.com",
    Reference = "ORDER-BTC-001"
});

// Payment instructions
Console.WriteLine($"Bitcoin Address: {result.RawData["btc_address"]}");
Console.WriteLine($"Amount: {result.RawData["btc_amount"]} BTC");
Console.WriteLine($"Payment URI: {result.PaymentUrl}");

Ethereum (ETH) Configuration

using AlphaPay.Providers.Ethereum;

// Ethereum payment setup using Infura
var ethConfig = new EthereumConfiguration("YOUR_INFURA_API_KEY", useTestnet: false)
{
    WalletAddress = "0xYourEthereumAddress",
    RequiredConfirmations = 12 // Standard for Ethereum
};

var gateway = new PaymentGateway().UseEthereum(ethConfig);

// Create Ethereum payment
var result = await gateway.CreatePaymentAsync("Ethereum", new PaymentRequest
{
    Amount = 50.00m,
    Currency = "USD", // Will be converted to ETH
    Reference = "ORDER-ETH-001"
});

// Verify transaction
var verification = await gateway.VerifyPaymentAsync("Ethereum", "0xtransactionhash");
Console.WriteLine($"Confirmations: {verification.RawData["block_number"]}");

Tether (USDT) Configuration

using AlphaPay.Providers.Tether;

// USDT payment setup (ERC-20 on Ethereum)
var usdtConfig = new TetherConfiguration("YOUR_API_KEY", useTestnet: false)
{
    WalletAddress = "0xYourEthereumAddress",
    Network = "ethereum", // or "tron", "bsc"
    ContractAddress = "0xdac17f958d2ee523a2206206994597c13d831ec7" // USDT on Ethereum
};

var gateway = new PaymentGateway().UseTether(usdtConfig);

// Create USDT payment
var result = await gateway.CreatePaymentAsync("Tether (USDT)", new PaymentRequest
{
    Amount = 100.00m,
    Currency = "USD", // 1:1 with USDT
    Reference = "ORDER-USDT-001"
});

Console.WriteLine($"Send {result.RawData["usdt_amount"]} USDT");
Console.WriteLine($"Network: {result.RawData["network"]}");

USD Coin (USDC) Configuration

using AlphaPay.Providers.UsdCoin;

// USDC payment setup (multi-chain support)
var usdcConfig = new UsdCoinConfiguration("YOUR_API_KEY", useTestnet: false)
{
    WalletAddress = "0xYourAddress",
    Network = "polygon", // ethereum, polygon, avalanche, etc.
    RequiredConfirmations = 20
};

var gateway = new PaymentGateway().UseUsdCoin(usdcConfig);

// Create USDC payment
var result = await gateway.CreatePaymentAsync("USD Coin (USDC)", new PaymentRequest
{
    Amount = 75.00m,
    Currency = "USD",
    Reference = "ORDER-USDC-001"
});

Binance Coin (BNB) Configuration

using AlphaPay.Providers.BinanceCoin;

// BNB payment setup on Binance Smart Chain
var bnbConfig = new BinanceCoinConfiguration("YOUR_API_KEY", useTestnet: false)
{
    WalletAddress = "0xYourBSCAddress",
    RequiredConfirmations = 15
};

var gateway = new PaymentGateway().UseBinanceCoin(bnbConfig);

// Create BNB payment
var result = await gateway.CreatePaymentAsync("Binance Coin (BNB)", new PaymentRequest
{
    Amount = 100.00m,
    Currency = "USD", // Will be converted to BNB
    Reference = "ORDER-BNB-001"
});

Console.WriteLine($"Send {result.RawData["bnb_amount"]} BNB to {result.RawData["bnb_address"]}");

Ripple (XRP) Configuration

using AlphaPay.Providers.Ripple;

// XRP payment setup with destination tag
var xrpConfig = new RippleConfiguration("YOUR_API_KEY", useTestnet: false)
{
    WalletAddress = "rYourXRPAddress",
    DestinationTag = 12345, // Optional, for payment identification
    RequiredConfirmations = 1 // XRP confirms quickly
};

var gateway = new PaymentGateway().UseRipple(xrpConfig);

// Create XRP payment
var result = await gateway.CreatePaymentAsync("Ripple (XRP)", new PaymentRequest
{
    Amount = 50.00m,
    Currency = "USD", // Will be converted to XRP
    Reference = "ORDER-XRP-001"
});

Console.WriteLine($"Send {result.RawData["xrp_amount"]} XRP");
Console.WriteLine($"Destination Tag: {result.RawData["destination_tag"]}");
Console.WriteLine($"Payment URI: {result.PaymentUrl}");

// Verify XRP transaction
var provider = new RippleProvider(xrpConfig);
var balance = await provider.GetAccountBalanceAsync("rSomeAddress");
Console.WriteLine($"Account Balance: {balance} XRP");

Blockchain APIs Used:

  • Bitcoin: BlockCypher API
  • Ethereum: Infura or Alchemy APIs
  • Tether (USDT): Ethereum/Tron network APIs
  • USD Coin (USDC): Ethereum/Polygon network APIs
  • Binance Coin (BNB): Binance Smart Chain RPC
  • Ripple (XRP): XRP Ledger JSON-RPC API

Microsoft Store Configuration

using AlphaPay.Providers.MicrosoftStore;

// Simple configuration
var gateway = new PaymentGateway()
    .UseMicrosoftStore(enableDebugLogging: true);

// Or with advanced config
var storeConfig = new MicrosoftStoreConfiguration
{
    EnableDebugLogging = true,
    AllowOfflineLicenseCheck = true,
    PartnerCenterAppId = "Your app ID from Partner Center"
};

var gateway = new PaymentGateway().UseMicrosoftStore(storeConfig);

// Purchase a product (Product ID from Partner Center)
var result = await gateway.CreatePaymentAsync(new PaymentRequest
{
    Reference = "9NBLGGH4R315",  // Store Product ID
    Description = "Premium Unlock"
});

// Check subscription status
var provider = new MicrosoftStoreProvider();
var subscription = await provider.CheckSubscriptionAsync("monthly_pro");

if (subscription.IsActive)
{
    Console.WriteLine($"Subscription expires: {subscription.ExpirationDate}");
}

Note: Microsoft Store provider requires:

  • Windows 10/11 app
  • MSIX packaging
  • Products configured in Partner Center

See MICROSOFT_STORE_GUIDE.md for complete Partner Center setup instructions.

Payment Status Flow

Pending → Processing → Success
                     ↘ Failed
                     ↘ Cancelled
                     ↘ Expired
                     ↘ RequiresAction

Architecture

AlphaPay (Core Package)
├── Core/
│   ├── IPaymentProvider (interface)
│   ├── PaymentProviderBase (base class)
│   ├── PaymentRequest, PaymentResult (models)
│   ├── PaymentGateway (facade)
│   └── PaymentException (errors)
│
├── Providers/ (All built-in)
│   ├── Stripe/
│   │   └── StripeProvider : PaymentProviderBase
│   ├── PayPal/
│   │   └── PayPalProvider : PaymentProviderBase
│   ├── Checkout/
│   │   └── CheckoutProvider : PaymentProviderBase
│   └── Mpesa/
│       └── MpesaProvider : PaymentProviderBase

AlphaPay.Providers.MicrosoftStore (Separate - Windows only)
└── MicrosoftStoreProvider : IPaymentProvider

Your App
└── Uses PaymentGateway with any provider

Building & Publishing

Build All Projects

dotnet build -c Release

Pack NuGet Packages

# Pack main library (includes all cross-platform providers)
dotnet pack AlphaPay/AlphaPay.csproj -c Release

# Pack Windows-specific provider
dotnet pack AlphaPay.Providers.MicrosoftStore/AlphaPay.Providers.MicrosoftStore.csproj -c Release

Publish to NuGet

# Publish main package (includes all 11 providers)
dotnet nuget push AlphaPay/bin/Release/AlphaPay.0.0.5.nupkg \
    -k YOUR_API_KEY \
    -s https://api.nuget.org/v3/index.json

# Publish MicrosoftStore provider separately
dotnet nuget push AlphaPay.Providers.MicrosoftStore/bin/Release/AlphaPay.Providers.MicrosoftStore.0.0.1.nupkg \
    -k YOUR_API_KEY \
    -s https://api.nuget.org/v3/index.json

Adding Your Own Provider

  1. Create a new class library: AlphaPay.Providers.YourProvider
  2. Reference AlphaPay core library
  3. Implement IPaymentProvider:
public class YourProvider : PaymentProviderBase
{
    public override string ProviderName => "YourProvider";

    public override async Task<PaymentResult> CreatePaymentAsync(
        PaymentRequest request,
        CancellationToken cancellationToken = default)
    {
        // Your implementation
    }

    // Implement other methods...
}
  1. Add extension method:
public static class YourProviderExtensions
{
    public static PaymentGateway UseYourProvider(
        this PaymentGateway gateway,
        string apiKey,
        bool setAsDefault = false)
    {
        var provider = new YourProvider(apiKey);
        return gateway.AddProvider(provider, setAsDefault);
    }
}

Roadmap

Implemented Providers ✅

Built into AlphaPay core (v0.1.0):

  • Stripe - Payment Intents, refunds, webhooks with HMAC-SHA256 validation
  • PayPal - Orders API, OAuth 2.0 authentication, refunds
  • Checkout.com - Payments API, refunds, webhook signature validation
  • M-Pesa - Safaricom mobile money, STK Push, callbacks
  • Paystack - Transaction API (Africa), webhooks, HMAC-SHA512 validation
  • Flutterwave - Payments API (Africa), refunds, webhook hash validation
  • Razorpay - Orders API (India), refunds, HMAC-SHA256 webhooks
  • Square - Payments API v2, refunds, webhook signature validation
  • Adyen - Checkout API v70, refunds, HMAC-SHA256 webhook validation
  • Braintree - Transaction API, Basic Auth, HMAC-SHA256 webhooks (PayPal)
  • Authorize.Net - Transaction API, refunds, HMAC-SHA512 webhooks
  • Cryptocurrency - Multi-crypto gateway (200+ coins), HMAC-SHA512 webhooks
  • Bitcoin (BTC) - BlockCypher API, native Bitcoin blockchain integration
  • Ethereum (ETH) - Infura/Alchemy APIs, EVM-compatible chains
  • Tether (USDT) - ERC-20 token on Ethereum, Tron, BSC
  • USD Coin (USDC) - ERC-20 token on Ethereum, Polygon, Avalanche
  • Binance Coin (BNB) - Binance Smart Chain native token
  • Ripple (XRP) - XRP Ledger for fast cross-border payments

Separate package (Windows-specific):

  • MicrosoftStore - Microsoft Store Commerce for Windows apps (MSIX)

Platform Compatibility:

  • All providers work with WPF, MSIX, Windows Forms, ASP.NET Core, Blazor, and console applications
  • Built on .NET 8.0 for maximum compatibility

Best Practices

1. Store credentials securely

// Use configuration or secrets manager
var stripeKey = configuration["Stripe:SecretKey"];
var gateway = new PaymentGateway().UseStripe(stripeKey);

2. Always validate webhooks

var webhookEvent = await gateway.ParseWebhookAsync(
    "Stripe",
    payload,
    headers // Includes signature for validation
);

if (!webhookEvent.IsValid)
{
    return BadRequest("Invalid signature");
}

3. Handle idempotency

var request = new PaymentRequest
{
    Reference = $"ORDER-{orderId}", // Use unique reference
    Amount = 100m,
    Currency = "USD"
};

4. Log raw provider responses

var result = await gateway.CreatePaymentAsync(request);

logger.LogInformation(
    "Payment result: {Status}, Raw: {RawData}",
    result.Status,
    JsonSerializer.Serialize(result.RawData)
);

License

MIT License - see LICENSE file for details

Contributing

Contributions welcome! Please open an issue or PR.

To add a new provider:

  1. Fork the repository
  2. Create a new provider project following the structure
  3. Add tests
  4. Submit a PR

Support

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.0.6 477 12/8/2025
0.0.5 453 12/8/2025
0.0.4 324 12/7/2025
0.0.1 243 12/7/2025