コード例 #1
0
        public async Task Should_Initialize_Checkout_Form_For_Standard_Merchant()
        {
            IReadOnlyList <BasketItem> basketItems =
                new ReadOnlyCollection <BasketItem>(new List <BasketItem>()
            {
                BasketItemBuilder.Create().Price("0.3").Build()
            });

            CreateCheckoutFormInitializeRequest request = CreateCheckoutFormInitializeRequestBuilder.Create()
                                                          .Price("0.3")
                                                          .PaymentGroup(PaymentGroup.LISTING.ToString())
                                                          .PaidPrice("0.4")
                                                          .CallbackUrl("https://www.merchant.com/callback")
                                                          .BasketItems(basketItems)
                                                          .Build();

            CheckoutFormInitialize checkoutFormInitialize = await CheckoutFormInitialize.CreateAsync(request, Options);

            PrintResponse(request);

            Assert.AreEqual(Status.SUCCESS.ToString(), checkoutFormInitialize.Status);
            Assert.AreEqual(Locale.TR.ToString(), checkoutFormInitialize.Locale);
            Assert.NotNull(checkoutFormInitialize.SystemTime);
            Assert.NotNull(checkoutFormInitialize.Token);
            Assert.NotNull(checkoutFormInitialize.CheckoutFormContent);
        }
コード例 #2
0
        public void Should_Initialize_Checkout_Form()
        {
            CreateCheckoutFormInitializeRequest request = new CreateCheckoutFormInitializeRequest();

            request.Locale          = Locale.TR.GetName();
            request.ConversationId  = "123456789";
            request.Price           = "1";
            request.PaidPrice       = "1.2";
            request.BasketId        = "B67832";
            request.PaymentGroup    = PaymentGroup.PRODUCT.ToString();
            request.Buyer           = NewBuyer();
            request.ShippingAddress = newShippingAddress();
            request.BillingAddress  = newBillingAddress();
            request.BasketItems     = newBasketItems();
            request.CallbackUrl     = "https://www.merchant.com/callback";

            CheckoutFormInitialize checkoutFormInitialize = CheckoutFormInitialize.Create(request, options);

            PrintResponse <CheckoutFormInitialize>(checkoutFormInitialize);

            Assert.IsNotNull(checkoutFormInitialize.SystemTime);
            Assert.AreEqual(Status.SUCCESS.ToString(), checkoutFormInitialize.Status);
            Assert.AreEqual(Locale.TR.GetName(), checkoutFormInitialize.Locale);
            Assert.AreEqual("123456789", checkoutFormInitialize.ConversationId);
        }
コード例 #3
0
        public async Task Should_Retrieve_Checkout_Form_Result()
        {
            IReadOnlyList <BasketItem> basketItems =
                new ReadOnlyCollection <BasketItem>(new List <BasketItem>()
            {
                BasketItemBuilder.Create().Price("0.3").Build()
            });

            CreateCheckoutFormInitializeRequest request = CreateCheckoutFormInitializeRequestBuilder.Create()
                                                          .Price("0.3")
                                                          .PaymentGroup(PaymentGroup.LISTING.ToString())
                                                          .PaidPrice("0.4")
                                                          .CallbackUrl("https://www.merchant.com/callback")
                                                          .BasketItems(basketItems)
                                                          .Build();

            CheckoutFormInitialize checkoutFormInitialize = await CheckoutFormInitialize.CreateAsync(request, Options);

            RetrieveCheckoutFormRequest retrieveCheckoutFormRequest = RetrieveCheckoutFormRequestBuilder.Create()
                                                                      .Token(checkoutFormInitialize.Token)
                                                                      .Build();

            CheckoutForm checkoutForm = await CheckoutForm.RetrieveAsync(retrieveCheckoutFormRequest, Options);

            PrintResponse(checkoutForm);

            Assert.NotNull(checkoutForm.ErrorMessage);
            Assert.AreEqual(Status.FAILURE.ToString(), checkoutForm.Status);
            Assert.NotNull(checkoutForm.SystemTime);
        }
