Zarinpal 3.0.1
dotnet add package Zarinpal --version 3.0.1
NuGet\Install-Package Zarinpal -Version 3.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Zarinpal" Version="3.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Zarinpal --version 3.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Zarinpal, 3.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Zarinpal as a Cake Addin #addin nuget:?package=Zarinpal&version=3.0.1 // Install Zarinpal as a Cake Tool #tool nuget:?package=Zarinpal&version=3.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
public class HomeController : Controller { private readonly Payment _payment; private readonly Authority _authority; private readonly Transactions _transactions;
public HomeController()
{
var expose = new Expose();
_payment = expose.CreatePayment();
_authority = expose.CreateAuthority();
_transactions = expose.CreateTransactions();
}
public async Task<IActionResult> Index()
{
return View();
}
/// <summary>
/// ﻓﺮﺍﻳﻨﺪ ﺧﺮﻳﺪ
/// </summary>
/// <returns></returns>
public async Task<IActionResult> Request()
{
var result = await _payment.Request(new DtoRequest()
{
Mobile = "09121112222",
CallbackUrl = "https://localhost:44310/home/validate",
Description = "توضیحات",
Email = "farazmaan@outlook.com",
Amount = 1000000,
MerchantId = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
}, ZarinPal.Class.Payment.Mode.sandbox);
return Redirect($"https://sandbox.zarinpal.com/pg/StartPay/{result.Authority}");
}
/// <summary>
/// ﻓﺮﺍﻳﻨﺪ ﺧﺮﻳﺪ ﺑﺎ ﺗﺴﻮﻳﻪ ﺍﺷﺘﺮﺍﻛﻲ
/// </summary>
/// <returns></returns>
public async Task<IActionResult> RequestWithExtra()
{
var result = await _payment.Request(new DtoRequestWithExtra()
{
Mobile = "09121112222",
CallbackUrl = "https://localhost:44310/home/validate",
Description = "توضیحات",
Email = "farazmaan@outlook.com",
Amount = 1000000,
MerchantId = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
AdditionalData = "{\"Wages\":{\"zp.1.1\":{\"Amount\":120,\"Description\":\" ﺗﻘﺴﻴﻢ \"}, \" ﺳﻮﺩ ﺗﺮﺍﻛﻨﺶ zp.2.5\":{\"Amount\":60,\"Description\":\" ﻭﺍﺭﻳﺰ \"}}} "
}, ZarinPal.Class.Payment.Mode.sandbox);
return Redirect($"https://sandbox.zarinpal.com/pg/StartPay/{result.Authority}");
}
/// <summary>
/// اعتبار سنجی خرید
/// </summary>
/// <param name="authority"></param>
/// <param name="status"></param>
/// <returns></returns>
public async Task<IActionResult> Validate(string authority, string status)
{
var verification = await _payment.Verification(new DtoVerification
{
Amount = 1000000,
MerchantId = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
Authority = authority
}, Payment.Mode.sandbox);
return View();
}
/// <summary>
/// ﺩﺭ ﺭﻭﺵ ﺍﻳﺠﺎﺩ ﺷﻨﺎﺳﻪ ﭘﺮﺩﺍﺧﺖ ﺑﺎ ﻃﻮﻝ ﻋﻤﺮ ﺑﺎﻻ ﻣﻤﻜﻦ ﺍﺳﺖ ﺣﺎﻟﺘﻲ ﭘﻴﺶ ﺁﻳﺪ ﻛﻪ ﺷﻤﺎ ﺑﻪ ﺗﻤﺪﻳﺪ ﺑﻴﺸﺘﺮ ﻃﻮﻝ ﻋﻤﺮ ﻳﻚ ﺷﻨﺎﺳﻪ ﭘﺮﺩﺍﺧﺖ ﻧﻴﺎﺯ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻴﺪ
/// ﺩﺭ ﺍﻳﻦ ﺻﻮﺭﺕ ﻣﻲ ﺗﻮﺍﻧﻴﺪ ﺍﺯ ﻣﺘﺪ زیر ﺍﺳﺘﻔﺎﺩﻩ ﻧﻤﺎﻳﻴﺪ
/// </summary>
/// <returns></returns>
public async Task<IActionResult> RefreshAuthority()
{
var refresh = await _authority.Refresh(new DtoRefreshAuthority
{
Authority = "",
ExpireIn = 1,
MerchantId = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
}, Payment.Mode.sandbox);
return View();
}
/// <summary>
/// ﻣﻤﻜﻦ ﺍﺳﺖ ﺷﻤﺎ ﻧﻴﺎﺯ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻴﺪ ﻛﻪ ﻣﺘﻮﺟﻪ ﺷﻮﻳﺪ ﭼﻪ ﭘﺮﺩﺍﺧﺖ ﻫﺎﻱ ﺗﻮﺳﻂ ﻭﺏ ﺳﺮﻭﻳﺲ ﺷﻤﺎ ﺑﻪ ﺩﺭﺳﺘﻲ ﺍﻧﺠﺎﻡ ﺷﺪﻩ ﺍﻣﺎ ﻣﺘﺪ ﺭﻭﻱ ﺁﻧﻬﺎ ﺍﻋﻤﺎﻝ ﻧﺸﺪﻩ
/// ، ﺑﻪ ﻋﺒﺎﺭﺕ ﺩﻳﮕﺮ ﺍﻳﻦ ﻣﺘﺪ ﻟﻴﺴﺖ ﭘﺮﺩﺍﺧﺖ ﻫﺎﻱ ﻣﻮﻓﻘﻲ ﻛﻪ ﺷﻤﺎ ﺁﻧﻬﺎ ﺭﺍ ﺗﺼﺪﻳﻖ ﻧﻜﺮﺩﻩ ﺍﻳﺪ ﺭﺍ ﺑﻪ PaymentVerification ﺷﻤﺎ ﻧﻤﺎﻳﺶ ﻣﻲ ﺩﻫﺪ.
/// </summary>
/// <returns></returns>
public async Task<IActionResult> Unverified()
{
var refresh = await _transactions.GetUnverified(new DtoMerchant
{
MerchantId = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
}, Payment.Mode.sandbox);
return View();
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 was computed. 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. |
.NET Core | netcoreapp2.2 is compatible. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has 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.