示例#1
0
        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));
        }
示例#2
0
        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));
        }