Spare.NET.Sdk
1.3.0
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Core 3.1
This package targets .NET Core 3.1. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
.NET Framework 4.5.2
This package targets .NET Framework 4.5.2. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Spare.NET.Sdk --version 1.3.0
NuGet\Install-Package Spare.NET.Sdk -Version 1.3.0
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.0" />
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.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Spare.NET.Sdk, 1.3.0"
#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 Spare.NET.Sdk as a Cake Addin #addin nuget:?package=Spare.NET.Sdk&version=1.3.0 // Install Spare.NET.Sdk as a Cake Tool #tool nuget:?package=Spare.NET.Sdk&version=1.3.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
sdk-csharp
Usage
I- Download nuget package
<PackageReference Include="Spare.NET.Sdk" Version="1.2.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
1. In the ConfigureServices method of Startup.cs, register the SpPaymentClient..
public void ConfigureServices(IServiceCollection services)
{
services.AddSpPaymentClient(options =>
{
options.ApiKey = "Your API key";
options.AppId = "Your app id";
options.BaseUrl = new Uri("https://payment.tryspare.com");
});
}
2. Inject the service on the desired controller..
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(ISpPaymentClient client)
{
_client = client;
}
// 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 Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. 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.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net452 is compatible. net46 is compatible. net461 is compatible. net462 is compatible. net463 was computed. net47 is compatible. net471 is compatible. net472 is compatible. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.1
- BouncyCastle (>= 1.8.9)
- System.Net.Http (>= 4.3.4)
-
.NETFramework 4.5.2
- BouncyCastle (>= 1.8.9)
- System.Net.Http (>= 4.3.4)
-
.NETFramework 4.6
- BouncyCastle (>= 1.8.9)
- System.Net.Http (>= 4.3.4)
-
.NETFramework 4.6.1
- BouncyCastle (>= 1.8.9)
- System.Net.Http (>= 4.3.4)
-
.NETFramework 4.6.2
- BouncyCastle (>= 1.8.9)
- System.Net.Http (>= 4.3.4)
-
.NETFramework 4.7
- BouncyCastle (>= 1.8.9)
- System.Net.Http (>= 4.3.4)
-
.NETFramework 4.7.1
- BouncyCastle (>= 1.8.9)
- System.Net.Http (>= 4.3.4)
-
.NETFramework 4.7.2
- BouncyCastle (>= 1.8.9)
- System.Net.Http (>= 4.3.4)
-
.NETFramework 4.8
- BouncyCastle (>= 1.8.9)
- System.Net.Http (>= 4.3.4)
-
.NETStandard 2.0
- BouncyCastle (>= 1.8.9)
- System.Net.Http (>= 4.3.4)
-
net6.0
- BouncyCastle (>= 1.8.9)
- System.Net.Http (>= 4.3.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.