Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ImanX/zarinpal-dotNet
ZarinPal .NET SDK Payment
https://github.com/ImanX/zarinpal-dotNet
csharp dotnet payment-gateway zarinpal
Last synced: about 2 months ago
JSON representation
ZarinPal .NET SDK Payment
- Host: GitHub
- URL: https://github.com/ImanX/zarinpal-dotNet
- Owner: ImanX
- Created: 2019-01-22T09:20:57.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T06:23:18.000Z (about 2 years ago)
- Last Synced: 2024-11-11T10:31:22.331Z (2 months ago)
- Topics: csharp, dotnet, payment-gateway, zarinpal
- Language: C#
- Size: 86.9 KB
- Stars: 5
- Watchers: 3
- Forks: 4
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-dotnet - zarinpal-dotNet - ZarinPal .NET SDK Payment (Libraries, Frameworks and Tools / E-Commerce and Payments)
README
# ZarinPal .NET SDK
### Getting Started
Open your project and go to `nuget` then search `Zarinpal` when found it install library.### Requirement
4.5.1 .NET framework is Require### Example in Payment Request Page:
```C#
ZarinPal.ZarinPal zarinpal = ZarinPal.ZarinPal.Get();String MerchantID = "71c705f8-bd37-11e6-aa0c-000c295eb8fc";
String CallbackURL = "http://localhost:59701/VerficationPage.aspx";
long Amount = 100;
String Description = "This is Test Payment";ZarinPal.PaymentRequest pr = new ZarinPal.PaymentRequest(MerchantID, Amount, CallbackURL, Description);
zarinpal.EnableSandboxMode();
var res = zarinpal.InvokePaymentRequest(pr);
if (res.Status == 100) {
Response.Redirect(res.PaymentURL);
}
```### Example in Payment Verification Page:
```C#
var collection = HttpUtility.ParseQueryString(this.ClientQueryString);
String Status = collection["Status"];if (Status != "OK")
{
Response.Write("alert('Purchase unsuccessfully')");
return;
}var zarinpal = ZarinPal.ZarinPal.Get();
String Authority = collection["Authority"];
String MerchantID = "71c705f8-bd37-11e6-aa0c-000c295eb8fc";
long Amount = 100;var pv = new ZarinPal.PaymentVerification(MerchantID, Amount, Authority);
var verificationResponse = zarinpal.InvokePaymentVerification(pv);
if (verificationResponse.Status == 100)
{
Response.Write(String.Format("alert('Purchase successfully with ref transaction {0}')", verificationResponse.RefID));
}
else {Response.Write(String.Format("alert('Purchase unsuccessfully Error code is: {0}')",verificationResponse.Status));
}
```