PHP code example of bcismariu / laravel-payments

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

    

bcismariu / laravel-payments example snippets


use Bcismariu\Laravel\Payments\Billable;

class User
{
    use Billable;

$user->setCreditCard(new Card([
    'brand'     => 'visa',
    'number'    => '0000000000000000',
    'exp_month' => '02',
    'exp_year'  => '2017',
    'cvc_check' => '123', 
]));

$response = $user->charge(5, [
        'product_id'    => 1234
    ]);


// Import the Credit Card info into your User object:

$user->setCreditCard(new Card([
    'brand'     => 'visa',
    'number'    => '0000000000000000',
    'exp_month' => '02',
    'exp_year'  => '2017',
    'cvc_check' => '123', 
]));

// Register the subscription and charge a certain amount:

$subscription = $user->subscribe('plan-name', 5);

// Check if the user has subscribed to a given plan

$user->subscribed('plan-name');

php artisan vendor:publish --provider="Bcismariu\\Laravel\\Payments\\PaymentsServiceProvider" --tag="config" --force

php artisan migrate