Exemplo n.º 1
1
        protected void Boton_Mercado_Pago_Click(object sender, EventArgs e)
        {
            decimal Valor_Carga = LBCDC.Mercado_Pago(TextBox_Mercado_Pago.Text, TextBox_Mercado_Pago_Movil.Text, TextBox_PagoFacil.Text, TextBox_PagoFacil_Movil.Text); // analisis de donde pidio la carga pc o movil

            if (Valor_Carga == -9) // fallo los botones en javascript
            {
                return;
            }

            MP mp = new MP("7071654091217780", "F4SUQfv2CA4YUvPj0VsFROGywMkcYvyC");

            Hashtable preference = mp.createPreference("{\"items\":[{\"title\":\"clases\",\"quantity\":1,\"currency_id\":\"ARS\",\"unit_price\":" + Valor_Carga + "}],\"external_reference\":\"" + (string)Session["Usuario"] + "\"}");

            String accessToken = mp.getAccessToken();

            Response.Redirect((((Hashtable)preference["response"])["init_point"]).ToString());
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // https://github.com/mercadopago/sdk-dotnet

            // tests - sandbox
            // https://www.mercadopago.com.co/developers/en/solutions/payments/basic-checkout/test/basic-sandbox/
            // <a href="<% Response.Write(preference["response"]["sandbox_init_point"]); %>">Pay</a>
            // production
            // href="<%= mercadoPreference["response"]["init_point"] %>"

            if (Session["Payment_ID"] == null || Session["Payment_Total"] == null)
            {
                alert.InnerText = "Información de pago no encontrada.";
            }
            else
            {
                MP mp = new MP(Global.Configuration.Payments.Mercadopago.Basic.GetClientID()
                               , Global.Configuration.Payments.Mercadopago.Basic.GetClientSecret());


                if (Global.Configuration.Development.GetIsEnabledDeveloperMode())
                {
                    mp.sandboxMode(true);
                }


                string accessToken = mp.getAccessToken();


                // https://www.mercadopago.com.co/developers/es/solutions/payments/basic-checkout/receive-payments/additional-info/
                // Available currencies at: https://api.mercadopago.com/currencies
                string preferenceData = "{\"items\":" +
                                        "[{" +
                                        "\"title\":\"Factura\"," +
                                        "\"quantity\":1," +
                                        "\"currency_id\":\"COP\"," +
                                        "\"unit_price\":100.0" +
                                        "}]" +
                                        "}";

                Hashtable preference = mp.createPreference(preferenceData);

                //paylinkURL = preference["response"]["sandbox_init_point"];
                alert.InnerText = Server.HtmlEncode(preference["response"].ToString());

                if (Global.Configuration.Development.GetIsEnabledDeveloperMode())
                {
                }
                else
                {
                }
            }
        }
Exemplo n.º 3
0
        /* Call preference added through button flow */
        public void getAccessToken()
        {
            String at = mp.getAccessToken();

            Assert.IsNotNull(at);
        }