コード例 #4
0
ファイル: ShopController.cs プロジェクト: mdemirci01/C2C
        private IActionResult IyzicoPayment(Order order)
        {
            Options options = new Options();

            options.ApiKey    = "PVKewvZEgJf8UGUeYoj5FeT1nMhQk4ep";
            options.SecretKey = "Lk69QlCFmwR3mDnfnMavBtZYDB9shH93";
            options.BaseUrl   = "https://sandbox-api.iyzipay.com";

            CreateCheckoutFormInitializeRequest request = new CreateCheckoutFormInitializeRequest();

            request.Locale         = Locale.TR.ToString();
            request.ConversationId = order.Id.ToString();
            request.Price          = (order.Cart.TotalPrice * 1.18M).ToString();
            request.PaidPrice      = (order.Cart.TotalPrice * 1.18M).ToString();
            request.Currency       = C2C.Models.Currency.TRY.ToString();
            request.BasketId       = order.CartId.ToString();
            request.PaymentGroup   = PaymentGroup.PRODUCT.ToString();
            request.CallbackUrl    = "https://localhost:61656/Shop/CheckoutCompleted?orderId=" + order.Id.ToString();

            List <int> enabledInstallments = new List <int>();

            enabledInstallments.Add(2);
            enabledInstallments.Add(3);
            enabledInstallments.Add(6);
            enabledInstallments.Add(9);
            request.EnabledInstallments = enabledInstallments;


            List <BasketItem> basketItems = new List <BasketItem>();

            foreach (var item in order.Cart.CartItems)
            {
                BasketItem basketItem = new BasketItem();
                basketItem.Id        = item.Id.ToString();
                basketItem.Name      = item.Product.Name + " (" + item.Quantity.ToString() + " Adet)";
                basketItem.Category1 = "Tüm Ürünler";
                basketItem.Category2 = item.Product.Category.Name;
                basketItem.ItemType  = BasketItemType.PHYSICAL.ToString();
                basketItem.Price     = (item.TotalPrice * 1.18M).ToString();
                basketItems.Add(basketItem);
            }

            request.BasketItems = basketItems;

            CheckoutFormInitialize checkoutFormInitialize = CheckoutFormInitialize.Create(request, options);

            if (string.IsNullOrEmpty(checkoutFormInitialize.PaymentPageUrl))
            {
                return(RedirectToAction("Checkout", new { errorCode = checkoutFormInitialize.ErrorCode }));
            }
            return(Redirect(checkoutFormInitialize.PaymentPageUrl));
        }
コード例 #5
0
        public CheckoutFormInitialize GetPaymentForm(List <Siparisler> siparisler)
        {
            decimal totalUcret = 0m;

            foreach (var item in siparisler)
            {
                totalUcret += item.YemekSayisi * item.Musteri.GunlukYemekFiyati;
            }
            CreateCheckoutFormInitializeRequest request = new CreateCheckoutFormInitializeRequest();

            request.Locale         = Locale.TR.ToString();
            request.ConversationId = Guid.NewGuid().ToString().Replace("-", "").ToUpper().Substring(0, 25);
            request.Price          = totalUcret.ToString("0.0");
            request.PaidPrice      = totalUcret.ToString("0.0");
            request.Currency       = Currency.TRY.ToString();
            request.BasketId       = $"B{request.ConversationId.ToString()}";
            request.PaymentGroup   = PaymentGroup.PRODUCT.ToString();
            request.CallbackUrl    = "http://localhost:63013/order/paymentForm";

            List <int> installement = new List <int>();

            installement.Add(1);
            request.EnabledInstallments = installement;
            var musteri = siparisler.First().Musteri;

            if (musteri == null)
            {
                return(null);
            }
            Buyer buyer = new Buyer();

            buyer.Id                  = musteri.Id.ToString();
            buyer.Name                = musteri.FirmaAdSoyad;
            buyer.Surname             = musteri.FirmaAdSoyad;
            buyer.GsmNumber           = $"+9{musteri.Telefon}";
            buyer.Email               = musteri.Email;
            buyer.IdentityNumber      = musteri.Id.ToString();
            buyer.LastLoginDate       = musteri.LastLogin.ToString("yyyy-MM-dd HH:mm:ss");
            buyer.RegistrationDate    = musteri.LastLogin.ToString("yyyy-MM-dd HH:mm:ss");
            buyer.RegistrationAddress = musteri.FirmaAdres.ToString();
            buyer.Ip                  = "85.34.78.112";
            buyer.City                = "Elazig";
            buyer.Country             = "Turkey";
            buyer.ZipCode             = "23000";
            request.Buyer             = buyer;

            Address billingAddress = new Address();

            billingAddress.ContactName = musteri.FirmaAdSoyad;
            billingAddress.City        = "Elazig";
            billingAddress.Country     = "Turkey";
            billingAddress.Description = musteri.FirmaAdres;
            billingAddress.ZipCode     = "23000";
            request.BillingAddress     = billingAddress;
            request.ShippingAddress    = new Address()
            {
                ContactName = "Ikra Yemek A.Ş",
                City        = "Elazig",
                Country     = "Turkey",
                Description = "Sanayi, Santral Cd. No:22/A, 23200 Merkez/Elazığ",
                ZipCode     = "23200",
            };


            List <BasketItem> basketItems = new List <BasketItem>();

            foreach (var item in siparisler)
            {
                basketItems.Add(new BasketItem()
                {
                    Id        = item.Id.ToString(),
                    Name      = $"{item.Yemek.YemekAdi}-{item.Yemek.PorsiyonGr} gr",
                    Category1 = "Yemek",
                    Category2 = "Günlük Yemek",
                    ItemType  = BasketItemType.PHYSICAL.ToString(),
                    Price     = (item.YemekSayisi * item.Musteri.GunlukYemekFiyati)
                                .ToString("0.00"),
                });
            }
            request.BasketItems = basketItems;


            return
                (CheckoutFormInitialize.Create(request, this._option));
        }
