-
Notifications
You must be signed in to change notification settings - Fork 83
Gateways specific functions
Sina Soltani edited this page Nov 20, 2022
·
15 revisions
Here you can see the specific functions of each gateway.
Gateways:
Sample:
var result = _onlinePayment.Request(invoice =>
{
invoice
//other invoice info...
.SetMellatAdditionalData(...)
.SetGateway("Mellat")
// OR
.UseMellat();
});
Use the Invoice Builder to create an invoice and then use the AddMellatCumulativeAccount method for using Cumulative Dynamic Payment Request.
Sample:
var result = _onlinePayment.Request(invoice =>
{
invoice
//other info...
.SetAmount(50000)
.AddMellatCumulativeAccount(<SUB SERVICE ID>, <AMOUNT>);
.SetGateway("Mellat")
// OR
.UseMellat();
});
Note: Maximum 10 accounts can be added.
Note: By using the AddMellatCumulativeAccount
method, you don't need to specify the Mellat Gateway by using the UseGateway method. It will be done for you automatically.
Sample:
var result = _onlinePayment.Request(invoice =>
{
invoice
//other invoice info...
.SetParsianAdditionalData(new ParsianGatewayAdditionalDataRequest
{
AdditionalData = "",
Originator = ""
})
.SetGateway("Parsian")
// OR
.UseParsian();
});
.ConfigureGateways(gateways =>
{
gateways
.AddZarinPal()
.WithAccounts(accounts =>
{
accounts.AddInMemory(account =>
{
account.MerchantId = "<Your ID>";
account.IsSandbox = true | false;
});
});
})
Note: Set a random value for the MerchantId
such as test
if you want to work with the Sandbox option enabled.
var result = _onlinePayment.RequestAsync(invoice =>
{
invoice
// other invoice info
.SetZarinPalData("<Description>");
.SetGateway("ZarinPal")
// OR
.UseZarinPal();
})
var result = _onlinePayment.RequestAsync(invoice =>
{
invoice
.SetPayIrAdditionalData(...);
})
To get the FactorNumber, Mobile, Description and CardNumber do like so:
var verifyResult = await _onlinePayment.VerifyAsync(invoice);
var additionalData = verifyResult.GetPayIrAdditionalData();
To get the TraceNumber, DigitalReceipt, RRN and CardNumber do like so:
var verifyResult = await _onlinePayment.VerifyAsync(invoice);
var additionalData = verifyResult.GetSepehrAdditionalData();
var result = _onlinePayment.Request(invoice =>
{
invoice
.SetYekPayData(yekPay =>
{
// payment details go here...
})
.SetGateway("YekPay")
// OR
.UseYekPay();
});
var result = _onlinePayment.Request(invoice =>
{
invoice
.SetPayPingData(payPing =>
{
// optional
});
.SetGateway("PayPing")
// OR
.UsePayPing();
});
var result = _onlinePayment.Request(invoice =>
{
invoice
.SetZibalData(new ZibalRequest
{
// optional Zibal data
})
.SetGateway("Zibal")
// OR
.UseZibal();
});
var result = _onlinePayment.Request(invoice =>
{
invoice
.SetIdPayData(new ...
{
// optional data
})
.SetGateway("IdPay")
// OR
.UseIdPay();
});