.NET-клиент для Яндекс.Кассы
Клиент разработан на основе документации по API.
Клиент поддерживает классическую синхронную модель вызовов (класс Client) и async / await (класс AsyncClient).
Покрытие API почти полное и включает в себя создание платежа, подтверждение, возврат или отмену платежа, авиабилеты и чеки по ФЗ-54.
Пример вызова из ASP.NET - реализует проведение платежа по инструкции Быстрый старт (шаги 1-4)
The Nuget package contains versions for three platforms:
- .NET 4.0: no async / await
- .NET 4.5
- .NET Standard 2.0: this is what most modern clients will use.
<PackageVersion> follows SemVer.
<FileVersion> and <InformationalVersion> are both equal to <PackageVersion> followed by a dot and the build number. They are patched by AppVeyor.
<AssemblyVersion> is currently set to 0.0.0.0 in the csproj file and is not patched during CI. It will go up to 1.0.0.0 once the API is stable and then the major version will go up ONLY when there is a breaking change.
"Authentication failed because the remote party has closed the transport stream."
If you get this error while trying to create a new payment, it may mean that you are using a security protocol that YC does not support. Currently (July 2018) it supports TLS 1.2 but that may change in the future. Add this code before the create payment request:
using System.Net;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
Or, if you are targeting .NET 4.0 or lower:
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;