コード例 #6
0
        public ActionResult Pay(int id)
        {
            ViewBag.id = id;
            Siparis siparis = new Siparis();

            siparis.Load(id);
            ViewBag.siparis = siparis;

            Kullanici musteri = new Kullanici();

            musteri.load(siparis.kullaniciID);

            if (siparis.odemeTipi == (int)Helper.odemeTipleri.krediBankaKarti)
            {
                string siteUrl = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Content("~"));

                Options options = new Options();
                options.ApiKey    = ConfigurationManager.AppSettings["iyzico_apikey"];
                options.SecretKey = ConfigurationManager.AppSettings["iyzico_secretkey"];
                options.BaseUrl   = ConfigurationManager.AppSettings["iyzico_baseurl"];

                CreateCheckoutFormInitializeRequest request = new CreateCheckoutFormInitializeRequest();
                request.Locale         = Locale.TR.ToString();
                request.ConversationId = id.ToString();
                request.Price          = (siparis.GetToplamFiyat() - siparis.kargoUcreti).ToString().Replace(',', '.');
                request.PaidPrice      = siparis.GetToplamFiyat().ToString().Replace(',', '.');
                request.Currency       = Currency.TRY.ToString();
                request.BasketId       = siparis.siparisID.ToString();
                request.PaymentGroup   = PaymentGroup.PRODUCT.ToString();
                request.CallbackUrl    = siteUrl + "/Home/PayOut";

                List <int> enabledInstallments = new List <int>();
                enabledInstallments.Add(2);
                enabledInstallments.Add(3);
                enabledInstallments.Add(6);
                enabledInstallments.Add(9);
                request.EnabledInstallments = enabledInstallments;

                Buyer buyer = new Buyer();
                buyer.Id             = siparis.kullaniciID.ToString();
                buyer.Name           = musteri.ad;
                buyer.Surname        = musteri.soyad;
                buyer.GsmNumber      = siparis.telefon;
                buyer.Email          = musteri.eMail;
                buyer.IdentityNumber = "74300864791";
                //buyer.LastLoginDate = "2015-10-05 12:43:35";
                //buyer.RegistrationDate = "2013-04-21 15:12:09";
                buyer.RegistrationAddress = siparis.adresSatir1 + " " + siparis.adresSatir2;
                buyer.Ip      = SQL.GetIp();
                buyer.City    = siparis.sehir;
                buyer.Country = "Turkey";
                buyer.ZipCode = siparis.postaKodu;
                request.Buyer = buyer;

                Address shippingAddress = new Address();
                shippingAddress.ContactName = siparis.ad + " " + siparis.soyad;
                shippingAddress.City        = siparis.sehir;
                shippingAddress.Country     = "Turkey";
                shippingAddress.Description = siparis.adresSatir1 + " " + siparis.adresSatir2;
                shippingAddress.ZipCode     = siparis.postaKodu;
                request.ShippingAddress     = shippingAddress;

                Address billingAddress = new Address();
                billingAddress.ContactName = siparis.ad + " " + siparis.soyad;
                billingAddress.City        = siparis.sehir;
                billingAddress.Country     = "Turkey";
                billingAddress.Description = siparis.adresSatir1 + " " + siparis.adresSatir2;
                billingAddress.ZipCode     = siparis.postaKodu;
                request.BillingAddress     = billingAddress;

                List <BasketItem> basketItems = new List <BasketItem>();
                foreach (SiparisKalem siparisKalem in siparis.siparisKalemleri)
                {
                    BasketItem firstBasketItem = new BasketItem();
                    firstBasketItem.Id        = siparisKalem.siparisKalemID.ToString();
                    firstBasketItem.Name      = siparisKalem.urun.urunAdi;
                    firstBasketItem.Category1 = siparisKalem.urun.modelGrubu.modelGrubu;
                    firstBasketItem.Category2 = siparisKalem.urun.marka.marka;
                    firstBasketItem.ItemType  = BasketItemType.PHYSICAL.ToString();
                    firstBasketItem.Price     = (siparisKalem.miktar * siparisKalem.fiyat).ToString().Replace(',', '.');
                    basketItems.Add(firstBasketItem);
                }
                request.BasketItems = basketItems;

                CheckoutFormInitialize checkoutFormInitialize = CheckoutFormInitialize.Create(request, options);
                ViewBag.Iyzico = checkoutFormInitialize.CheckoutFormContent; //View Dönüş yapılan yer, Burada farklı yöntemler ile View gönderim yapabilirsiniz.
            }

            return(View());
        }
コード例 #7
0
        public object PaymentForm()
        {
            var paymentForm = CheckoutFormInitialize.Create(request, options);

            return(paymentForm);
        }
