Update showcomprar.blade.php
This commit is contained in:
@@ -10,39 +10,38 @@
|
||||
</div>
|
||||
</div>
|
||||
@php
|
||||
// SDK de Mercado Pago
|
||||
require base_path('vendor/autoload.php');
|
||||
// Agrega credenciales
|
||||
MercadoPago\SDK::setAccessToken(config('services.mercadopago.token'));
|
||||
|
||||
// Crea un objeto de preferencia
|
||||
$preference = new MercadoPago\Preference();
|
||||
|
||||
// Crea un ítem en la preferencia
|
||||
$item = new MercadoPago\Item();
|
||||
$item->id = $historial_id;
|
||||
$item->title = 'Compra SrPremium';
|
||||
$item->quantity = 1;
|
||||
$item->unit_price = $monto;
|
||||
|
||||
$preference->back_urls = array(
|
||||
"success" => url('/compras/'),
|
||||
"failure" => url('/compras/error'),
|
||||
"pending" => url('/compras/pendiente')
|
||||
);
|
||||
$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->save();
|
||||
// SDK de Mercado Pago
|
||||
require base_path('vendor/autoload.php');
|
||||
// Agrega credenciales
|
||||
MercadoPago\SDK::setAccessToken(config('services.mercadopago.token'));
|
||||
|
||||
// Crea un objeto de preferencia
|
||||
$preference = new MercadoPago\Preference();
|
||||
|
||||
// Crea un ítem en la preferencia
|
||||
$item = new MercadoPago\Item();
|
||||
$item->id = $historial_id;
|
||||
$item->title = 'Compra SrPremium';
|
||||
$item->quantity = 1;
|
||||
$item->unit_price = $monto;
|
||||
|
||||
$preference->back_urls = [
|
||||
'success' => url('/compras/'),
|
||||
'failure' => url('/compras/error'),
|
||||
'pending' => url('/compras/pendiente'),
|
||||
];
|
||||
$preference->auto_return = 'approved';
|
||||
|
||||
// Excluye el método de pago con tarjeta de crédito
|
||||
$preference->payment_methods = [
|
||||
'excluded_payment_types' => [['id' => 'credit_card']],
|
||||
'installments' => 1, // Limita la cantidad de cuotas
|
||||
];
|
||||
|
||||
$preference->items = [$item];
|
||||
$preference->save();
|
||||
@endphp
|
||||
|
||||
|
||||
|
||||
<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">
|
||||
|
||||
Reference in New Issue
Block a user