PHP code example of ggphp / laravel-payment

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

    

ggphp / laravel-payment example snippets


use GGPHP\Payment\CustomerPaymentTrait;

class User extends Eloquent
{
  use CustomerPaymentTrait;
}

$user = User::find(1);

$user->payment()->create();

$user->payment()->create([
  'email' => $email,
]);

$user->payment()->update([
  'email' => $email,
]);

$user->payment()->delete();

$card = $user->card()->create('credit_card_token');

$charge = $user->charges()->create(5996, ['description' => 'description']);

$user = User::find(1);

$card = $user->card()->create('credit_card_token');

$cards $user->card()->all();

$card = $user->card()->first();

$card = $user->card()->find('id_card');

$card = $card->update([
  'exp_month' => '1'
]);

$card->delete();

$charge = $user->charges()->create(499);

$user->charges()->create(499, [
  'email' => $email,
]);

$charge = $user->charges()->withCardToken('token')->create(499);

$charge = $user->charges()->withCard('card_id')->create(499);

$charge = $user->charges()->create(499, array('capture' => false));

$charge->capture();

$charge->refund();

$charge->refund([
  'amount' => 399,
  'reason' => 'reason'
]);

$cards $user->charges()->all();

$card = $user->charges()->first();

$card = $charge->update([
  'description' => 'description'
]);
console
php artisan migrate