コード例 #8
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Options options = new Options();

            options.ApiKey    = "apikey";
            options.SecretKey = "secretkey";
            options.BaseUrl   = "https://sandbox-api.iyzipay.com";

            CreateCheckoutFormInitializeRequest request = new CreateCheckoutFormInitializeRequest();

            request.Locale         = Locale.TR.ToString();
            request.ConversationId = "123456789";
            request.Price          = "1";
            request.PaidPrice      = "1.2";
            request.Currency       = Currency.TRY.ToString();
            request.BasketId       = "B67832";
            request.PaymentGroup   = PaymentGroup.PRODUCT.ToString();
            //request.CallbackUrl = "https://www.merchant.com/callback";
            request.CallbackUrl = HttpContext.Current.Request.Url.AbsoluteUri;

            List <int> enabledInstallments = new List <int>();

            enabledInstallments.Add(2);
            enabledInstallments.Add(3);
            enabledInstallments.Add(6);
            enabledInstallments.Add(9);
            request.EnabledInstallments = enabledInstallments;

            Buyer buyer = new Buyer();

            buyer.Id                  = "BY789";
            buyer.Name                = "John";
            buyer.Surname             = "Doe";
            buyer.GsmNumber           = "+905350000000";
            buyer.Email               = "*****@*****.**";
            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 Address();

            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 Address();

            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 List <BasketItem>();
            BasketItem        firstBasketItem = new BasketItem();

            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 BasketItem();

            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 BasketItem();

            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;

            CheckoutFormInitialize checkoutFormInitialize = CheckoutFormInitialize.Create(request, options);

            ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", checkoutFormInitialize.CheckoutFormContent);

            odendiMi = checkoutFormInitialize.Status;
        }
コード例 #9
0
        public async Task Should_Initialize_Checkout_Form()
        {
            CreateCheckoutFormInitializeRequest request = new CreateCheckoutFormInitializeRequest
            {
                Locale         = Locale.TR.ToString(),
                ConversationId = "123456789",
                Price          = "1",
                PaidPrice      = "1.2",
                Currency       = Currency.TRY.ToString(),
                BasketId       = "B67832",
                PaymentGroup   = PaymentGroup.PRODUCT.ToString(),
                CallbackUrl    = "https://www.merchant.com/callback"
            };

            List <int> enabledInstallments = new List <int> {
                2, 3, 6, 9
            };

            request.EnabledInstallments = enabledInstallments;

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

            request.Buyer = buyer;

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

            request.ShippingAddress = shippingAddress;

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

            request.BillingAddress = billingAddress;

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

            basketItems.Add(firstBasketItem);

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

            basketItems.Add(secondBasketItem);

            BasketItem thirdBasketItem = new BasketItem
            {
                Id        = "BI103",
                Name      = "Usb",
                Category1 = "Electronics",
                Category2 = "Usb / Cable",
                ItemType  = BasketItemType.PHYSICAL.ToString(),
                Price     = "0.2"
            };

            basketItems.Add(thirdBasketItem);
            request.BasketItems = basketItems;

            CheckoutFormInitialize checkoutFormInitialize = await CheckoutFormInitialize.CreateAsync(request, Options);

            PrintResponse(checkoutFormInitialize);

            Assert.AreEqual(Status.SUCCESS.ToString(), checkoutFormInitialize.Status);
            Assert.AreEqual(Locale.TR.ToString(), checkoutFormInitialize.Locale);
            Assert.AreEqual("123456789", checkoutFormInitialize.ConversationId);
            Assert.IsNotNull(checkoutFormInitialize.SystemTime);
            Assert.IsNull(checkoutFormInitialize.ErrorCode);
            Assert.IsNull(checkoutFormInitialize.ErrorMessage);
            Assert.IsNull(checkoutFormInitialize.ErrorGroup);
            Assert.IsNotNull(checkoutFormInitialize.CheckoutFormContent);
            Assert.IsNotNull(checkoutFormInitialize.PaymentPageUrl);
        }
コード例 #10
0
        private async Task <string> PayWithIyzipay(CheckoutViewModel viewModel, Options options)
        {
            CreateCheckoutFormInitializeRequest request = new CreateCheckoutFormInitializeRequest();

            request.Locale         = Locale.TR.ToString();
            request.ConversationId = viewModel.Order.Id.ToString();
            request.Price          = viewModel.Order.TotalPrice.ToString();
            request.PaidPrice      = viewModel.Order.TotalPrice.ToString();
            request.Currency       = Iyzipay.Model.Currency.TRY.ToString();
            request.BasketId       = viewModel.Order.CartId.ToString();
            request.PaymentGroup   = PaymentGroup.PRODUCT.ToString();
            request.CallbackUrl    = "https://localhost:5000/";

            List <int> enabledInstallments = new List <int>();

            enabledInstallments.Add(2);
            enabledInstallments.Add(3);
            enabledInstallments.Add(6);
            enabledInstallments.Add(9);
            request.EnabledInstallments = enabledInstallments;

            Buyer buyer = new Buyer();

            buyer.Id             = viewModel.Order.Customer.Id.ToString();
            buyer.Name           = viewModel.Order.Customer.FirstName.ToString();
            buyer.Surname        = viewModel.Order.Customer.LastName.ToString();
            buyer.GsmNumber      = viewModel.Order.Customer.Phone.ToString();
            buyer.Email          = viewModel.Order.Customer.UserName.ToString(); // email eksik
            buyer.IdentityNumber = viewModel.Order.Customer.Phone.ToString();    // tc kimlik no eksik
            var u = await userManager.GetUserAsync(User);

            buyer.LastLoginDate       = "2018-04-01 15:12:09"; // last login ve registration tarihleri eksik
            buyer.RegistrationDate    = "2013-04-21 15:12:09";
            buyer.RegistrationAddress = viewModel.Order.Customer.Address.ToString();
            buyer.Ip      = HttpContext.Connection.RemoteIpAddress.ToString();
            buyer.City    = "Istanbul";
            buyer.Country = "Turkey";
            buyer.ZipCode = "34732";
            request.Buyer = buyer;

            Address shippingAddress = new Address();

            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 Address();

            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 List <BasketItem>();
            BasketItem        firstBasketItem = new BasketItem();

            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 BasketItem();

            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 BasketItem();

            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;

            CheckoutFormInitialize checkoutFormInitialize = CheckoutFormInitialize.Create(request, options);

            return(checkoutFormInitialize.PaymentPageUrl);
        }
