scanpay 1.0.1
See the version list below for details.
dotnet add package scanpay --version 1.0.1
NuGet\Install-Package scanpay -Version 1.0.1
<PackageReference Include="scanpay" Version="1.0.1" />
paket add scanpay --version 1.0.1
#r "nuget: scanpay, 1.0.1"
// Install scanpay as a Cake Addin
#addin nuget:?package=scanpay&version=1.0.1
// Install scanpay as a Cake Tool
#tool nuget:?package=scanpay&version=1.0.1
Scanpay .NET library
Documentation
See the docs.
Installation
From the command line:
$ nuget install scanpay
From Package Manager:
PM> Install-Package scanpay
From within Visual Studio:
- Open the Solution Explorer.
- Right-click on a project within your solution.
- Click on Manage NuGet Packages...
- Click on the Browse tab and search for "scanpay".
- Click on the scanpay package, select the appropriate version in the right-tab and click Install.
Usage
Define a Scanpay client:
var apikey = "1089:bx2a4DATi8ad87Nm4uaxg5nggYA8J/Hv99CON977YiEdvYa6DmMwdoRPoYWyBJSi";
var client = new Scanpay.Client(apikey);
The Scanpay API requires TLS 1.2 support. If you do not use the latest .NET version, you may have to explicitly enable TLS 1.2 by adding the following to your main function:
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
If SecurityProtocolType.Tls12
is undefined in your .NET version, you can attempt the following:
ServicePointManager.SecurityProtocol |= (SecurityProtocolType)3072;;
New Payment Link
Create a payment link to which you can redirect customers.
var data = new Scanpay.NewURLReq
{
orderid = "999",
items = new Scanpay.Item[]
{
new Scanpay.Item
{
name = "Ultra Bike 7000",
total = "1337.01 DKK",
quantity = 2,
},
}
};
var url = client.newURL(data);
Console.WriteLine("Payment URL is " + url);
Seq Request
Get an array with a number of changes since the supplied sequence number:
var oldSeq = 3
var seqRes = client.seq(oldSeq);
foreach(var change in seqRes.changes)
{
// Update your database with change...
}
Console.WriteLine("New seq number is " + seqRes.seq);
Handle Pings
Verify the ping signature and extract the seq number.
var ping = client.handlePing(body, request.Headers["X-Signature"]);
Console.WriteLine("Ping seq=" + ping.seq + ", shopid=" + ping.shopid);
See the tests/ folder for more advanced examples.
Learn more about Target Frameworks and .NET Standard.
-
- Newtonsoft.Json (>= 10.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release.