Moyasar 2.0.0
See the version list below for details.
dotnet add package Moyasar --version 2.0.0
NuGet\Install-Package Moyasar -Version 2.0.0
<PackageReference Include="Moyasar" Version="2.0.0" />
paket add Moyasar --version 2.0.0
#r "nuget: Moyasar, 2.0.0"
// Install Moyasar as a Cake Addin #addin nuget:?package=Moyasar&version=2.0.0 // Install Moyasar as a Cake Tool #tool nuget:?package=Moyasar&version=2.0.0
Moyasar.Net
Moyasar's .NET Client Library
Target Frameworks
This library targets following frameworks:
- .Net Standard 2.0
- .Net Framework 4.0
Installation
If you are using dotnet
command line tools you can add the library to
your project using the following command
dotnet add package moyasar
Or if you are using Nuget Package Manager
PM> Install-Package moyasar
Manual Installation
Please note that this installation method is not recommended
To Install the library manually please download the last release from the releases section and reference it in your project.
Usage
Setup
Make sure to set the API key before proceeding
MoyasarService.ApiKey = "YouKeyHere";
Payment
Make sure you always try to catch the following exceptions:
ValidationException
NetworkException
ApiException
To fetch a payment from Moyasar, use the following:
Payment.Fetch("Payment-Id");
To refund a payment, one must have a Payment instance somePayment
then
invoke the following:
somePayment.Refund();
To update your payment, change Description
property on that payment,
then invoke Update
:
somePayment.Description = "Colombia, Narino Sandona, Medium Roast (Special)";
somePayment.Update();
To list or search for payments at Moyasar, do the following:
var result = Payment.List();
or
var result = Payment.List(new SearchQuery()
{
Id = "SomeId",
Source = "creditcard OR sadad",
Status = "some status",
Page = 2,
CreatedAfter = DateTime.Now.AddDays(-5),
CreatedBefore = DateTime.Now
});
All SearchQuery
parameters are optional, use what is needed
Invoice
Use Invoice
class with the same methods as Payment
class, except
for the following:
To create an invoice for example:
var invoice = Invoice.Create(new InvoiceInfo()
{
Amount = 7000,
Currency = "SAR",
Description = "A 70 SAR invoice just because",
ExpiredAt = DateTime.Now.AddDays(3),
CallbackUrl = "http://www.example.com/invoice_callback"
});
To Cancel an Invoice:
someInvoice.Cancel();
For more details, please refer to the official documentation: https://moyasar.com/docs/api/
Testing
To run the tests use the following command
dotnet test
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net40 is compatible. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. 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. |
-
.NETFramework 4.0
- Newtonsoft.Json (>= 12.0.1)
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.5.0)
- Newtonsoft.Json (>= 12.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.