PHP code example of darkghosthunter / transbanker

1. Go to this page and download the library: Download darkghosthunter/transbanker 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/ */

    

darkghosthunter / transbanker example snippets


<?

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use DarkGhostHunter\Transbanker\Facades\Webpay;

class PaymentController extends Controller {
    
    /**
     * Creates a Payment
     * 
     * @param Request $request
     * @return \Illuminate\View\View
     */
    public function pay(Request $request)
    {
        // .. Validate Request, amount, etc..
        
        $response = Webpay::createNormal([
            'sessionId' => $request->session()->getId(),
            'buyOrder'  => 'myOrder#16548',
            'amount'    => 1000,
        ]);
        
        return view('transbanker::webpay-redirect', [
            'response' => $response            
        ]);
    }
    
}
bash
php artisan vendor:publish --provider="DarkGhostHunter\Transbanker\TransbankerServiceProvider"