コード例 #11
0
        private IActionResult IyzicoPayment(Order order)
        {
            Options options = new Options();

            options.ApiKey    = "PVKewvZEgJf8UGUeYoj5FeT1nMhQk4ep";
            options.SecretKey = "Lk69QlCFmwR3mDnfnMavBtZYDB9shH93";
            options.BaseUrl   = "https://sandbox-api.iyzipay.com";

            CreateCheckoutFormInitializeRequest request = new CreateCheckoutFormInitializeRequest();

            request.Locale         = Locale.TR.ToString();
            request.ConversationId = order.Id.ToString();
            request.Price          = (order.Cart.TotalPrice * 1.18M).ToString();
            request.PaidPrice      = (order.Cart.TotalPrice * 1.18M).ToString();
            request.Currency       = Currency.TRY.ToString();
            request.BasketId       = order.CartId.ToString();
            request.PaymentGroup   = PaymentGroup.PRODUCT.ToString();
            request.CallbackUrl    = "https://localhost:44330/Shop/CheckoutCompleted?orderId=" + order.Id.ToString();

            List <int> enabledInstallments = new List <int>();

            enabledInstallments.Add(2);
            enabledInstallments.Add(3);
            enabledInstallments.Add(6);
            enabledInstallments.Add(9);
            request.EnabledInstallments = enabledInstallments;

            Buyer buyer = new Buyer();

            buyer.Id             = order.CustomerId.ToString();
            buyer.Name           = order.Customer.BillingFirstName;
            buyer.Surname        = order.Customer.BillingLastName;
            buyer.GsmNumber      = order.Customer.BillingPhone;
            buyer.Email          = order.Customer.BillingEmail;
            buyer.IdentityNumber = order.Customer.BillingIdentityNumber;
            var email = User.Identity.Name;
            var user  = _context.Users.FirstOrDefault(u => u.Email == email);

            buyer.LastLoginDate       = user.LastLoginTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
            buyer.RegistrationDate    = user.RagistrationDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
            buyer.RegistrationAddress = order.Customer.BillingDistrict + " " + order.Customer.BillingStreet + " " + order.Customer.BillingAddress;

            var billingCounty  = _context.Regions.FirstOrDefault(r => r.Code == order.Customer.BillingCounty && r.RegionType == RegionType.County)?.Name;
            var billingCity    = _context.Regions.FirstOrDefault(r => r.Code == order.Customer.BillingCity && r.RegionType == RegionType.City)?.Name;
            var billingCountry = _context.Regions.FirstOrDefault(r => r.Code == order.Customer.BillingCountry && r.RegionType == RegionType.Country)?.Name;

            //buyer.RegistrationAddress += " " + billingCounty + "/" + billingCity + " " + billingCountry;

            buyer.Ip      = HttpContext.Connection.RemoteIpAddress.ToString();
            buyer.City    = billingCity;
            buyer.Country = billingCountry;
            buyer.ZipCode = order.Customer.BillingZipCode;
            request.Buyer = buyer;

            Address shippingAddress = new Address();

            shippingAddress.ContactName = order.Customer.ShippingFirstName + " " + order.Customer.ShippingLastName;

            shippingAddress.City = _context.Regions.FirstOrDefault(r => r.Code == order.Customer.ShippingCity && r.RegionType == RegionType.City)?.Name;

            shippingAddress.Country = _context.Regions.FirstOrDefault(r => r.Code == order.Customer.ShippingCountry && r.RegionType == RegionType.Country)?.Name;

            shippingAddress.Description = order.Customer.ShippingDistrict + " " + order.Customer.ShippingStreet + " " + order.Customer.ShippingAddress;
            shippingAddress.ZipCode     = order.Customer.ShippingZipCode;
            request.ShippingAddress     = shippingAddress;

            Address billingAddress = new Address();

            billingAddress.ContactName = order.Customer.FullName;
            billingAddress.City        = billingCity;
            billingAddress.Country     = billingCountry;
            billingAddress.Description = order.Customer.BillingDistrict + " " + order.Customer.BillingStreet + " " + order.Customer.BillingAddress;
            billingAddress.ZipCode     = order.Customer.BillingZipCode;
            request.BillingAddress     = billingAddress;

            List <BasketItem> basketItems = new List <BasketItem>();

            foreach (var item in order.Cart.CartItems)
            {
                BasketItem basketItem = new BasketItem();
                basketItem.Id        = item.Id.ToString();
                basketItem.Name      = item.Product.Name + " (" + item.Quantity.ToString() + " Adet)";
                basketItem.Category1 = "Tüm Ürünler";
                basketItem.Category2 = item.Product.Category.Name;
                basketItem.ItemType  = BasketItemType.PHYSICAL.ToString();
                basketItem.Price     = (item.TotalPrice * 1.18M).ToString();
                basketItems.Add(basketItem);
            }

            request.BasketItems = basketItems;

            CheckoutFormInitialize checkoutFormInitialize = CheckoutFormInitialize.Create(request, options);

            if (string.IsNullOrEmpty(checkoutFormInitialize.PaymentPageUrl))
            {
                return(RedirectToAction("Checkout", new { errorCode = checkoutFormInitialize.ErrorCode }));
            }
            return(Redirect(checkoutFormInitialize.PaymentPageUrl));
        }
