<?php

$precio = $deuda_parc;

$titulo = "Pago Cuota";

$email = "mpiriz33@gmail";

if($precio){

	//$actual_token = "APP_USR-5649177487388413-081916-201dcbf8579dd32b5423fa93582537aa-99797963"; //cuenta pondercom 
	$actual_token = "APP_USR-300931063119414-100516-f4330152706b878b8828a2960a0b04b1-654911803"; //cuenta belen 


	   MercadoPago\SDK::setAccessToken($actual_token);
		//...
			
		// Crea un objeto de preferencia
		$preference = new MercadoPago\Preference();

		// Crea un ítem en la preferencia
		$item = new MercadoPago\Item();
		//$item->id = 123;
		$item->title = $titulo;
		$item->quantity = 1;
		$item->unit_price = $precio;
		$preference->items = array($item);
		$preference->external_reference=$id;
		
		$preference->payment_methods = array(
		  "excluded_payment_methods" => array(
			array("id"=>"redlink")
		  ),
		  
		  "excluded_payment_types" => array(
			array("id"=>"ticket")
		  )
		);
		
		# Create a payer object
		$payer = new MercadoPago\Payer();
		$payer->email = $email;
		# Setting preference properties
		$preference->payer = $payer;
		$preference->back_urls = array(
		"success" => "https://ponderzone.com/warn/ajax/examples/gestion.php?success=1",
		"failure" => "https://ponderzone.com/warn/ajax/examples/gestion.php?failure=1",
		"pending" => "https://ponderzone.com/warn/ajax/examples/gestion.php?pending=1"
		);
		
		$preference->save();
}		
	?>
	<form action="https://ponderzone.com/warn/ajax/examples/gestion.php" method="POST">
		<script src="https://www.mercadopago.com.ar/integrations/v1/web-payment-checkout.js" data-preference-id="<?php echo $preference->id; ?>" data-button-label="Mercadopago">
		</script>
	</form>
						
	