RoodFluweel.PAYNLSDK
1.0.45
See the version list below for details.
dotnet add package RoodFluweel.PAYNLSDK --version 1.0.45
NuGet\Install-Package RoodFluweel.PAYNLSDK -Version 1.0.45
<PackageReference Include="RoodFluweel.PAYNLSDK" Version="1.0.45" />
paket add RoodFluweel.PAYNLSDK --version 1.0.45
#r "nuget: RoodFluweel.PAYNLSDK, 1.0.45"
// Install RoodFluweel.PAYNLSDK as a Cake Addin #addin nuget:?package=RoodFluweel.PAYNLSDK&version=1.0.45 // Install RoodFluweel.PAYNLSDK as a Cake Tool #tool nuget:?package=RoodFluweel.PAYNLSDK&version=1.0.45
Pay.nl C# SDK
This SDK is available as DotNet Assembly.
With this SDK you will be able to start transactions and retrieve transactions with their status for the Pay.nl payment service provider.
Installation
You can use this package as a nuget package:
From nuget:
Install-Package RoodFluweel.PAYNLSDK
Or if you want bleeding edge:
PM> Install-Package RoodFluweel.PAYNLSDK -Source https://www.myget.org/F/paynl/api/v3/index.json
Usage
Setting the configuration:
var client = new Client("e41f83b246b706291ea9ad798ccfd9f0fee5e0ab", "SL-3490-4320")
Getting a list of available payment methods, use the Getservice.
var response = PAYNLSDK.Transaction.GetService(paymentMethodId);
//paymentMethodId: is optional
//The ID of the payment method. Only the payment options linked to the provided payment method ID will be returned if an ID is provided.
//If omitted, all available payment options are returned. Use the following IDs to filter the options:
//1. SMS.
//2. Pay fixed price.
//3. Pay per call.
//4. Pay per transaction
//5. Pay per minute.
Starting a transaction:
PAYNLSDK.API.Transaction.Start.Request request = PAYNLSDK.Transaction.CreateTransactionRequest("127.0.0.1", "http://example.org/visitor-return-after-payment");
request.Amount = 621;
// Optional values
options.store("paymentMethod", 10;
options.store("description", "demo payment";
options.store("language","EN";
// Transaction data
request.Transaction = new PAYNLSDK.Objects.TransactionData();
request.Transaction.Currency = "EUR";
request.Transaction.CostsVat = null;
request.Transaction.OrderExchangeUrl = "https://example.org/exchange.php";
request.Transaction.Description = "TEST PAYMENT";
request.Transaction.ExpireDate = DateTime.Now.AddDays(14);
// Optional Stats data
request.StatsData = new PAYNLSDK.Objects.StatsDetails();
request.StatsData.Info = "your information";
request.StatsData.Tool = "C#.NET";
request.StatsData.Extra1 = "X";
request.StatsData.Extra2 = "Y";
request.StatsData.Extra3 = "Z";
// Initialize Salesdata
request.SalesData = new PAYNLSDK.Objects.SalesData();
request.SalesData.InvoiceDate = DateTime.Now;
request.SalesData.DeliveryDate = DateTime.Now;
request.SalesData.OrderData = new System.Collections.Generic.List<PAYNLSDK.Objects.OrderData>();
// Add products
request.SalesData.OrderData.Add(new PAYNLSDK.Objects.OrderData("SKU-8489", "Testproduct 1", 2995, "H", 1));
request.SalesData.OrderData.Add(new PAYNLSDK.Objects.OrderData("SKU-8421", "Testproduct 2", 995, "H", 1));
request.SalesData.OrderData.Add(new PAYNLSDK.Objects.OrderData("SKU-2359", "Testproduct 3", 2499, "H", 1));
// enduser
request.Enduser = new PAYNLSDK.Objects.EndUser();
request.Enduser.Language = "NL";
request.Enduser.Initials = "J.";
request.Enduser.Lastname = "Buyer";
request.Enduser.Gender = PAYNLSDK.Enums.Gender.Male;
request.Enduser.BirthDate = new DateTime(1991, 1, 23, 0, 0, 0, DateTimeKind.Local);
request.Enduser.PhoneNumber = "0612345678";
request.Enduser.EmailAddress = "email@domain.com";
request.Enduser.BankAccount = "";
request.Enduser.IBAN = "NL08INGB0000000555";
request.Enduser.BIC = "";
// enduser address
request.Enduser.Address = new PAYNLSDK.Objects.Address();
request.Enduser.Address.StreetName = "Streetname";
request.Enduser.Address.StreetNumber = "8";
request.Enduser.Address.ZipCode = "1234AB";
request.Enduser.Address.City = "City";
request.Enduser.Address.CountryCode = "NL";
// invoice address
request.Enduser.InvoiceAddress = new PAYNLSDK.Objects.Address();
request.Enduser.InvoiceAddress.Initials = "J.";
request.Enduser.InvoiceAddress.LastName = "Jansen";
request.Enduser.InvoiceAddress.Gender = PAYLSDK.Enums.Gender.Male;
request.Enduser.InvoiceAddress.StreetName = "InvoiceStreetname";
request.Enduser.InvoiceAddress.StreetNumber = "10";
request.Enduser.InvoiceAddress.ZipCode = "1234BC";
request.Enduser.InvoiceAddress.City = "City";
request.Enduser.InvoiceAddress.CountryCode = "NL";
// Do the call
var transaction = new PAYNLSDK.Transaction(client).Start(request);
// do whatever you need to do
var transactionId = transaction.Transaction.TransactionId;
var redirectToUrl = transaction.Transaction.PaymentURL;
To determine if a transaction has been paid, you can use:
var transactionInfo = new PAYNLSDK.Transaction(client).Info(transactionId);
var paid = transactionInfo.PaymentDetails.State == PaymentStatus.PAID;
// or use the extentionmethods by adding "using PAYNLSDK.API.Transaction.Info;" at the top of your file
if (transactionInfo.IsPaid() || transactionInfo.IsPending())
{
// redirect user to thank you page
}
else
{
// it has not been paid yet, so redirect user back to checkout
}
When implementing the exchange script (where you should process the order in your backend):
var info = PAYNLSDK.Transaction.Info(response.transactionId);
PAYNLSDK.Enums.PaymentStatus result = info.PaymentDetails.State;
if (PAYNLSDK.Transaction.IsPaid(result))
{
// process the payment
}
else
{
if(PAYNLSDK.Transaction.IsCancelled(result)){
// payment canceled, restock items
}
}
response.Write("TRUE| ");
// Optionally you can send a message after TRUE|, you can view these messages in the logs.
// https://admin.pay.nl/logs/payment_state
response.Write("Paid");
Contributing
Feel free to do pull requests and create issues when you please.
License
This project is available as open source under the terms of the MIT License.
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 is compatible. 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 | net46 is compatible. net461 was computed. net462 is compatible. net463 was computed. net47 is compatible. net471 is compatible. 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. |
-
.NETCoreApp 2.0
- Newtonsoft.Json (>= 8.0.3)
- System.ComponentModel.Annotations (>= 4.4.1)
-
.NETFramework 4.6
- Newtonsoft.Json (>= 8.0.3)
- System.ComponentModel.Annotations (>= 4.4.1)
-
.NETFramework 4.6.2
- Newtonsoft.Json (>= 8.0.3)
- System.ComponentModel.Annotations (>= 4.4.1)
-
.NETFramework 4.7
- Newtonsoft.Json (>= 8.0.3)
- System.ComponentModel.Annotations (>= 4.4.1)
-
.NETFramework 4.7.1
- Newtonsoft.Json (>= 8.0.3)
- System.ComponentModel.Annotations (>= 4.4.1)
-
.NETStandard 2.0
- Newtonsoft.Json (>= 8.0.3)
- System.Collections.Specialized (>= 4.3.0)
- System.ComponentModel.Annotations (>= 4.4.1)
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.8.1 | 1,637 | 7/24/2023 |
1.8.0-alpha-003 | 149 | 11/6/2022 |
1.8.0-alpha-002 | 152 | 10/10/2022 |
1.8.0-alpha | 152 | 10/10/2022 |
1.7.3 | 1,009 | 7/26/2023 |
1.7.2 | 1,668 | 7/19/2022 |
1.7.1 | 371 | 11/12/2021 |
1.7.0 | 491 | 9/20/2021 |
1.6.1 | 423 | 9/20/2021 |
1.6.0 | 335 | 8/24/2021 |
1.5.2 | 519 | 8/24/2021 |
1.5.0 | 311 | 8/24/2021 |
1.4.3 | 491 | 10/5/2020 |
1.4.2 | 267 | 7/21/2020 |
1.4.1 | 265 | 3/15/2020 |
1.3.3 | 905 | 3/26/2019 |
1.3.1 | 16,851 | 1/25/2019 |
1.2.88 | 914 | 12/23/2018 |
1.2.86 | 714 | 12/23/2018 |
1.1.80 | 781 | 12/11/2018 |
1.1.73 | 757 | 12/10/2018 |
1.1.72 | 766 | 12/10/2018 |
1.1.69 | 802 | 12/6/2018 |
1.1.68 | 765 | 12/6/2018 |
1.1.67 | 769 | 11/9/2018 |
1.0.51 | 832 | 11/4/2018 |
1.0.49 | 1,121 | 9/2/2018 |
1.0.47 | 872 | 8/28/2018 |
1.0.46 | 963 | 8/16/2018 |
1.0.45 | 868 | 8/3/2018 |
1.0.43 | 1,275 | 6/25/2018 |
1.0.42 | 1,065 | 6/24/2018 |
1.0.37 | 981 | 6/14/2018 |
1.0.35 | 956 | 5/3/2018 |
1.0.34 | 1,137 | 4/30/2018 |
1.0.29 | 1,016 | 4/29/2018 |
1.0.27 | 987 | 4/28/2018 |
1.0.24 | 1,133 | 4/28/2018 |
1.0.23 | 991 | 4/16/2018 |
1.0.20 | 1,132 | 4/14/2018 |
1.0.14 | 1,181 | 4/14/2018 |
1.0.13 | 1,142 | 4/14/2018 |
1.0.10 | 906 | 3/19/2018 |