Milvasoft.Iyzipay 6.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Milvasoft.Iyzipay --version 6.0.0                
NuGet\Install-Package Milvasoft.Iyzipay -Version 6.0.0                
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="Milvasoft.Iyzipay" Version="6.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Milvasoft.Iyzipay --version 6.0.0                
#r "nuget: Milvasoft.Iyzipay, 6.0.0"                
#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 Milvasoft.Iyzipay as a Cake Addin
#addin nuget:?package=Milvasoft.Iyzipay&version=6.0.0

// Install Milvasoft.Iyzipay as a Cake Tool
#tool nuget:?package=Milvasoft.Iyzipay&version=6.0.0                

Milvasoft.Iyzipay Library For .Net 6

NuGet

NuGet

Unofficial Iyzipay client library that is maintained by Milvasoft, a fork of the iyzipay-dotnet

All methods have been rearranged to use async await.

The dispose pattern has been implemented in the class where the request was sent. This class can be disposed according to optional usage. The HttpRequestMessage and HttpResponse message objects created in each request were disposed of as a result of the request.

Required dependency injection operations in Iyzico API integration have been adapted to the .net core structure.

Supports .Net 6

You can sign up for an iyzico account at https://iyzico.com

Requirements

One of the runtime environment is required from below

  • .NET 6

Installation

For now you'll need to install following libraries:

  • To install Milvasoft.Iyzipay, run the following command in the Package Manager Console
Install-Package Milvasoft.Iyzipay

Or you can download the latest .dll from Github

Milvasoft.Iyzipay Usage

In Startup.cs;


...
	    
 services.AddIyzicoIntegration(i =>
 {
     i.ApiKey = "your api key";
     i.SecretKey = "your secret key";
     i.BaseUrl = "https://sandbox-api.iyzipay.com";
     i.RestHttpClientLifeTime = ServiceLifetime.Transient;
     i.RestHttpClientV2LifeTime = ServiceLifetime.Transient;
 });

...

        
using Milvasoft.Iyzipay.Model;
using Milvasoft.Iyzipay.Request;
using Milvasoft.Iyzipay.Utils.Abstract;

private readonly IRestHttpClient _restHttpClient;

public PaymentController(IRestHttpClient restHttpClient)
{
    _restHttpClient = restHttpClient;
}

public async Task<IActionResult> CancelPaymentAsync()
{
    CreateCancelRequest request = new()
    {
        ConversationId = "123456789",
        Locale = Locale.TR.ToString(),
        PaymentId = "1",
        Ip = "85.34.78.112"
    };
    
    var cancel = new Cancel(_restHttpClient);
    
    cancel = await cancel.CreateAsync(request).ConfigureAwait(false);
    
    _restHttpClient.Dispose();
    
    if (cancel.Status == Status.SUCCESS.ToString())
        return Ok();
    else
        return BadRequest();
}

Or you can use like official Iyzipay library;


IOptions options = new Options
{
   ApiKey = "your api key",
   SecretKey = "your secret key",
   BaseUrl = "https://sandbox-api.iyzipay.com"
}
		
CreatePaymentRequest request = new();
request.Locale = Locale.TR.ToString();
request.ConversationId = "123456789";
request.Price = "1";
request.PaidPrice = "1.2";
request.Currency = Currency.TRY.ToString();
request.Installment = 1;
request.BasketId = "B67832";
request.PaymentChannel = PaymentChannel.WEB.ToString();
request.PaymentGroup = PaymentGroup.PRODUCT.ToString();

PaymentCard paymentCard = new();
paymentCard.CardHolderName = "John Doe";
paymentCard.CardNumber = "5528790000000008";
paymentCard.ExpireMonth = "12";
paymentCard.ExpireYear = "2030";
paymentCard.Cvc = "123";
paymentCard.RegisterCard = 0;
request.PaymentCard = paymentCard;

Buyer buyer = new();
buyer.Id = "BY789";
buyer.Name = "John";
buyer.Surname = "Doe";
buyer.GsmNumber = "+905350000000";
buyer.Email = "email@email.com";
buyer.IdentityNumber = "74300864791";
buyer.LastLoginDate = "2015-10-05 12:43:35";
buyer.RegistrationDate = "2013-04-21 15:12:09";
buyer.RegistrationAddress = "Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1";
buyer.Ip = "85.34.78.112";
buyer.City = "Istanbul";
buyer.Country = "Turkey";
buyer.ZipCode = "34732";
request.Buyer = buyer;

Address shippingAddress = new();
shippingAddress.ContactName = "Jane Doe";
shippingAddress.City = "Istanbul";
shippingAddress.Country = "Turkey";
shippingAddress.Description = "Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1";
shippingAddress.ZipCode = "34742";
request.ShippingAddress = shippingAddress;

Address billingAddress = new();
billingAddress.ContactName = "Jane Doe";
billingAddress.City = "Istanbul";
billingAddress.Country = "Turkey";
billingAddress.Description = "Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1";
billingAddress.ZipCode = "34742";
request.BillingAddress = billingAddress;

List<BasketItem> basketItems = new();
BasketItem firstBasketItem = new();
firstBasketItem.Id = "BI101";
firstBasketItem.Name = "Binocular";
firstBasketItem.Category1 = "Collectibles";
firstBasketItem.Category2 = "Accessories";
firstBasketItem.ItemType = BasketItemType.PHYSICAL.ToString();
firstBasketItem.Price = "0.3";
basketItems.Add(firstBasketItem);

BasketItem secondBasketItem = new();
secondBasketItem.Id = "BI102";
secondBasketItem.Name = "Game code";
secondBasketItem.Category1 = "Game";
secondBasketItem.Category2 = "Online Game Items";
secondBasketItem.ItemType = BasketItemType.VIRTUAL.ToString();
secondBasketItem.Price = "0.5";
basketItems.Add(secondBasketItem);

BasketItem thirdBasketItem = new();
thirdBasketItem.Id = "BI103";
thirdBasketItem.Name = "Usb";
thirdBasketItem.Category1 = "Electronics";
thirdBasketItem.Category2 = "Usb / Cable";
thirdBasketItem.ItemType = BasketItemType.PHYSICAL.ToString();
thirdBasketItem.Price = "0.2";
basketItems.Add(thirdBasketItem);
request.BasketItems = basketItems;

var client = new RequestHttpClient(new HttpClient(),options);

var payment = new Payment(client);

payment = await payment.CreateAsync(request).ConfigureAwait(false);

client.Dispose();

See other samples under Milvasoft.Iyzipay.Samples project.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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. 
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
8.0.0 323 11/20/2023
7.0.0 178 5/7/2023
6.0.0 983 11/9/2021
1.0.6 961 8/20/2021
1.0.5 332 8/19/2021
1.0.4 328 8/4/2021
1.0.3 340 8/2/2021
1.0.2 322 8/2/2021
1.0.1 327 8/2/2021
1.0.0 357 8/1/2021