PHP code example of jgustavo99 / gerencianet-laravel5

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

    

jgustavo99 / gerencianet-laravel5 example snippets


'providers' => [
    //...
    Jgustavo99\Gerencianet\Providers\GerencianetServiceProvider::class,
]

'aliases' => [
    //...
    'Gerencianet' => Jgustavo99\Gerencianet\Facades\Gerencianet::class,
],



namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Requests;
use Gerencianet\Gerencianet;

class GerencianetController extends Controller
{
    public function create(Gerencianet $gerencianet)
    {
        /**
         * Create Charge
         */
        $items = [
            [
                'name' => 'Item 1',
                'amount' => 1,
                'value' => 1000
            ]
        ];
        
        $createCharge = $gerencianet->createCharge([], ['items' => $items]);
        
        /**
         * Create Paying Charges
         */
        $params = ['id' => $createCharge['data']['charge_id']];
        
        $customer = [
            'name' => 'Gorbadoc Oldbuck',
            'cpf' => '04267484171',
            'phone_number' => '5144916523'
        ];
        
        $body = [
            'payment' => [
                'banking_billet' => [
                    'expire_at' => '2018-12-12',
                    'customer' => $customer
                ]
            ]
        ];
        
        $payCharge = $gerencianet->payCharge($params, $body);
        
        //...
    }
}
  
sh
php artisan vendor:publish