Skip to main content
Version: 4.0

Mellat

The Mellat gateway is included in the Parbad package.

Configuration​

builder.Services.AddParbad()
.ConfigureGateways(gateways =>
{
gateways
.AddMellat()
.WithAccounts(accounts =>
{
accounts.AddInMemory(account =>
{
account.TerminalId = 1234567;
account.UserName = "<Your username>";
account.UserPassword = "<Your password>";
});
});
})
// ...

Payment request​

var result = await onlinePayment.RequestAsync(invoice =>
{
invoice
.SetAmount(amount)
.SetCallbackUrl(callbackUrl)
.UseAutoIncrementTrackingNumber()
.SetMellatAdditionalData(new MellatGatewayAdditionalDataRequest
{
// Optional: additional data, payer ID, mobile number
})
.UseMellat();
});

Cumulative payment​

A cumulative payment splits the amount between the sub-services of your Mellat account:

invoice
.AddMellatCumulativeAccount(subServiceId: 1, amount: 150_000)
.AddMellatCumulativeAccount(subServiceId: 2, amount: 100_000)
.UseMellat();

AddMellatCumulativeAccount also has an overload with a payer ID, and AddMellatCumulativeAccounts adds several accounts at once.