Subscription membership module for Infuse Framework
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.coveralls.yml
.gitattributes
.gitignore
.travis.yml
LICENSE
README.md
composer.json
config.php
phinx.yml
phpunit.xml.dist

README.md

infuse/billing

Build Status Coverage Status Latest Stable Version Total Downloads

Subscription membership module for Infuse Framework powered by Stripe

Installation

  1. Install the package with composer:

     composer require infuse/billing
    
  2. Add a billing section in your app's configuration:

    'billing' => [
    	'model' => 'App\Users\Models\User',
    	'emails' => [
    		'trial_will_end' => true,
    		'trial_ended' => true,
    		'failed_payment' => true,
    		'payment_receipt' => true,
    		'subscription_canceled' => true
    	],
    	'defaultPlan' => 'default_plan',
    	'trialWillEndReminderDays' => 3
    ]
  3. Add the console command to run jobs to console.commands in your app's configuration:

    'console' => [
    	// ...
    	'commands' => [
    		// ...
    		'Infuse\Billing\Console\ExtendTrialCommand',
    		'Infuse\Billing\Console\SyncStripeSubscriptionsCommand',
    		'Infuse\Billing\Console\SyncStripeProfilesCommand'
    	]
    ]
  4. Add the migration to your app's configuration:

    'modules' => [
       'migrations' => [
          // ...
          'Billing'
       ],
       'migrationPaths' => [
          // ...
          'Billing' => 'vendor/infuse/billing/src/migrations'
       ]
    ]
  5. (optional) Add the following scheduled job to your app's configuration:

    'cron' => [
    	// ...
    	[
    	    'id' => 'billing:sendTrialReminders',
    	    'class' => 'Infuse\Billing\Jobs\SendTrialReminders',
    	    'minute' => 0,
    	    'expires' => 1800 // 30 minutes
    	]
    ]
  6. (optional) Add an endpoint to your routing table to receive Stripe webhooks:

    'routes' => [
    	// ...
    	'POST /billing/webhook' => [
    		'Infuse\Billing\Libs\StripeWebhook',
    		'webhook'
        ]
    ]