Update showcomprar.blade.php

This commit is contained in:
lizandrogd
2024-08-13 09:44:11 -05:00
parent d7dee58d6e
commit b9be5825c1
+12 -6
View File
@@ -15,30 +15,35 @@
// Agrega credenciales // Agrega credenciales
MercadoPago\SDK::setAccessToken(config('services.mercadopago.token')); MercadoPago\SDK::setAccessToken(config('services.mercadopago.token'));
// Crea un objeto de preferencia // Crea un objeto de preferencia
$preference = new MercadoPago\Preference(); $preference = new MercadoPago\Preference();
//$payment_methods = MercadoPago::get("/v1/payment_methods");
// Crea un ítem en la preferencia // Crea un ítem en la preferencia
$item = new MercadoPago\Item(); $item = new MercadoPago\Item();
$item->id = $historial_id; $item->id = $historial_id;
$item->title = 'Compra SrPremium'; $item->title = 'Compra SrPremium';
$item->quantity = 1; $item->quantity = 1;
$item->unit_price = $monto; $item->unit_price = $monto;
$preference->back_urls = array(
$preference->back_urls = array(
"success" => url('/compras/'), "success" => url('/compras/'),
"failure" => url('/compras/error'), "failure" => url('/compras/error'),
"pending" => url('/compras/pendiente') "pending" => url('/compras/pendiente')
); );
$preference->auto_return = "approved"; $preference->auto_return = "approved";
// Excluye el método de pago con tarjeta de crédito
$preference->payment_methods = array(
"excluded_payment_types" => array(
array("id" => "credit_card")
)
);
$preference->items = array($item); $preference->items = array($item);
$preference->save(); $preference->save();
@endphp @endphp
<div class="grid grid-cols-1 mb-8"> <div class="grid grid-cols-1 mb-8">
<div class="bg-white w-full sm:w-[26rem] m-auto justify-center rounded-xl shadow-md"> <div class="bg-white w-full sm:w-[26rem] m-auto justify-center rounded-xl shadow-md">
<div class="text-center bg-[#000029] text-white text-lg font-semibold rounded-lg py-2 mb-4"> <div class="text-center bg-[#000029] text-white text-lg font-semibold rounded-lg py-2 mb-4">
@@ -61,7 +66,8 @@
<div class="bg-white px-4 py-3 md:flex justify-center mt-2 mb-4"> <div class="bg-white px-4 py-3 md:flex justify-center mt-2 mb-4">
<a href="javascript:location.reload()"> <a href="javascript:location.reload()">
<button class="inline-flex justify-center w-full rounded-md border border-transparent px-12 py-2 sm:mb-[0] mb-2 text-white bg-[#B221FD] hover:bg-[#7a02b8] focus:shadow-outline-green ease-in-out sm-text-sm sm-leading-5">Continuar</button> <button
class="inline-flex justify-center w-full rounded-md border border-transparent px-12 py-2 sm:mb-[0] mb-2 text-white bg-[#B221FD] hover:bg-[#7a02b8] focus:shadow-outline-green ease-in-out sm-text-sm sm-leading-5">Continuar</button>
</a> </a>
</div> </div>
</div> </div>