public ActionResult TokenWithPayment(string ccToken, string installment) { ApiPaymentRequest apiPaymentRequest = new ApiPaymentRequest(); #region Genel Bilgiler apiPaymentRequest.Config = new ApiPaymentRequest.PayUConfig(); apiPaymentRequest.Config.MERCHANT = "OPU_TEST"; apiPaymentRequest.Config.LANGUAGE = "TR"; apiPaymentRequest.Config.PAY_METHOD = "CCVISAMC"; apiPaymentRequest.Config.BACK_REF = ""; apiPaymentRequest.Config.PRICES_CURRENCY = "TRY"; apiPaymentRequest.Config.LU_ENABLE_TOKEN = "true"; apiPaymentRequest.Order = new ApiPaymentRequest.PayUOrder(); apiPaymentRequest.Order.ORDER_REF = Guid.NewGuid().ToString(); apiPaymentRequest.Order.ORDER_SHIPPING = "5"; apiPaymentRequest.Order.ORDER_DATE = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss"); #endregion #region Urun Bilgileri ApiPaymentRequest.PayUOrder.PayUOrderItem orderItem = new ApiPaymentRequest.PayUOrder.PayUOrderItem(); orderItem.ORDER_PRICE = "5"; orderItem.ORDER_PINFO = "Test Açıklaması"; orderItem.ORDER_QTY = "1"; orderItem.ORDER_PCODE = "Test Kodu"; orderItem.ORDER_PNAME = "Test Ürünü"; orderItem.ORDER_VAT = "18"; orderItem.ORDER_PRICE_TYPE = "NET"; apiPaymentRequest.Order.OrderItems.Add(orderItem); #endregion #region Kredi Kartı Bilgileri apiPaymentRequest.CreditCard = new ApiPaymentRequest.PayUCreditCard(); apiPaymentRequest.CreditCard.CC_TOKEN = ccToken; apiPaymentRequest.CreditCard.CC_NUMBER = ""; apiPaymentRequest.CreditCard.EXP_MONTH = ""; apiPaymentRequest.CreditCard.EXP_YEAR = ""; apiPaymentRequest.CreditCard.CC_CVV = ""; apiPaymentRequest.CreditCard.CC_OWNER = ""; apiPaymentRequest.CreditCard.SELECTED_INSTALLMENTS_NUMBER = installment; #endregion #region Fatura Bilgileri apiPaymentRequest.Customer = new ApiPaymentRequest.PayUCustomer(); apiPaymentRequest.Customer.BILL_FNAME = "Ad"; apiPaymentRequest.Customer.BILL_LNAME = "Soyad"; apiPaymentRequest.Customer.BILL_EMAIL = "*****@*****.**"; apiPaymentRequest.Customer.BILL_PHONE = "02129003711"; apiPaymentRequest.Customer.BILL_FAX = "02129003711"; apiPaymentRequest.Customer.BILL_ADDRESS = "Birinci Adres satırı"; apiPaymentRequest.Customer.BILL_ADDRESS2 = "İkinci Adres satırı"; apiPaymentRequest.Customer.BILL_ZIPCODE = "34000"; apiPaymentRequest.Customer.BILL_CITY = "ISTANBUL"; apiPaymentRequest.Customer.BILL_COUNTRYCODE = "TR"; apiPaymentRequest.Customer.BILL_STATE = "Ayazağa"; apiPaymentRequest.Customer.CLIENT_IP = Request.UserHostAddress; #endregion #region Teslimat Parametreleri apiPaymentRequest.Delivery = new ApiPaymentRequest.PayUDelivery(); apiPaymentRequest.Delivery.DELIVERY_FNAME = "Ad"; apiPaymentRequest.Delivery.DELIVERY_LNAME = "Soyad"; apiPaymentRequest.Delivery.DELIVERY_EMAIL = "*****@*****.**"; apiPaymentRequest.Delivery.DELIVERY_PHONE = "02129003711"; apiPaymentRequest.Delivery.DELIVERY_COMPANY = "PayU Ödeme Kuruluşu A.Ş."; apiPaymentRequest.Delivery.DELIVERY_ADDRESS = "Birinci Adres satırı"; apiPaymentRequest.Delivery.DELIVERY_ADDRESS2 = "İkinci Adres satırı"; apiPaymentRequest.Delivery.DELIVERY_ZIPCODE = "34000"; apiPaymentRequest.Delivery.DELIVERY_CITY = "ISTANBUL"; apiPaymentRequest.Delivery.DELIVERY_STATE = "TR"; apiPaymentRequest.Delivery.DELIVERY_COUNTRYCODE = "Ayazağa"; #endregion var options = new Options(); options.Url = "https://secure.payu.com.tr/order/alu/v3"; options.SecretKey = "SECRET_KEY"; var response = ApiPaymentRequest.Non3DExecute(apiPaymentRequest, options); //api çağrısının başlatıldığı kısmı temsil eder. return(View(response)); }
protected void BtnApiPaymentWithWallet_Click(object sender, EventArgs e) { var request = new ApiPaymentRequest(); Settings settings = new Settings(); #region Request New request.OrderId = Guid.NewGuid().ToString(); request.Echo = "Echo"; // Cevap anında geri gelecek işlemi ayırt etmeye yarayacak alan request.Mode = settings.Mode; request.Amount = "10000"; // 100.00 tL request.CardOwnerName = ""; request.CardNumber = ""; request.CardExpireMonth = ""; request.CardExpireYear = ""; request.Installment = installment.Value; request.Cvc = ""; request.ThreeD = "false"; request.CardId = cardId.Value; request.UserId = userId.Value; #endregion //Buradaki bilgilerin sizin tablolarınız veya ekranlarınızdan gelmesi gerekmektedir. #region Sipariş veren bilgileri request.Purchaser = new Purchaser(); request.Purchaser.Name = "Murat"; request.Purchaser.SurName = "Kaya"; request.Purchaser.BirthDate = "1986-07-11"; request.Purchaser.Email = "*****@*****.**"; request.Purchaser.GsmPhone = "5881231212"; request.Purchaser.IdentityNumber = "1234567890"; request.Purchaser.ClientIp = "127.0.0.1"; #endregion //Buradaki bilgilerin sizin tablolarınız veya ekranlarınızdan gelmesi gerekmektedir. #region Fatura bilgileri request.Purchaser.InvoiceAddress = new PurchaserAddress(); request.Purchaser.InvoiceAddress.Name = "Murat"; request.Purchaser.InvoiceAddress.SurName = "Kaya"; request.Purchaser.InvoiceAddress.Address = "Mevlüt Pehlivan Mah. Multinet Plaza Şişli"; request.Purchaser.InvoiceAddress.ZipCode = "34782"; request.Purchaser.InvoiceAddress.CityCode = "34"; request.Purchaser.InvoiceAddress.IdentityNumber = "1234567890"; request.Purchaser.InvoiceAddress.CountryCode = "TR"; request.Purchaser.InvoiceAddress.TaxNumber = "123456"; request.Purchaser.InvoiceAddress.TaxOffice = "Kozyatağı"; request.Purchaser.InvoiceAddress.CompanyName = "iPara"; request.Purchaser.InvoiceAddress.PhoneNumber = "2122222222"; #endregion //Buradaki bilgilerin sizin tablolarınız veya ekranlarınızdan gelmesi gerekmektedir. #region Kargo Adresi bilgileri request.Purchaser.ShippingAddress = new PurchaserAddress(); request.Purchaser.ShippingAddress.Name = "Murat"; request.Purchaser.ShippingAddress.SurName = "Kaya"; request.Purchaser.ShippingAddress.Address = "Mevlüt Pehlivan Mah. Multinet Plaza Şişli"; request.Purchaser.ShippingAddress.ZipCode = "34782"; request.Purchaser.ShippingAddress.CityCode = "34"; request.Purchaser.ShippingAddress.IdentityNumber = "1234567890"; request.Purchaser.ShippingAddress.CountryCode = "TR"; request.Purchaser.ShippingAddress.PhoneNumber = "2122222222"; #endregion //Buradaki bilgilerin sizin tablolarınız veya ekranlarınızdan gelmesi gerekmektedir. #region Ürün bilgileri request.Products = new List <Product>(); Product p = new Product(); p.Title = "Telefon"; p.Code = "TLF0001"; p.Price = "5000"; //50.00 TL p.Quantity = 1; request.Products.Add(p); p = new Product(); p.Title = "Bilgisayar"; p.Code = "BLG0001"; p.Price = "5000"; //50.00 TL p.Quantity = 1; request.Products.Add(p); ApiPaymentResponse response = ApiPaymentRequest.Execute(request, settings); string jsonResponse = JsonConvert.SerializeObject(response, Formatting.Indented); result.InnerHtml = "<pre>" + jsonResponse + "</pre>"; #endregion }
public ActionResult ApiPayment3DSecure(string nameSurname, string cardNumber, string cvc, string month, string year, string installment) { var siteUrl = Request.Url.GetLeftPart(UriPartial.Authority); ApiPaymentRequest apiPaymentRequest = new ApiPaymentRequest(); #region Genel Bilgiler apiPaymentRequest.Config = new ApiPaymentRequest.PayUConfig(); apiPaymentRequest.Config.MERCHANT = "PALJZXGV"; apiPaymentRequest.Config.LANGUAGE = "TR"; apiPaymentRequest.Config.PAY_METHOD = "CCVISAMC"; apiPaymentRequest.Config.BACK_REF = siteUrl + "/Home/ThreeDSecureBackRefPage"; apiPaymentRequest.Config.PRICES_CURRENCY = "TRY"; apiPaymentRequest.Order = new ApiPaymentRequest.PayUOrder(); apiPaymentRequest.Order.ORDER_REF = Guid.NewGuid().ToString(); apiPaymentRequest.Order.ORDER_SHIPPING = "5"; apiPaymentRequest.Order.ORDER_DATE = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss"); #endregion #region Urun Bilgileri ApiPaymentRequest.PayUOrder.PayUOrderItem orderItem = new ApiPaymentRequest.PayUOrder.PayUOrderItem(); orderItem.ORDER_PRICE = "5"; orderItem.ORDER_PINFO = "Test Açıklaması"; orderItem.ORDER_QTY = "1"; orderItem.ORDER_PCODE = "Test Kodu"; orderItem.ORDER_PNAME = "Test Ürünü"; orderItem.ORDER_VAT = "18"; orderItem.ORDER_PRICE_TYPE = "NET"; apiPaymentRequest.Order.OrderItems.Add(orderItem); #endregion #region Kredi Kartı Bilgileri apiPaymentRequest.CreditCard = new ApiPaymentRequest.PayUCreditCard(); apiPaymentRequest.CreditCard.CC_NUMBER = cardNumber; apiPaymentRequest.CreditCard.EXP_MONTH = month; apiPaymentRequest.CreditCard.EXP_YEAR = year; apiPaymentRequest.CreditCard.CC_CVV = cvc; apiPaymentRequest.CreditCard.CC_OWNER = nameSurname; apiPaymentRequest.CreditCard.SELECTED_INSTALLMENTS_NUMBER = installment; #endregion #region Fatura Bilgileri apiPaymentRequest.Customer = new ApiPaymentRequest.PayUCustomer(); apiPaymentRequest.Customer.BILL_FNAME = "Ad"; apiPaymentRequest.Customer.BILL_LNAME = "Soyad"; apiPaymentRequest.Customer.BILL_EMAIL = "*****@*****.**"; apiPaymentRequest.Customer.BILL_PHONE = "02129003711"; apiPaymentRequest.Customer.BILL_FAX = "02129003711"; apiPaymentRequest.Customer.BILL_ADDRESS = "Birinci Adres satırı"; apiPaymentRequest.Customer.BILL_ADDRESS2 = "İkinci Adres satırı"; apiPaymentRequest.Customer.BILL_ZIPCODE = "34000"; apiPaymentRequest.Customer.BILL_CITY = "ISTANBUL"; apiPaymentRequest.Customer.BILL_COUNTRYCODE = "TR"; apiPaymentRequest.Customer.BILL_STATE = "Ayazağa"; apiPaymentRequest.Customer.CLIENT_IP = Request.UserHostAddress; #endregion #region Teslimat Parametreleri apiPaymentRequest.Delivery = new ApiPaymentRequest.PayUDelivery(); apiPaymentRequest.Delivery.DELIVERY_FNAME = "Ad"; apiPaymentRequest.Delivery.DELIVERY_LNAME = "Soyad"; apiPaymentRequest.Delivery.DELIVERY_EMAIL = "*****@*****.**"; apiPaymentRequest.Delivery.DELIVERY_PHONE = "02129003711"; apiPaymentRequest.Delivery.DELIVERY_COMPANY = "PayU Ödeme Kuruluşu A.Ş."; apiPaymentRequest.Delivery.DELIVERY_ADDRESS = "Birinci Adres satırı"; apiPaymentRequest.Delivery.DELIVERY_ADDRESS2 = "İkinci Adres satırı"; apiPaymentRequest.Delivery.DELIVERY_ZIPCODE = "34000"; apiPaymentRequest.Delivery.DELIVERY_CITY = "ISTANBUL"; apiPaymentRequest.Delivery.DELIVERY_STATE = "TR"; apiPaymentRequest.Delivery.DELIVERY_COUNTRYCODE = "Ayazağa"; #endregion var options = new Options(); options.Url = "https://secure.payu.com.tr/order/alu/v3"; options.SecretKey = "f*%J7z6_#|5]s7V4[g3]"; var response = ApiPaymentRequest.ThreeDSecurePayment(apiPaymentRequest, options); //api çağrısının başlatıldığı kısmı temsil eder. return(Redirect(response.URL_3DS)); }
public ActionResult ApiPayment(string nameSurname, string cardNumber, string cvc, string month, string year, string installment) { var request = new ApiPaymentRequest(); #region Request New request.OrderId = Guid.NewGuid().ToString(); request.Echo = "Echo"; request.Mode = settings.Mode; request.Amount = "10000"; // 100.00 tL request.CardOwnerName = nameSurname; request.CardNumber = cardNumber; request.CardExpireMonth = month; request.CardExpireYear = year; request.Installment = installment; request.Cvc = cvc; request.ThreeD = "false"; request.CardId = ""; request.UserId = ""; #endregion #region Sipariş veren bilgileri request.Purchaser = new Purchaser(); request.Purchaser.Name = "Murat"; request.Purchaser.SurName = "Kaya"; request.Purchaser.BirthDate = "1986-07-11"; request.Purchaser.Email = "*****@*****.**"; request.Purchaser.GsmPhone = "5881231212"; request.Purchaser.IdentityNumber = "1234567890"; request.Purchaser.ClientIp = "127.0.0.1"; #endregion #region Fatura bilgileri request.Purchaser.InvoiceAddress = new PurchaserAddress(); request.Purchaser.InvoiceAddress.Name = "Murat"; request.Purchaser.InvoiceAddress.SurName = "Kaya"; request.Purchaser.InvoiceAddress.Address = "Mevlüt Pehlivan Mah. Multinet Plaza Şişli"; request.Purchaser.InvoiceAddress.ZipCode = "34782"; request.Purchaser.InvoiceAddress.CityCode = "34"; request.Purchaser.InvoiceAddress.IdentityNumber = "1234567890"; request.Purchaser.InvoiceAddress.CountryCode = "TR"; request.Purchaser.InvoiceAddress.TaxNumber = "123456"; request.Purchaser.InvoiceAddress.TaxOffice = "Kozyatağı"; request.Purchaser.InvoiceAddress.CompanyName = "iPara"; request.Purchaser.InvoiceAddress.PhoneNumber = "2122222222"; #endregion #region Kargo Adresi bilgileri request.Purchaser.ShippingAddress = new PurchaserAddress(); request.Purchaser.ShippingAddress.Name = "Murat"; request.Purchaser.ShippingAddress.SurName = "Kaya"; request.Purchaser.ShippingAddress.Address = "Mevlüt Pehlivan Mah. Multinet Plaza Şişli"; request.Purchaser.ShippingAddress.ZipCode = "34782"; request.Purchaser.ShippingAddress.CityCode = "34"; request.Purchaser.ShippingAddress.IdentityNumber = "1234567890"; request.Purchaser.ShippingAddress.CountryCode = "TR"; request.Purchaser.ShippingAddress.PhoneNumber = "2122222222"; #endregion #region Ürün bilgileri request.Products = new List <Product>(); Product p = new Product(); p.Title = "Telefon"; p.Code = "TLF0001"; p.Price = "5000"; //50.00 TL p.Quantity = 1; request.Products.Add(p); p = new Product(); p.Title = "Bilgisayar"; p.Code = "BLG0001"; p.Price = "5000"; //50.00 TL p.Quantity = 1; request.Products.Add(p); ApiPaymentResponse response = ApiPaymentRequest.Execute(request, settings); return(View(response)); #endregion }