Update showcomprar.blade.php
This commit is contained in:
@@ -10,39 +10,38 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@php
|
@php
|
||||||
// SDK de Mercado Pago
|
// SDK de Mercado Pago
|
||||||
require base_path('vendor/autoload.php');
|
require base_path('vendor/autoload.php');
|
||||||
// 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();
|
||||||
|
|
||||||
// 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 = [
|
||||||
"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
|
// Excluye el método de pago con tarjeta de crédito
|
||||||
$preference->payment_methods = array(
|
$preference->payment_methods = [
|
||||||
"excluded_payment_types" => array(
|
'excluded_payment_types' => [['id' => 'credit_card']],
|
||||||
array("id" => "credit_card")
|
'installments' => 1, // Limita la cantidad de cuotas
|
||||||
)
|
];
|
||||||
);
|
|
||||||
|
$preference->items = [$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">
|
||||||
|
|||||||
Reference in New Issue
Block a user