Skip to content

Instantly share code, notes, and snippets.

View JuaniVeltri's full-sized avatar
:octocat:
Focusing

Juan Ignacio Veltri JuaniVeltri

:octocat:
Focusing
View GitHub Profile
@JuaniVeltri
JuaniVeltri / exclude_payments_options.php
Created March 20, 2019 13:15
Crear pago excluyendo medios de pago
<?php
require_once 'vendor/autoload.php';
MercadoPago\SDK::setAccessToken("ACCESS_TOKEN");
# Create a preference object
$preference = new MercadoPago\Preference();
using MercadoPago;
using MercadoPago.DataStructures.Payment;
using MercadoPago.Resources;
//...
MercadoPago.SDK.SetAccessToken("ENV_ACCESS_TOKEN");
Payment payment = new Payment()
{
TransactionAmount = float.Parse("105"),
Description = "Awesome Wooden Wallet",
@JuaniVeltri
JuaniVeltri / CrearPago.cs
Last active January 15, 2019 19:54
Creación de pago .NET
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AdminLTE.Data;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MercadoPago;
using MercadoPago.Resources;
using MercadoPago.DataStructures.Payment;
@JuaniVeltri
JuaniVeltri / CrearPago.php
Created January 3, 2019 14:32
Creación de pago en PHP
<?php
require_once 'vendor/autoload.php';
MercadoPago\SDK::setAccessToken("TEST-563211749753176........5738894");
//...
$payment = new MercadoPago\Payment();
$payment->transaction_amount = 108;
$payment->token = "5a42b6cf9b6....7145b6fd";
$payment->description = "Fantastic Wooden Computer";
$payment->installments = 1;
@JuaniVeltri
JuaniVeltri / WebCheckoutModal.html
Created December 28, 2018 14:26
WebCheckout Modal
<!DOCTYPE html>
<html>
<head>
<title>Pagar</title>
</head>
<body>
<a mp-mode="modal" href="<?php echo $preference->init_point; ?>">Pagar</a>
<script type="text/javascript">
(function(){function $MPC_load(){window.$MPC_loaded !== true && (function(){var s = document.createElement("script");s.type = "text/javascript";s.async = true;s.src = document.location.protocol+"//secure.mlstatic.com/mptools/render.js";var x = document.getElementsByTagName('script')[0];x.parentNode.insertBefore(s, x);window.$MPC_loaded = true;})();}window.$MPC_loaded !== true ? (window.attachEvent ?window.attachEvent('onload', $MPC_load) : window.addEventListener('load', $MPC_load, false)) : null;})();
@JuaniVeltri
JuaniVeltri / VBtokenizer.vb
Created December 27, 2018 20:50
VB demo Tokenizer
Imports MercadoPago
Imports System.Net
Imports MercadoPago.Resources
Imports MercadoPago.DataStructures.Payment
Imports System
Public Class Application
Public Shared Sub Main()
Pagar("token", 1, "visa", "310", 100.0, "mail@pepito.com", "test_access_token")
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
</head>
<body>
<form action="/procesar-pago" method="POST">
@JuaniVeltri
JuaniVeltri / shippingSDK.php
Last active March 29, 2019 20:22
Ejemplo de uso de calculador de shipping usando SDK de PHP de MercadoPago
<?php
require_once 'vendor/autoload.php';
MercadoPago\SDK::setClientId("CLIENT_ID");
MercadoPago\SDK::setClientSecret("CLIENT_SECRET");
$envio = MercadoPago\SDK::get("/shipping_options", array(
"url_query" => array(