CrayFi.Sdk 1.1.0

dotnet add package CrayFi.Sdk --version 1.1.0
                    
NuGet\Install-Package CrayFi.Sdk -Version 1.1.0
                    
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="CrayFi.Sdk" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CrayFi.Sdk" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="CrayFi.Sdk" />
                    
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 CrayFi.Sdk --version 1.1.0
                    
#r "nuget: CrayFi.Sdk, 1.1.0"
                    
#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 CrayFi.Sdk@1.1.0
                    
#: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=CrayFi.Sdk&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=CrayFi.Sdk&version=1.1.0
                    
Install as a Cake Tool

Cray Finance .NET SDK

Official .NET SDK for Cray Finance APIs. This library targets .NET Standard 2.0, making it compatible with .NET Core 2.0+, .NET Framework 4.6.1+, and modern .NET 5/6/7/8 applications.

Requirements

  • .NET Standard 2.0 compatible runtime
    • .NET Core 2.0+
    • .NET Framework 4.6.1+
    • .NET 5+

Installation

(Assuming the package is published to NuGet)

dotnet add package CrayFi.Sdk

Usage

Initialization

using Cray;
using System;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        // Initialize with Base URL and API Key
        // Base URL: The API endpoint (e.g., "https://pay.connectramp.com/")
        // Token: Your secret API key
        var client = new CrayClient("https://pay.connectramp.com/", "your-api-key");

        // Example: Initiate a card transaction
        try 
        {
            var result = await client.Cards.Initiate(new 
            {
                reference = "unique-ref-123",
                amount = 1000,
                currency = "NGN",
                email = "customer@example.com",
                card_data = new {
                    pan = "539983...",
                    cvv = "123",
                    expiryMonth = "12",
                    expiryYear = "25"
                }
            });
            Console.WriteLine(result);
        }
        catch (Exception ex)
        {
            Console.WriteLine($"Error: {ex.Message}");
        }
    }
}

Modules

Cards
// Initiate a card transaction
var initiateResponse = await client.Cards.Initiate(new 
{
    reference = "ref-123",
    amount = 1000,
    currency = "NGN",
    card_data = new { /* ... */ }
});

// Charge
var chargeResponse = await client.Cards.Charge(new { transaction_id = "trans-id" });

// Query
var statusResponse = await client.Cards.Query("customer-ref-123");
MoMo (Mobile Money)
// Initiate Mobile Money Payment
var momoResponse = await client.MoMo.Initiate(new 
{
    amount = 500,
    phone_no = "2348012345678",
    provider = "MTN",
    currency = "NGN"
});

// Requery
var momoStatus = await client.MoMo.Requery("customer-ref-123");
Wallets
// Get Wallet Balance
// Returns all Cray accounts/wallets and their respective balances
var balances = await client.Wallets.Balance();

// Get Subaccounts
// Returns list of all subaccounts
var subaccounts = await client.Wallets.Subaccounts();
FX (Foreign Exchange)
// Get Specific Exchange Rate
var rate = await client.FX.Rate(new { source_currency = "USD", destination_currency = "NGN" });

// Get Rates by Destination
var rates = await client.FX.RatesByDestination(new { destination_currency = "NGN" });

// Generate Quote
var quote = await client.FX.Quote(new 
{ 
    source_currency = "NGN", 
    destination_currency = "USD", 
    source_amount = 1500 
});

// Execute Conversion
var conversion = await client.FX.Convert(new { quote_id = "quote:..." });

// History
var history = await client.FX.History();
Payouts
// Get Payment Methods
var methods = await client.Payouts.PaymentMethods("GH");

// Get Banks
var banks = await client.Payouts.Banks("GH");

// Validate Account
var accountInfo = await client.Payouts.ValidateAccount(new 
{ 
    account_number = "0123456789", 
    bank_code = "058",
    country_code = "GH" 
});

// Process Transfer (Disburse)
var transfer = await client.Payouts.Disburse(new 
{
    amount = "5000",
    account_number = "1234567890",
    bank_code = "058",
    currency = "NGN",
    customer_reference = "ref-123"
});

// Verify Transaction
var status = await client.Payouts.Verify("transaction-id");
Crypto Payouts
// Get supported crypto payout assets
var assets = await client.CryptoPayouts.SupportedAssets();

// Add a wallet beneficiary
var beneficiary = await client.CryptoPayouts.AddBeneficiary(new
{
    name = "OMU",
    asset = "TRX_USDT_S2UZ",
    wallet_address = "wallet_address"
});

// Initiate a crypto payout
var payout = await client.CryptoPayouts.InitiatePayout(new
{
    amount = "2",
    currency = "TRX_USDT_S2UZ",
    address_reference = "beneficiary_reference",
    customer_reference = "customer_ref_123",
    narration = "Stablecoin payout"
});
Refunds
// Initiate Refund
var refund = await client.Refunds.Initiate(new
{
    pan = "4696...",
    subaccount_id = "...",
    amount = "100" // Optional for full refund
});

// Query Refund
var refundStatus = await client.Refunds.Query("refund-ref");
Failed Payout Webhooks
// List failed payout webhooks
var failed = await client.Webhooks.FailedPayoutWebhooks();

// Retry a failed payout webhook
var retry = await client.Webhooks.RetryFailedPayoutWebhook("50");
Virtual Accounts
// Create a virtual account
var va = await client.VirtualAccounts.Create(new
{
    bvn = "22192474887",
    type = "Corporate",              // "Corporate" or "Individual"
    nin = "11111122221",
    virtual_account_type = "Permanent", // "Permanent" or "Onetime"
    account_name = "BOlaOla",
    rc_number = "99988828822",      // Required for Corporate type
    currency = "NGN",
    reference = "cbf0d060-1544-4a53-a00b-7cb75a3eb59d",
    customer_email = "hello@gmail.com",
    provider = "monnify"
});

// Initiate a virtual account request (pre-create step)
var initiated = await client.VirtualAccounts.Initiate(new
{
    provider = "wema",
    bvn = "22192474887"
});

// List all virtual accounts for the merchant
var list = await client.VirtualAccounts.List();

// Get available virtual account providers
var providers = await client.VirtualAccounts.Providers();

// Submit OTP to generate the Wema wallet
var result = await client.VirtualAccounts.GenerateWallet(new
{
    otp = "768238",
    customer_email = "hello@gmail.com"
});

Error Handling

The SDK throws custom exceptions for different error scenarios:

  • AuthenticationException: Invalid API key or unauthorized access.
  • ValidationException: Invalid parameters or data.
  • RequestException: API returned an error status code.
  • CrayException: General SDK errors.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
1.1.0 121 7/2/2026
1.0.4 126 2/22/2026
1.0.3 122 2/21/2026
1.0.2 119 2/20/2026
1.0.1 126 2/18/2026
1.0.0 128 1/27/2026