コード例 #1
0
        /// <summary>
        /// Сформувати дані для LiqPay (data, signature)
        /// </summary>
        /// <param name="order_id">Номер замовлення</param>
        /// <returns></returns>
        static public LiqPayCheckoutFormModel GetLiqPayModel(string order_id, int userId)
        {
            // Заповнюю дані для їх передачі для LiqPay
            var signature_source = new LiqPayCheckout()
            {
                public_key  = _public_key,
                version     = 3,
                action      = "pay",
                amount      = 10,
                currency    = "UAH",
                description = "Donation",
                order_id    = order_id,
                sandbox     = 1,

                result_url = "http://localhost:53455/Payment/Redirect?userId=" + userId,

                product_category    = "Pets",
                product_description = "Petoo donation",
                product_name        = "Donation"
            };
            var json_string    = JsonConvert.SerializeObject(signature_source);
            var data_hash      = Convert.ToBase64String(Encoding.UTF8.GetBytes(json_string));
            var signature_hash = GetLiqPaySignature(data_hash);

            // Данні для передачі у в'ю
            var model = new LiqPayCheckoutFormModel();

            model.Data      = data_hash;
            model.Signature = signature_hash;
            return(model);
        }
コード例 #2
0
        static public LiqPayCheckoutFormModel GetLiqPayModel(string order_id, int value)
        {
            var signature_source = new LiqPayCheckout()
            {
                public_key  = _public_key,
                version     = 3,
                action      = "pay",
                amount      = value,
                currency    = "UAH",
                description = "Оплата услуг Интернет и телевидения",
                order_id    = order_id,
                result_url  = "http://localhost:63897/Payment/Pay",
            };
            var json_string    = JsonConvert.SerializeObject(signature_source);
            var data_hash      = Convert.ToBase64String(Encoding.UTF8.GetBytes(json_string));
            var signature_hash = GetLiqPaySignature(data_hash);
            var model          = new LiqPayCheckoutFormModel();

            model.Data      = data_hash;
            model.Signature = signature_hash;
            return(model);
        }
コード例 #3
0
 public LiqPayData(LiqPayCheckout checkoutData)
 {
     _checkoutData         = checkoutData;
     _checkoutData.Version = ApiVersion;
 }