Embedly.SDK
1.0.7
dotnet add package Embedly.SDK --version 1.0.7
NuGet\Install-Package Embedly.SDK -Version 1.0.7
<PackageReference Include="Embedly.SDK" Version="1.0.7" />
<PackageVersion Include="Embedly.SDK" Version="1.0.7" />
<PackageReference Include="Embedly.SDK" />
paket add Embedly.SDK --version 1.0.7
#r "nuget: Embedly.SDK, 1.0.7"
#:package Embedly.SDK@1.0.7
#addin nuget:?package=Embedly.SDK&version=1.0.7
#tool nuget:?package=Embedly.SDK&version=1.0.7
Embedly.SDK - Official .NET SDK for Embedly.ng
The official .NET SDK for Embedly.ng - Nigeria's leading embedded finance platform. This SDK provides comprehensive access to wallet management, payments, cards, and financial services APIs.
Features
- 🏦 Complete API Coverage - Full access to all Embedly.ng services
- 🚀 Async/Await Support - Modern asynchronous programming patterns
- 🔒 Type Safety - Strongly typed models and responses
- 🔧 Dependency Injection - Native DI container integration
- 📊 Logging & Monitoring - Built-in request/response logging
- 🔄 Retry Policies - Automatic retry with exponential backoff
- 🌍 Multi-Environment - Staging and production environment support
- 💳 Nigerian Market Focus - NIN/BVN KYC, Naira currency support
Installation
Install the SDK via NuGet Package Manager:
dotnet add package Embedly.SDK
Or via Package Manager Console:
Install-Package Embedly.SDK
Quick Start
1. Configure Services (ASP.NET Core)
using Embedly.SDK.Extensions;
var builder = WebApplication.CreateBuilder(args);
// Add Embedly SDK services
builder.Services.AddEmbedly(options =>
{
options.ApiKey = "your-api-key";
options.Environment = EmbedlyEnvironment.Staging; // or Production
});
// Or configure from appsettings.json
builder.Services.AddEmbedly(builder.Configuration.GetSection("Embedly"));
var app = builder.Build();
2. Configuration (appsettings.json)
{
"Embedly": {
"ApiKey": "your-api-key-here",
"Environment": "Staging",
"Timeout": "00:00:30",
"RetryCount": 3,
"EnableLogging": true
}
}
3. Use in Your Application
using Embedly.SDK;
using Embedly.SDK.Models.Requests.Customers;
public class CustomerController : ControllerBase
{
private readonly IEmbedlyClient _embedlyClient;
public CustomerController(IEmbedlyClient embedlyClient)
{
_embedlyClient = embedlyClient;
}
[HttpPost("customers")]
public async Task<IActionResult> CreateCustomer([FromBody] CreateCustomerRequest request)
{
try
{
var customer = await _embedlyClient.Customers.CreateAsync(request);
return Ok(customer);
}
catch (EmbedlyApiException ex)
{
return BadRequest(new { error = ex.Message });
}
}
}
Available Services
Customer Management
// Create a customer
var customer = await embedlyClient.Customers.CreateAsync(new CreateCustomerRequest
{
FirstName = "John",
LastName = "Doe",
Email = "john.doe@example.com",
PhoneNumber = "+2348012345678",
DateOfBirth = new DateTime(1990, 1, 15)
});
// Get customer by ID
var customer = await embedlyClient.Customers.GetByIdAsync("customer-id");
// Update customer name
var updatedCustomer = await embedlyClient.Customers.UpdateNameAsync(
"customer-id", "Jane", "Smith");
// KYC upgrade using NIN
var kycResult = await embedlyClient.Customers.UpgradeKycWithNinAsync(new NinKycUpgradeRequest
{
CustomerId = "customer-id",
Nin = "12345678901",
DateOfBirth = new DateTime(1990, 1, 15)
});
Wallet Operations (Coming Soon)
// Create wallet
var wallet = await embedlyClient.Wallets.CreateAsync(new CreateWalletRequest
{
CustomerId = "customer-id",
Currency = "NGN"
});
// Transfer between wallets
var transfer = await embedlyClient.Wallets.TransferAsync(new WalletTransferRequest
{
FromWalletId = "wallet-1",
ToWalletId = "wallet-2",
Amount = Money.FromNaira(1000.00m)
});
Error Handling
The SDK provides comprehensive error handling with specific exception types:
try
{
var customer = await embedlyClient.Customers.GetByIdAsync("invalid-id");
}
catch (EmbedlyApiException ex) when (ex.StatusCode == HttpStatusCode.NotFound)
{
// Handle not found
Console.WriteLine($"Customer not found: {ex.Message}");
}
catch (EmbedlyApiException ex) when (ex.StatusCode == HttpStatusCode.Unauthorized)
{
// Handle authentication error
Console.WriteLine("Invalid API key");
}
catch (EmbedlyValidationException ex)
{
// Handle validation errors
foreach (var error in ex.ValidationErrors)
{
Console.WriteLine($"{error.PropertyName}: {error.ErrorMessage}");
}
}
catch (EmbedlyException ex)
{
// Handle general SDK errors
Console.WriteLine($"SDK Error: {ex.Message}");
}
Money and Currency
The SDK includes a robust Money
type for handling Nigerian Naira:
// Create money amounts
var amount1 = Money.FromNaira(1000.50m); // ₦1,000.50
var amount2 = Money.FromKobo(150000); // ₦1,500.00 (150000 kobo)
// Arithmetic operations
var total = amount1 + amount2; // ₦2,500.50
var half = total / 2; // ₦1,250.25
// Display formatting
Console.WriteLine(total.ToString()); // ₦2,500.50
Webhook Handling (Coming Soon)
// In your webhook controller
[HttpPost("webhooks/embedly")]
public async Task<IActionResult> HandleWebhook()
{
var signature = Request.Headers["x-embedly-signature"];
var payload = await ReadBodyAsync();
var result = await _webhookProcessor.ProcessWebhookAsync(payload, signature);
return result.Success ? Ok() : BadRequest();
}
Advanced Configuration
Custom HTTP Client Configuration
services.AddEmbedly(options =>
{
options.ApiKey = "your-api-key";
options.Environment = EmbedlyEnvironment.Production;
options.Timeout = TimeSpan.FromSeconds(60);
options.RetryCount = 5;
options.EnableLogging = true;
options.LogRequestBodies = false; // For security
});
Custom Service URLs
services.AddEmbedly(options =>
{
options.ApiKey = "your-api-key";
options.CustomServiceUrls = new ServiceUrls
{
Base = "https://custom-api.yourdomain.com/v1",
Payout = "https://custom-payout.yourdomain.com",
// ... other URLs
};
});
Requirements
- .NET 6.0, 7.0, 8.0, or 9.0
- An Embedly.ng API key (Get one here)
Contributing
Contributions are welcome! Please read our Contributing Guide for details.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
Built with ❤️ for the Nigerian fintech ecosystem.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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 is compatible. 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 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 is compatible. 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. |
-
net6.0
- FluentValidation (>= 11.9.2)
- Microsoft.Extensions.Http (>= 8.0.0)
- Microsoft.Extensions.Http.Polly (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Polly (>= 8.6.3)
- Polly.Extensions.Http (>= 3.0.0)
-
net7.0
- FluentValidation (>= 11.9.2)
- Microsoft.Extensions.Http (>= 8.0.0)
- Microsoft.Extensions.Http.Polly (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Polly (>= 8.6.3)
- Polly.Extensions.Http (>= 3.0.0)
-
net8.0
- FluentValidation (>= 11.9.2)
- Microsoft.Extensions.Http (>= 8.0.0)
- Microsoft.Extensions.Http.Polly (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Polly (>= 8.6.3)
- Polly.Extensions.Http (>= 3.0.0)
-
net9.0
- FluentValidation (>= 11.9.2)
- Microsoft.Extensions.Http (>= 8.0.0)
- Microsoft.Extensions.Http.Polly (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Polly (>= 8.6.3)
- Polly.Extensions.Http (>= 3.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.