{"id":24488400,"url":"https://github.com/salman-basmechi/zarinpal-driver","last_synced_at":"2025-07-27T01:09:26.921Z","repository":{"id":38130404,"uuid":"281192964","full_name":"salman-basmechi/zarinpal-driver","owner":"salman-basmechi","description":"ZarinPal payment gateway driver in c#","archived":false,"fork":false,"pushed_at":"2022-06-23T06:45:23.000Z","size":41,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-15T07:36:49.294Z","etag":null,"topics":["csharp","zarinpal","zarinpal-driver","zarinpal-gateway","zarinpal-payment-service"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/salman-basmechi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-20T18:15:17.000Z","updated_at":"2022-06-23T06:45:18.000Z","dependencies_parsed_at":"2022-09-17T20:00:19.420Z","dependency_job_id":null,"html_url":"https://github.com/salman-basmechi/zarinpal-driver","commit_stats":null,"previous_names":["salmanbasmechi/zarinpaldriver"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/salman-basmechi/zarinpal-driver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salman-basmechi%2Fzarinpal-driver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salman-basmechi%2Fzarinpal-driver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salman-basmechi%2Fzarinpal-driver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salman-basmechi%2Fzarinpal-driver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/salman-basmechi","download_url":"https://codeload.github.com/salman-basmechi/zarinpal-driver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salman-basmechi%2Fzarinpal-driver/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267279164,"owners_count":24063307,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","zarinpal","zarinpal-driver","zarinpal-gateway","zarinpal-payment-service"],"created_at":"2025-01-21T16:19:25.234Z","updated_at":"2025-07-27T01:09:26.899Z","avatar_url":"https://github.com/salman-basmechi.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ZarinPal Driver\nZarinPal payment gateway driver in c#\n\nYou can get the latest stable release from the [nuget.org](http://www.nuget.org/packages/zarinpaldriver) or from [github releases page](https://github.com/salmanbasmechi/zarinpaldriver/releases).\n\nGetting Started\n---------------\n\n```C#\nusing ZarinPalDriver;\n```\n\n```C#\npublic void ConfigureServices(IServiceCollection services)\n{\n    services.AddZarinPalDriver();\n}\n```\n\n```C#\nusing Microsoft.AspNetCore.Mvc;\nusing System.Threading.Tasks;\nusing ZarinPalDriver;\nusing ZarinPalDriver.Models;\n\nnamespace WebApi.Controllers\n{\n    [Route(\"api/[controller]\")]\n    [ApiController]\n    public class ProductController : ControllerBase\n    {\n        [HttpPost]\n        public async Task\u003cIActionResult\u003e PurchaseRequest([FromServices] IZarinPalClient client)\n        {\n            var mode = Mode.SandBox;\n\n            var request = new PaymentRequest\n            {\n                MerchantId = \"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\",\n                Amount = 1000,\n                Email = \"salmanbasmechi@gmail.com\",\n                Mobile = \"09129335607\",\n                Description = \"Test Payment\",\n                CallbackUrl = \"http://localhost:5000/api/product/completepurchase\",\n                Mode = mode\n            };\n\n            var response = await client.SendAsync(request);\n\n            if(response.Status != Status.Success)\n            {\n                return BadRequest();\n            }\n\n            return Redirect(response.GatewayUri.AbsoluteUri);\n        }\n\n        [HttpPost, HttpGet]\n        public async Task\u003cIActionResult\u003e CompletePurchase([FromServices] IZarinPalClient client)\n        {\n            var mode = Mode.SandBox;\n\n            string status = Request.Query[\"status\"];\n            string authority = Request.Query[\"authority\"];\n\n            if (string.IsNullOrEmpty(status) || string.IsNullOrEmpty(authority) || status.ToLower() != \"ok\")\n            {\n                return BadRequest();\n            }\n\n            var request = new VerificationRequest\n            {\n                MerchantId = \"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\",\n                Amount = 1000,\n                Authority = authority,\n                Mode = mode\n            };\n\n            var response = await client.SendAsync(request);\n\n            if (response.Status != Status.Success)\n            {\n                return BadRequest($\"Payment with reference id '{response.ReferenceId}' failed.\");\n            }\n\n            return Ok(response.ReferenceId);\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalman-basmechi%2Fzarinpal-driver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsalman-basmechi%2Fzarinpal-driver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalman-basmechi%2Fzarinpal-driver/lists"}