Spare.NET.Sdk 1.3.2

.NET 6.0 .NET Core 3.1 .NET Standard 2.0 .NET Framework 4.5.2
dotnet add package Spare.NET.Sdk --version 1.3.2
NuGet\Install-Package Spare.NET.Sdk -Version 1.3.2
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="Spare.NET.Sdk" Version="1.3.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Spare.NET.Sdk --version 1.3.2
#r "nuget: Spare.NET.Sdk, 1.3.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Spare.NET.Sdk as a Cake Addin
#addin nuget:?package=Spare.NET.Sdk&version=1.3.2

// Install Spare.NET.Sdk as a Cake Tool
#tool nuget:?package=Spare.NET.Sdk&version=1.3.2

sdk-csharp

Usage

I- Download nuget package
<PackageReference Include="Spare.NET.Sdk" Version="1.3.2" />
II- To Generate ECC key pair
 class Program
{
    static void Main(string[] args)
    {
        var eccKeyPair = SpCrypto.GenerateKeyPair();
            
        Console.WriteLine($"Private key \n{eccKeyPair.PrivateKey}");
        Console.WriteLine("\n\n");
        Console.WriteLine($"Public key \n{eccKeyPair.PublicKey}");
    }
}
II- To create a domestic payment
public class TestController : Controller
    {
        private readonly ISpPaymentClient _client_;

        // Business ECC private key
        private readonly PrivateKey = "Your ecc private key";

        // Spare ECC public key
        private readonly ServerPublicKey = "Server ecc public key";

        public TestController()
        {
            var options = new SpPaymentClientOptions
            {
                ApiKey = "Your API key",
                AppId = "Your app id",
                BaseUrl = new Uri("https://payment.tryspare.com");
            };
            
            _client = new SpPaymentClient(options);
        }
        
        // GET
        public async Task<IActionResult> Index()
        {
            // Initialize payment
             var payment = new SpDomesticPaymentRequest
            {
                Amount = 10m,
                Description = "Payment description"
            };

            // Sign the payment
            var signature = SpEccSignatureManager.Sign(payment, PrivateKey);

            // Create payment
            var createPayment =  await _paymentClient.CreateDomesticPayment(payment,signature);

           // To verify signature of the created payment 
           if(SpEccSignatureManager.Verify(createPayment.PaymentResponse, createPayment.Signature, ServerPublicKey)){
               // signature verified
           }
        }
    }
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net452 net46 net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.2 138 12/3/2022
1.3.1 142 11/24/2022
1.3.0 140 11/24/2022
1.2.4 230 7/27/2022
1.2.3 218 7/27/2022
1.2.2 228 7/23/2022
1.2.1 225 7/23/2022
1.2.0 209 7/23/2022
1.0.1 1,703 11/26/2021
1.0.0 1,725 11/23/2021