2017 © Pedro Peláez
 

package laravel-chargify

Laravel service provider for the chargify API using the chargley chargify SDK v0.1.3.

image

nikjaysix/laravel-chargify

Laravel service provider for the chargify API using the chargley chargify SDK v0.1.3.

  • Sunday, February 18, 2018
  • by NikJaySix
  • Repository
  • 1 Watchers
  • 0 Stars
  • 194 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 6 % Grown

The README.md

Chargify Wrapper for Laravel 5.+

This is a wrapper using the chargley chargify SDK v0.1.4. It creates a service provider and facade for autoloading into laravel., (*1)

How to Install

Laravel 5.+

  1. Install the nikjaysix/laravel-chargify package, (*2)

    $ composer require nikjaysix/laravel-chargify
    
  2. Update config/app.php to activate the LaravelChargify package, (*3)

    # Add `LaravelChargifyServiceProvider` to the `providers` array
    'providers' => array(
        ...
        NikJaySix\LaravelChargify\LaravelChargifyServiceProvider::class,
    )
    
    # Add the `LaravelChargifyFacade` to the `aliases` array
    'aliases' => array(
        ...
        'Chargify' => NikJaySix\LaravelChargify\LaravelChargifyFacade::class
    )
    
  3. Generate a Chargify config file, (*4)

    $ php artisan vendor:publish
    
  4. Update app/config/chargify.php with your chargify API credentials, (*5)

    return array(
        'hostname' => '****.chargify.com',
        'api_key' => 'chargify api key',
        'shared_key' => 'chargify shared key'
    );
    

Example Usage

Creating subscriptions with v1 of the API, (*6)


$chargify = App::make('chargify'); // $handle is the subscription handle created in chargify $new_subscription = $chargify->subscription() ->setProductHandle($handle) ->setCustomerAttributes([ 'first_name' => $user->first_name, 'last_name' => $user->last_name, 'email' => $user->email, 'reference' => $user->id ]) ->create(); if($new_subscription->isError()) { $errors = $new_subscription->getErrors(); // handle errors }

Retrieve a user's subscription, (*7)


$chargify = App::make('chargify'); $subscription = $chargify->subscription(); // $user_subscription->subscription_id is the subscription ID generated by chargify $subscription->read($user_subscription->subscription_id); if($subscription->isError()) { $errors = $subscription->getErrors(); // handle errors } // store subscription data in session foreach ($subscription as $key => $value) { session(['subscription_' . $key => $value]); }

The Versions

18/02 2018

dev-master

9999999-dev

Laravel service provider for the chargify API using the chargley chargify SDK v0.1.3.

  Sources   Download

MIT Apache 2.0

The Requires

 

by Nicole Jay

18/02 2018

v0.0.2

0.0.2.0

Laravel service provider for the chargify API using the chargley chargify SDK v0.1.3.

  Sources   Download

MIT

The Requires

 

by Nicole Jay

08/07 2017

v0.0.1

0.0.1.0

Laravel service provider for the chargify API using the chargley chargify SDK v0.1.3.

  Sources   Download

Apache 2.0

The Requires

 

by Nicole Jay