コード例 #12
0
        public ActionResult Index()
        {
            Options options = new Options();

            options.ApiKey    = "sandbox-......"; //Iyzico Tarafından Sağlanan Api Key
            options.SecretKey = "sandbox-...";    //Iyzico Tarafından Sağlanan Secret Key
            options.BaseUrl   = "https://sandbox-api.iyzipay.com";

            //Kart Bilgilerini Dolduralım.
            CreateCheckoutFormInitializeRequest request = new CreateCheckoutFormInitializeRequest();

            request.Locale         = Locale.TR.ToString();
            request.ConversationId = "123456789";
            request.Price          = "1"; // Tutar
            request.PaidPrice      = "1.1";
            request.Currency       = Currency.TRY.ToString();
            request.BasketId       = "B67832";
            request.PaymentGroup   = PaymentGroup.PRODUCT.ToString();
            request.CallbackUrl    = "http:/<Iyzico Api Geri Dönüş Adresi>/OdemeSonucu"; /// Geri Dönüş Urlsi

            List <int> enabledInstallments = new List <int>();

            enabledInstallments.Add(2);
            enabledInstallments.Add(3);
            enabledInstallments.Add(6);
            enabledInstallments.Add(9);
            request.EnabledInstallments = enabledInstallments;

            //Alıcı Bilgilerini Dolduralım.
            Buyer buyer = new Buyer();

            buyer.Id                  = "1";
            buyer.Name                = "Ferit";
            buyer.Surname             = "Gezgil";
            buyer.GsmNumber           = "-";
            buyer.Email               = "*****@*****.**";
            buyer.IdentityNumber      = "12345678911";
            buyer.LastLoginDate       = "2015-09-04 11:40:00";
            buyer.RegistrationDate    = "2013-03-12 13:11:00";
            buyer.RegistrationAddress = "İzmir";
            buyer.Ip                  = "91.93.129.194";
            buyer.City                = "İzmir";
            buyer.Country             = "Turkey";
            buyer.ZipCode             = "35130";
            request.Buyer             = buyer;
            Address shippingAddress = new Address();

            shippingAddress.ContactName = "Ferit Gezgil";
            shippingAddress.City        = "Antalya";
            shippingAddress.Country     = "Turkey";
            shippingAddress.Description = "Mahalle --- İzmir";
            shippingAddress.ZipCode     = "35130";
            request.ShippingAddress     = shippingAddress;
            Address billingAddress = new Address();

            billingAddress.ContactName = "Ferit Gezgil";
            billingAddress.City        = "Turkey";
            billingAddress.Country     = "Turkey";
            billingAddress.Description = "Mahalle --- İzmir";
            billingAddress.ZipCode     = "35130";
            request.BillingAddress     = billingAddress;

            List <BasketItem> basketItems = new List <BasketItem>();

            //DummyListCreateile Yeni Bir Ürün Listesi Olşuturarak, Iyzico BasketItem modeline aktarıyoruz.
            //Buradaki Listeyi, Farklı bir View'den ürün seçimi yapılarak alabilirsiniz. !
            DummyListCreate newList          = new DummyListCreate();
            List <Product>  dummyBasketItems = newList.GetProductList();

            //Satın alınan ürün bilgilerini dolduralım.
            foreach (var item in dummyBasketItems)
            {
                BasketItem basketItem = new BasketItem();
                basketItem.Id        = item.ProductCode;
                basketItem.Name      = item.Name;
                basketItem.Category1 = item.Category;
                basketItem.Category2 = item.SubCategory;
                basketItem.ItemType  = BasketItemType.PHYSICAL.ToString();
                basketItem.Price     = item.Price.ToString();
                basketItems.Add(basketItem);
            }

            request.BasketItems = basketItems;
            CheckoutFormInitialize checkoutFormInitialize = CheckoutFormInitialize.Create(request, options);

            ViewBag.Iyzico = checkoutFormInitialize.CheckoutFormContent;
            //View Dönüş yapılan yer, Burada farklı yöntemler ile View gönderim yapabilirsiniz.
            return(View());
        }
