RoodFluweel.PAYNLSDK 1.0.45

There is a newer version of this package available.
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
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="RoodFluweel.PAYNLSDK" Version="1.0.45" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RoodFluweel.PAYNLSDK --version 1.0.45
#r "nuget: RoodFluweel.PAYNLSDK, 1.0.45"
#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 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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,280 7/24/2023
1.8.0-alpha-003 119 11/6/2022
1.8.0-alpha-002 125 10/10/2022
1.8.0-alpha 121 10/10/2022
1.7.3 614 7/26/2023
1.7.2 1,643 7/19/2022
1.7.1 344 11/12/2021
1.7.0 461 9/20/2021
1.6.1 390 9/20/2021
1.6.0 312 8/24/2021
1.5.2 489 8/24/2021
1.5.0 274 8/24/2021
1.4.3 479 10/5/2020
1.4.2 257 7/21/2020
1.4.1 252 3/15/2020
1.3.3 885 3/26/2019
1.3.1 10,650 1/25/2019
1.2.88 883 12/23/2018
1.2.86 681 12/23/2018
1.1.80 752 12/11/2018
1.1.73 732 12/10/2018
1.1.72 734 12/10/2018
1.1.69 770 12/6/2018
1.1.68 738 12/6/2018
1.1.67 734 11/9/2018
1.0.51 795 11/4/2018
1.0.49 1,090 9/2/2018
1.0.47 835 8/28/2018
1.0.46 926 8/16/2018
1.0.45 844 8/3/2018
1.0.43 1,245 6/25/2018
1.0.42 1,040 6/24/2018
1.0.37 958 6/14/2018
1.0.35 944 5/3/2018
1.0.34 1,108 4/30/2018
1.0.29 985 4/29/2018
1.0.27 954 4/28/2018
1.0.24 1,102 4/28/2018
1.0.23 980 4/16/2018
1.0.20 1,104 4/14/2018
1.0.14 1,152 4/14/2018
1.0.13 1,117 4/14/2018
1.0.10 875 3/19/2018