PHP code example of oixan / cashier-connect

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

    

oixan / cashier-connect example snippets


    $user->setStripeAccount($userAccount)->newSubscription('main', 'plan_id')->create("pm_card_visa");
 

 $user->newSubscription('main', 'monthly')->create($token, [
    'email' => $email,
]);
 

 if ($user->subscribed('main')) {
    //
}
 

 if ($user->subscribedToPlan('monthly', 'main')) {
    //
}

if ($user->subscription('main')->recurring()) {
    //
}

if ($user->subscription('main')->cancelled()) {
    //
}

if ($user->subscription('main')->onGracePeriod()) {
    //
}

if ($user->subscription('main')->ended()) {
    //
}

$user->subscription('main')->swap('provider-plan-id');

$user->subscription('main')->incrementQuantity();

// Add five to the subscription's current quantity...
$user->subscription('main')->incrementQuantity(5);

$user->subscription('main')->decrementQuantity();

// Subtract five to the subscription's current quantity...
$user->subscription('main')->decrementQuantity(5);

$user->newSubscription('main', 'premium')
     ->anchorBillingCycleOn( Carbon::parse('first day of next month'))
     ->create($token);

$user->newSubscription('main', 'monthly')
            ->trialDays(10)
            ->create($token);

$user->newSubscription('main', 'monthly')
        ->trialUntil(Carbon::now()->addDays(10))
        ->create($token);

$user->onTrial('main')

$user->subscription('main')->onTrial()

$user->subscription('main')->cancel();

if ($user->subscription('main')->onGracePeriod()) {
    //
}

$user->subscription('main')->cancelNow();

$user->subscription('main')->resume();

public function applicationFeePercent()
{
    return 40;
}