コード例 #13
0
        // GET: Home
        public ActionResult Index()
        {
            Options options = new Options();

            options.ApiKey    = "sandbox-Z92PD5nIy1dHFVLlk3vPhnjzYmC8f2MS";
            options.SecretKey = "sandbox-qrEHpoSgczPPnNJ7F0tcGGG7PcO9MEKU";
            options.BaseUrl   = "https://sandbox-api.iyzipay.com";



            CreateCheckoutFormInitializeRequest request = new CreateCheckoutFormInitializeRequest();

            request.Locale         = Locale.TR.ToString();
            request.ConversationId = "123456789";
            request.Price          = "1"; // Tutar
            request.PaidPrice      = "1.1";
            request.Currency       = Currency.TRY.ToString();
            request.BasketId       = "B67832";
            request.PaymentGroup   = PaymentGroup.PRODUCT.ToString();
            request.CallbackUrl    = "http:/<Iyzico Api Geri Dönüş Adresi>/OdemeSonucu"; /// Geri Dönüş Urlsi

            List <int> enabledInstallments = new List <int>();

            enabledInstallments.Add(2);
            enabledInstallments.Add(3);
            enabledInstallments.Add(6);
            enabledInstallments.Add(9);
            request.EnabledInstallments = enabledInstallments;

            Buyer buyer = new Buyer();

            buyer.Id                  = "1";
            buyer.Name                = "Cengizhan";
            buyer.Surname             = "Bozkurt";
            buyer.GsmNumber           = "-";
            buyer.Email               = "*****@*****.**";
            buyer.IdentityNumber      = "12345678911";
            buyer.LastLoginDate       = "2015-10-05 12:43:35";
            buyer.RegistrationDate    = "2013-04-21 15:12:09";
            buyer.RegistrationAddress = "Antalya";
            buyer.Ip                  = "85.34.78.112";
            buyer.City                = "Antalya";
            buyer.Country             = "Turkey";
            buyer.ZipCode             = "07600";
            request.Buyer             = buyer;

            Address shippingAddress = new Address();

            shippingAddress.ContactName = "Cengizhan Bozkurt";
            shippingAddress.City        = "Antalya";
            shippingAddress.Country     = "Turkey";
            shippingAddress.Description = "Mahalle --- Antalya";
            shippingAddress.ZipCode     = "07600";
            request.ShippingAddress     = shippingAddress;

            Address billingAddress = new Address();

            billingAddress.ContactName = "Cengizhan Bozkurt";
            billingAddress.City        = "Turkey";
            billingAddress.Country     = "Turkey";
            billingAddress.Description = "Mahalle --- Antalya";
            billingAddress.ZipCode     = "07600";
            request.BillingAddress     = billingAddress;

            List <BasketItem> basketItems = new List <BasketItem>();

            foreach (var item in < ÜrünListesiModeli >) //Session'da tutmuş oldugum sepette bulunan ürünler
            {
                BasketItem firstBasketItem = new BasketItem();
                firstBasketItem.Id        = item.Kodu;
                firstBasketItem.Name      = item.Adi;
                firstBasketItem.Category1 = item.KategoriAdi;
                firstBasketItem.Category2 = "Ürün";
                firstBasketItem.ItemType  = BasketItemType.PHYSICAL.ToString();
                firstBasketItem.Price     = item.Fiyat1.ToString();
                basketItems.Add(firstBasketItem);
            }

            request.BasketItems = basketItems;
            CheckoutFormInitialize checkoutFormInitialize = CheckoutFormInitialize.Create(request, options);

            ViewBag.Iyzico = checkoutFormInitialize.CheckoutFormContent; //View Dönüş yapılan yer, Burada farklı yöntemler ile View gönderim yapabilirsiniz.
            return(View());
        }
コード例 #14
0
        public async Task <IActionResult> StartCheckout(int id)
        {
            CreateCheckoutFormInitializeRequest request = new CreateCheckoutFormInitializeRequest
            {
                Locale         = Locale.TR.ToString(),
                ConversationId = "123456789",
                Price          = "100.72",
                PaidPrice      = "110.72",
                Currency       = Currency.TRY.ToString(),
                BasketId       = "B67832",
                PaymentGroup   = PaymentGroup.PRODUCT.ToString(),
                CallbackUrl    = "http://*****:*****@email.com",
                IdentityNumber      = "74300864791",
                LastLoginDate       = "2015-10-05 12:43:35",
                RegistrationDate    = "2013-04-21 15:12:09",
                RegistrationAddress = "Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1",
                Ip                  = "85.34.78.112",
                City                = "Istanbul",
                Country             = "Turkey",
                ZipCode             = "34732"
            };

            request.Buyer = buyer;

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

            request.ShippingAddress = shippingAddress;

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

            request.BillingAddress = billingAddress;

            List <BasketItem> basketItems     = new List <BasketItem>();
            BasketItem        firstBasketItem = new BasketItem
            {
                Id               = "BI101",
                Name             = "Binocular",
                Category1        = "Collectibles",
                Category2        = "Accessories",
                SubMerchantKey   = "0gO50jhx5bpKlvHp/SiLwlXVzGM=",
                SubMerchantPrice = "20.12",
                ItemType         = BasketItemType.PHYSICAL.ToString(),
                Price            = "40.21"
            };

            basketItems.Add(firstBasketItem);

            BasketItem secondBasketItem = new BasketItem
            {
                Id               = "BI102",
                Name             = "Game code",
                Category1        = "Game",
                Category2        = "Online Game Items",
                SubMerchantKey   = "0gO50jhx5bpKlvHp/SiLwlXVzGM=",
                SubMerchantPrice = "30.12",
                ItemType         = BasketItemType.VIRTUAL.ToString(),
                Price            = "60.51"
            };

            basketItems.Add(secondBasketItem);

            request.BasketItems  = basketItems;
            request.ForceThreeDS = 1;

            CheckoutFormInitialize checkoutFormInitialize = await CheckoutFormInitialize.CreateAsync(request, option);

            ViewData["Checkout"] = checkoutFormInitialize.CheckoutFormContent;

            return(View());
        }
