Skip to content

Latest commit

 

History

History

WebApplication

Steps to build

Here are the minimum changes you need to made.

  1. Add configurations

Open file appsettings.json and put your configs there.

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "AllowedHosts": "*",
  "ZarinpalConfiguration": {
    "Token": "1344b5d4-0048-11e8-94db-005056a205be",
    "CallbackUrl": "http://yoursite.com/verify"
  }
}

I mean ZarinpalConfiguration part.

  1. Add ZarinClient to IServiceCollection

services.AddZarinClient(Configuration.GetZarinpalConfiguration());

You need ZarinpalSharp.Asp. otherwise you should add it your self and it's not that hard! See AspExtensions.cs

  1. Use it

Use IZarinClient in your controller to request payments and verify them.

See PaymentsController