Luftborn.DibsPaymentSDK 2.0.1

dotnet add package Luftborn.DibsPaymentSDK --version 2.0.1
NuGet\Install-Package Luftborn.DibsPaymentSDK -Version 2.0.1
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="Luftborn.DibsPaymentSDK" Version="2.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Luftborn.DibsPaymentSDK --version 2.0.1
#r "nuget: Luftborn.DibsPaymentSDK, 2.0.1"
#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 Luftborn.DibsPaymentSDK as a Cake Addin
#addin nuget:?package=Luftborn.DibsPaymentSDK&version=2.0.1

// Install Luftborn.DibsPaymentSDK as a Cake Tool
#tool nuget:?package=Luftborn.DibsPaymentSDK&version=2.0.1

Dibs Payment API SDK

Description

.Net Core SDK for Dibs Payment easy API, it's a .Net core wrapper for Dibs Payment APIs including APIs for create payments, charge payment, update orders... etc.

For more details about Dibs Payment Please visit https://www.nets.eu/en/payments/online/

For more specific information about Dibs Payment APIs, Please visit Dibs Payment API site which also include full API documentation and code samples.

https://tech.dibspayment.com/easy/api/paymentapi

Installation

Use the nuget package manager to install library.

Install-Package DibsPaymentSDK -Version 1.0.0

Requirements

.Net Core v3
VSCode or VS
Nuget Package Manager

DibsPaymentSDK Configuration

Add below section to your application appsettings.json file.

"DibsPaymentAPI": {
	"BaseURL": "https://test.api.dibspayment.eu",
	"SecretKey": "100101010101010101010"
}

DibsPaymentSDK Usage

Table of Contents

  1. Create Payment

  2. Charge Payment

  3. Get Payment

  4. Cancel Payment

  5. Refund Payment

    <a name="create-payment"></a>

    1. Create Payment

Create payment instance

var createPaymentPost = new CreatePaymentPost();

Add your "bought" items to the payment order

            var items = new List<Item>();
            items.Add(new Item() {
                Name = "Product1",
                Reference = "22020206",
                GrossTotalAmount = 10,
                NetTotalAmount = 10,
                Quantity = 5,
                TaxAmount = 0,
                TaxRate = 0,
                Unit = "Item",
                UnitPrice = 2
            });
			
            createPaymentPost.Order = new Order() { 
                Amount = 10,
                Currency = "DKK",
                Reference = "123456",
                Items = items
            };

            createPaymentPost.PaymentMethods = new List<PaymentMethod>();
            createPaymentPost.PaymentMethods.Add(new PaymentMethod()
            {
                Fee = items.First(),
                Name = "easy-invoice"
            });
			
            var countries = new List<Country>();
            countries.Add(new Country() {
                CountryCode = "DNK"
            });

Setup checkout

            createPaymentPost.Checkout = new Checkout()
            {
                Charge = true,
                Consumer = new Consumer()
                { Company = null
                  ,Email = "123@live.com",
                    PhoneNumber = new PhoneNumber { Number = "01281339011", Prefix = "+45" },
                    PrivatePerson = null,
                    Reference = "3303030",
                    ShippingAddress = new ShippingAddress()
                    {
                        Country = "DNK",
                        AddressLine1 = "123 anywhere",
                        AddressLine2 = "here",
                        City = "Copenhagen",
                        PostalCode = "2000"
                    }

                },
                ConsumerType = new ConsumerType()
                { Default = "B2C" },
                IntegrationType = "EmbeddedCheckout",
                MerchantHandlesConsumerData = true,
                MerchantHandlesShippingCost = true,
                PublicDevice = true,
                ReturnUrl = "https://luftborn.com/callback",
                Shipping = new Shipping() { Countries = countries },
                TermsUrl = "https://luftborn.com/terms",
                Url = "https://luftborn.com/checkout"
            };

Setup webhook and callback settings

            createPaymentPost.Notifications = new Notifications()
            {
                WebHooks = new List<WebHook>()
            };
			
            createPaymentPost.Notifications.WebHooks.Add(new WebHook()
            {
                Authorization = "111111111",
                Url = "https://c95aed08.ngrok.io/home/Callback",
                EventName = "payment.created"
            });
			
			//create payment
            var paymnetAPI = new PaymentAPI();
            var response = await paymnetAPI.CreatePayment(createPaymentPost);

<a name="charge-payment"></a>

2. Charge Payment

	    //charge payment		
            var chargePayment = new ChargePayment();

            chargePayment.Amount = 10;
            chargePayment.OrderItems = new List<DibsPaymentSDK.Entities.ChargePayment.OrderItem>();
            chargePayment.OrderItems.Add(new DibsPaymentSDK.Entities.ChargePayment.OrderItem() {
                Name = "Product1",
                Reference = "22020206",
                GrossTotalAmount = 10,
                NetTotalAmount = 10,
                Quantity = 5,
                TaxAmount = 0,
                TaxRate = 0,
                Unit = "Item",
                UnitPrice = 2
            });

            var response = await paymentAPI.ChargePayment("00c600005e43dd5a046e301eacf52f0e", chargePayment);

<a name="get-payment"></a>

3. Get Payment

	    //get payment
            var response = await paymentAPI.GetPayment("023900005e43e0a4046e301eacf52f20");

<a name="cancel-payment"></a>

4. Cancel Payment

	    //create CancelPayment object
	    var cancelPayment = new CancelPayment();
	    cancelPayment.Amount = 10;
			
	    // add order items you want to cancel
            cancelPayment.OrderItems.Add();
	    cancelPayment.OrderItems.Add();
            ....

	    //cancel payment
            var response = await paymentAPI.CancelPayment("023900005e43e0a4046e301eacf52f20", cancelPayment);

<a name="refund-payment"></a>

5. Refund Payment

	   //create Refund object
	   var refundPayment = new Refund();
	   refundPayment.Amount = 10;
			
	   // add order items you want to refund
	   refundPayment.OrderItems.Add();
	   refundPayment.OrderItems.Add();
	   ....

	   // refund, submit chargeId and refund object
           var response = await paymentAPI.RefundPayment("023900005e43e0a4046e301eacf52f20", refundPayment);

Contributing

Pull requests are welcome, Please open an issue first to discuss what you would like to change.

License

MIT

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 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 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. 
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
2.0.1 2,165 8/17/2022
2.0.0 1,088 6/10/2022
1.0.5 1,449 9/14/2020
1.0.4 1,150 9/14/2020
1.0.3 1,115 9/14/2020
1.0.2 1,105 9/14/2020
1.0.1 1,149 9/14/2020
1.0.0 1,166 7/1/2020