Miden.Razor.SDK
1.0.12
dotnet add package Miden.Razor.SDK --version 1.0.12
NuGet\Install-Package Miden.Razor.SDK -Version 1.0.12
<PackageReference Include="Miden.Razor.SDK" Version="1.0.12" />
<PackageVersion Include="Miden.Razor.SDK" Version="1.0.12" />
<PackageReference Include="Miden.Razor.SDK" />
paket add Miden.Razor.SDK --version 1.0.12
#r "nuget: Miden.Razor.SDK, 1.0.12"
#:package Miden.Razor.SDK@1.0.12
#addin nuget:?package=Miden.Razor.SDK&version=1.0.12
#tool nuget:?package=Miden.Razor.SDK&version=1.0.12
Miden.Buzapay Razor Pages Payment Gateway SDK
A Razor Pages SDK for the Miden/Buzapay payment gateway. It ships:
- Typed API client wrappers (payment links, card auth, transfers, stable coins)
- AES encryption for card payloads
- Tag helpers + Razor partials + JS/CSS for full checkout UI (card, transfer, stable coin)
Target frameworks: .NET 8, 9, 10
Install
dotnet add package Miden.Razor.SDK
1. Configure Services
In Program.cs:
using Miden.Buzapay.Extensions;
using Miden.Buzapay.Options;
builder.Services.AddRazorPages();
builder.Services.AddMidenBuzapay(options =>
{
options.SecretKey = "your-secret-key";
options.Environment = MidenBuzapayEnvironment.Sandbox; // or Production
});
The Caller defaults to Miden. To use Buzapay instead:
builder.Services.AddMidenBuzapay(options =>
{
options.SecretKey = "your-buzapay-key";
options.Caller = MidenBuzapayCaller.Buzapay;
options.Environment = MidenBuzapayEnvironment.Sandbox;
});
Dual-caller (both Miden and Buzapay in one app)
Register the default config plus a named config for the second caller:
// Default — Miden (caller is set automatically)
builder.Services.AddMidenBuzapay(options =>
{
options.SecretKey = "your-miden-key";
options.Environment = MidenBuzapayEnvironment.Sandbox;
});
// Named — Buzapay (caller is set automatically from the enum)
builder.Services.AddMidenBuzapay(MidenBuzapayCaller.Buzapay, options =>
{
options.SecretKey = "your-buzapay-key";
options.Environment = MidenBuzapayEnvironment.Sandbox;
});
Then in your views, add config="Buzapay" to use the Buzapay config:
<miden-checkout-card config="Buzapay" merchant-name="Store" amount="60" ... />
Map endpoints and static files:
app.UseStaticFiles();
app.MapRazorPages();
app.MapMidenBuzapayEndpoints();
2. Register Tag Helpers
In Pages/_ViewImports.cshtml, add:
@addTagHelper *, Miden.Buzapay
3. Add Assets to Layout
In your _Layout.cshtml:
<head>
<miden-styles />
</head>
<body>
<miden-scripts />
</body>
4. Checkout Card
Drop a single tag wherever you want the full checkout form (card, bank transfer, stable coin):
<miden-checkout-card
merchant-name="Acme"
amount="2500"
currency="NGN"
email="buyer@acme.test"
phone-number="08012345678"
narration="Order #1045"
merchant-logo-url="/img/logo.png" />
That's it — SecretKey, Environment, and Caller are automatically pulled from the options you configured in Program.cs.
Card attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
config |
string | (default config) | Named config: "Miden" or "Buzapay" |
merchant-name |
string | "" |
Merchant display name |
amount |
decimal | 0 |
Payment amount |
currency |
string | "" |
Currency code (NGN, USD, etc.) |
email |
string | "" |
Buyer email |
phone-number |
string | "" |
Buyer phone |
narration |
string | "" |
Payment description |
redirect-url |
string | null |
Post-payment redirect URL |
logo-url |
string | null |
Logo URL sent to the gateway |
merchant-logo-url |
string | null |
Logo displayed in the checkout UI |
merchant-base-url |
string | from options | Override the 3DS redirect host |
show-stable-coin |
bool | true |
Show stable coin payment option |
caller |
enum | from options | Override caller per-tag |
environment |
enum | from options | Override environment per-tag |
secret-key |
string | from options | Override the secret key per-tag |
endpoint-base-path |
string | from options | Override the endpoint base path |
Programmatic usage
If you need to build the payment object dynamically (e.g. from a database), pass it via the payment attribute:
@{
var payment = new PaymentObject
{
MerchantName = order.StoreName,
Amount = order.Total,
Currency = order.Currency,
Email = order.CustomerEmail,
PhoneNumber = order.CustomerPhone,
Narration = $"Order #{order.Id}"
};
}
<miden-checkout-card payment="@payment" merchant-logo-url="/img/logo.png" />
5. Checkout Button
For a redirect or iframe checkout flow:
<miden-checkout-button
merchant-name="Acme"
amount="2500"
currency="NGN"
email="buyer@acme.test"
phone-number="08012345678"
narration="Order #1045"
redirect-url="https://your-site.test/checkout/complete" />
<miden-checkout-button
merchant-name="Acme"
amount="5000"
currency="NGN"
email="buyer@acme.test"
phone-number="08012345678"
narration="Order #1045"
redirect-url="https://your-site.test/checkout/complete"
mode="Iframe"
button-text="Pay Now"
css-class="btn btn-success btn-lg" />
Button attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
config |
string | (default config) | Named config: "Miden" or "Buzapay" |
mode |
enum | Redirect |
Redirect or Iframe |
button-text |
string | "Pay" |
Button label |
css-class |
string | null |
Additional CSS classes on the button |
iframe-height |
string | "560px" |
Iframe container height |
caller |
enum | from options | Override caller per-tag |
environment |
enum | from options | Override environment per-tag |
endpoint-base-path |
string | from options | Override the endpoint base path |
All payment attributes (merchant-name, amount, currency, email, phone-number, narration, redirect-url, logo-url) and the payment attribute work the same as the card tag helper.
JavaScript Events
Listen for payment lifecycle events on the checkout card element:
document.querySelector('[data-miden-checkout-card]')
.addEventListener('miden:payment-authorized', function(e) {
console.log(e.detail.paymentStatus); // "authorized" or "confirmed"
console.log(e.detail.paymentId);
console.log(e.detail.paymentDate);
console.log(e.detail.message);
});
| Event | Fired when |
|---|---|
miden:payment-authorized |
Payment succeeds (card, transfer, or stable coin) |
miden:payment-error |
Payment fails |
miden:payment-cancel |
User cancels the payment |
3DS (Secure Authentication)
3DS is handled automatically by the SDK — no extra pages or code needed.
- Miden caller: 3DS challenge renders in an inline iframe within the checkout card.
- Buzapay caller: the SDK redirects to its built-in
{EndpointBasePath}/checkout/three-ds-confirmendpoint, which renders the bank's 3DS page.
Alternative: Partial View Usage
If you prefer manual control, you can still use the Razor partials directly:
@using Miden.Buzapay.Models
@using Miden.Buzapay.Options
@using Microsoft.Extensions.Options
@inject IOptions<MidenBuzapayOptions> MidenOptions
@{
var checkout = new MidenCheckoutCardModel
{
Payment = new PaymentObject
{
MerchantName = "Acme",
Amount = 2500,
Currency = "NGN",
Email = "buyer@acme.test",
PhoneNumber = "08012345678",
Narration = "Order #1045"
},
MerchantLogoUrl = "/img/logo.png",
SecretKey = MidenOptions.Value.SecretKey
};
}
@await Html.PartialAsync("_MidenCheckoutCard", checkout)
When using partials, you must also add the assets manually in your layout:
<link rel="stylesheet" href="~/_content/Miden.Razor.SDK/miden-pg/miden-pg.css" />
<script src="~/_content/Miden.Razor.SDK/miden-pg/qrcode.js"></script>
<script src="~/_content/Miden.Razor.SDK/miden-pg/miden-pg.js" defer></script>
Notes
EndpointBasePathdefaults to/miden-buzapay. If you change it, pass the same value toMapMidenBuzapayEndpoints().- The UI keeps the secret key on the server — it calls your local
/miden-buzapayendpoints which forward to the gateway. - The
Callerdefaults toMiden. It controls the UI theme and API routing:Midenuses a dark theme with Miden branding,Buzapayuses a light theme with merchant branding. - The named overload
AddMidenBuzapay(MidenBuzapayCaller.Buzapay, ...)sets theCallerautomatically — you cannot mismatch caller and secret key.
| Product | Versions 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 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 is compatible. 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. |
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
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.0.12 | 190 | 3/23/2026 |
| 1.0.11 | 120 | 3/18/2026 |
| 1.0.10 | 137 | 3/17/2026 |
| 1.0.9 | 113 | 3/15/2026 |
| 1.0.8 | 116 | 3/5/2026 |
| 1.0.7 | 115 | 3/3/2026 |
| 1.0.6 | 123 | 3/3/2026 |
| 1.0.5 | 116 | 3/2/2026 |
| 1.0.4 | 121 | 2/27/2026 |
| 1.0.3-beta | 117 | 2/24/2026 |
| 1.0.2-beta | 116 | 2/19/2026 |
| 1.0.1-beta | 124 | 1/22/2026 |
| 1.0.0-beta | 201 | 10/7/2025 |