PHP code example of shino47 / laravel-yappy-checkout
1. Go to this page and download the library: Download shino47/laravel-yappy-checkout library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
shino47 / laravel-yappy-checkout example snippets
'providers' => [
// Otros paquetes por acá
// ...
BancoGeneral\YappyCheckout\YappyCheckoutServiceProvider::class,
],
'aliases' => [
// Otros aliases por acá
// ...
'YappyCheckout' => BancoGeneral\YappyCheckout\Facades\YappyCheckoutFacade::class,
],
use YappyCheckout;
class YeyoController extends Controller
{
public function redirectToYappyPayment()
{
$url = YappyCheckout::getPaymentUrl($orderId, $subtotal, $tax, $total);
abort_if(is_null($url), 500);
return redirect()->away($url);
}
}
// Para Laravel 8 en adelante
Route::get('/pagosbg.php', [YeyoController::class, 'yappyPaymentStatus']);
// O para versiones anteriores
Route::get('/pagosbg.php', 'YeyoController@yappyPaymentStatus');
use YappyCheckout;
use Illuminate\Http\Request;
class YeyoController extends Controller
{
public function yappyPaymentStatus(Request $request)
{
$data = YappyCheckout::getPaymentStatus($request->all());
$success = isset($data);
if ($success) {
// Mi lógica de negocio a continuación
$order = \App\Models\Order::find($data['order_id']);
$order->status = $data['status'];
$order->save();
}
return response()->json([
'success' => $success,
]);
}
}
shell
# Si sólo necesitas el archivo de configuración
php artisan vendor:publish \
--provider="BancoGeneral\YappyCheckout\YappyCheckoutServiceProvider" \
--tag=config
# Si sólo necesitas los assets para el front end
php artisan vendor:publish \
--provider="BancoGeneral\YappyCheckout\YappyCheckoutServiceProvider" \
--tag=assets
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.