C# / .NET
Official server-side SDK (Wajub) for .NET 8+ — payments, payouts, webhooks, and the full merchant API.
C# / .NET is Wajub's official server-side SDK for ASP.NET Core, minimal APIs, and any .NET 8+ backend. It is published as the Wajub package on NuGet.
Use it with your API key (pk_… / sk_… / rk_…, including test variants). Pair it with @wajub/js in the browser.
Browser vs server
@wajub/js runs in the browser with publishable keys.
Wajub runs on the server — pass any merchant API key
(pk., sk., rk.) and use webhook verification for inbound
events. Never expose sk. keys to the client.
Install
dotnet add package WajubRequires .NET 8+. Uses HttpClient and System.Text.Json (included in the runtime).
Quick start
using Wajub;
var client = WajubClient.Create(new WajubConfig
{
ApiKey = Environment.GetEnvironmentVariable("WAJUB_SECRET_KEY"),
});
var payment = await client.Payments.CreateAsync(new Dictionary<string, object?>
{
["amount"] = 15000,
["currency"] = "XAF",
["email"] = "buyer@example.com",
["callback"] = "https://shop.example.com/order/complete",
});
Console.WriteLine(payment.AuthorizationUrl);Configuration
| Option | Description |
|---|---|
ApiKey | Merchant API key (pk.… / sk.… / rk.…, test or live) |
WebhookSecret | Signing secret (whsec_…) for Webhooks.ConstructEvent() |
IdempotencyKeyPrefix | Prefix for auto-generated Idempotency-Key headers |
HttpClient | Custom HttpClient (timeouts, handlers) |
The API base URL is fixed at https://api.wajub.com. Test mode is selected by your API key (sk_test.…), not by the URL.
Pass configuration explicitly via WajubConfig:
var client = WajubClient.Create(new WajubConfig
{
ApiKey = Environment.GetEnvironmentVariable("WAJUB_API_KEY"),
WebhookSecret = Environment.GetEnvironmentVariable("WAJUB_WEBHOOK_SECRET"),
});Resources
| Service | Methods |
|---|---|
client.Global | PingAsync, ChannelsAsync, CountriesAsync, CurrenciesAsync |
client.Payments | CreateAsync, InitializeAsync, RetrieveAsync, ListAsync, CancelAsync, ProcessAsync, ProcessSplitAsync, ListRefundsAsync |
client.Customers | CRUD + BlockAsync, UnblockAsync, ActivateAsync, DeactivateAsync, tax IDs |
client.Refunds | CRUD + list |
client.Transfers | CRUD + list |
client.Beneficiaries | CRUD + list |
client.Links | CRUD + list |
client.Invoices | CRUD + SendAsync, MarkPaidAsync, CancelAsync |
client.Accounts | CRUD + RegenerateTokenAsync |
client.WebhookEndpoints | CRUD + RotateSecretAsync |
client.Balance | RetrieveAsync |
client.Events | ListAsync, RetrieveAsync, ResendAsync |
client.Disputes | ListAsync, RetrieveAsync, SubmitEvidenceAsync, AcceptAsync, CloseAsync, SendMessageAsync |
client.Identity | ResolveAsync, ValidateAsync |
client.Tax | settings, rates, calculate, reports, codes, registrations |
client.Shield | settings, stats, blocklist |
client.Listen | ConfigAsync, AuthAsync |
client.Webhooks | ConstructEvent |
Webhooks (ASP.NET Core)
var eventPayload = client.Webhooks.ConstructEvent(
bodyBytes,
Request.Headers["X-Wajub-Signature"],
Request.Headers["X-Wajub-Timestamp"]);
// Handle payment.succeeded, transfer.succeeded, etc.Sync (Connect)
await client.Payments.CreateAsync(parameters, new RequestOptions { Sync = "acct_sync_ref" });Was this page helpful?