コード例 #15
0
        // GET: Payment
        public ActionResult Index()
        {
            decimal          kargo            = 0;
            int              adet             = 0;
            decimal          toplamTutar      = 0;
            decimal          sepetToplamTutar = 0;
            BasketRepository sepetim          = (BasketRepository)Session["sepet"];

            if (sepetim != null)
            {
                foreach (int i in sepetim.urunler.Keys)
                {
                    adet              = sepetim.urunler[i].Piece;
                    kargo             = Convert.ToInt32(sepetim.urunler[i].CargoPrice) * adet;
                    toplamTutar       = sepetim.urunler[i].Total + kargo;
                    sepetToplamTutar += toplamTutar;
                }
            }

            CreateCheckoutFormInitializeRequest request = new CreateCheckoutFormInitializeRequest();

            request.Locale         = Locale.TR.ToString();
            request.ConversationId = "123456789";
            request.Price          = "1";
            request.PaidPrice      = "222.2";
            request.Currency       = Currency.TRY.ToString();
            request.BasketId       = "B67832";
            request.PaymentGroup   = PaymentGroup.PRODUCT.ToString();
            request.CallbackUrl    = "http://*****:*****@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 Address();

            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 Address();

            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 List <BasketItem>();
            BasketItem        firstBasketItem = new BasketItem();

            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 BasketItem();

            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 BasketItem();

            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;

            Options op = new Options();

            op.ApiKey    = "sandbox-4qe5Bt7swzzJZ3rJaaGvj2CmUvNVMGpU";
            op.SecretKey = "sandbox-fm5wbKx0Dx3t09pGa75kwRrUjgXuJkQT";
            op.BaseUrl   = "https://sandbox-api.iyzipay.com";

            CheckoutFormInitialize checkoutFormInitialize = CheckoutFormInitialize.Create(request, op);


            Response.Write(checkoutFormInitialize.CheckoutFormContent);
            Session["token"] = checkoutFormInitialize.Token;
            return(View());
        }
コード例 #16
0
        // GET: Customers
        public async Task <IActionResult> Index()
        {
            var applicationDbContext = _context.Customer.Include(c => c.Dietitian);


            var options = new Options
            {
                ApiKey    = "sandbox-7xSIEv7d8wZc2BiX2nGEQnhhdDg6wm30",
                SecretKey = "sandbox-XKXfOIBvPLCwqo5xgn1zmDJUWvjVjB1v",
                BaseUrl   = "https://sandbox-api.iyzipay.com"
            };



            CreateCheckoutFormInitializeRequest request = new CreateCheckoutFormInitializeRequest
            {
                Locale         = Locale.TR.ToString(),
                ConversationId = "123456789",
                Price          = "1",
                PaidPrice      = "1.2",
                Currency       = Currency.TRY.ToString(),
                BasketId       = "B67832",
                PaymentGroup   = PaymentGroup.PRODUCT.ToString(),
                CallbackUrl    = "http://*****:*****@email.com",
                IdentityNumber      = "74300864791",
                LastLoginDate       = "2015-10-05 12:43:35",
                RegistrationDate    = "2013-04-21 15:12:09",
                RegistrationAddress = "Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1",
                Ip                  = "85.34.78.112",
                City                = "Istanbul",
                Country             = "Turkey",
                ZipCode             = "34732"
            };

            request.Buyer = buyer;

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

            request.ShippingAddress = shippingAddress;

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

            request.BillingAddress = billingAddress;

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

            basketItems.Add(firstBasketItem);

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

            basketItems.Add(secondBasketItem);

            BasketItem thirdBasketItem = new BasketItem
            {
                Id        = "BI103",
                Name      = "Usb",
                Category1 = "Electronics",
                Category2 = "Usb / Cable",
                ItemType  = BasketItemType.PHYSICAL.ToString(),
                Price     = "0.2"
            };

            basketItems.Add(thirdBasketItem);
            request.BasketItems = basketItems;

            CheckoutFormInitialize checkoutFormInitialize = await CheckoutFormInitialize.CreateAsync(request, options);

            ViewData["Greeting"] = checkoutFormInitialize.CheckoutFormContent;
            return(View(await applicationDbContext.ToListAsync()));
        }