Download the PHP package coderity/wallet without Composer

On this page you can find all versions of the php package coderity/wallet. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wallet

Coderity Wallet

Introduction

Coderity Wallet extends Laravel Cashier allowing users to have multiple credit cards with multiple subscriptions, along with the ability to charge different cards as needed.

Coderity Wallet still contains all the features of Laravel Cashier, with extra methods available!

Coderity Wallet currently only works with Stripe.

Installation

Wallet follows closely with the Laravel Cashier Installation Guide - with some subtle differences.

Composer

First, add the Wallet package for Stripe to your dependencies:

composer require "coderity/wallet":"~1.0"

Service Provider

If your version of Laravel is version 5.5 or greater, you can skip the following step.

Next, register the Coderity\Wallet\WalletServiceProvider ervice provider in your config/app.php configuration file.

Database Migrations

Before using Wallet, we'll also need to prepare the database. We need to add several columns to your users table and create a new subscriptions table to hold all of our customer's subscriptions:

Schema::table('users', function ($table) {
    $table->string('stripe_id')->nullable();
    $table->string('card_brand')->nullable();
    $table->string('card_last_four')->nullable();
    $table->timestamp('trial_ends_at')->nullable();
});

Schema::create('subscriptions', function ($table) {
    $table->increments('id');
    $table->integer('user_id');
    $table->string('name');
    $table->string('stripe_id');
    $table->string('stripe_plan');
    $table->integer('quantity');
    $table->timestamp('trial_ends_at')->nullable();
    $table->timestamp('ends_at')->nullable();
    $table->timestamps();
});

Once the migrations have been created, run the migrate Artisan command.

Billable Model

Next, add the Billable trait to your model definition. This trait provides various methods to allow you to perform common billing tasks, such as creating subscriptions, applying coupons, and updating credit card information:

use Coderity\Wallet\Billable;

class User extends Authenticatable
{
    use Billable;
}

API Keys

Finally, you should configure your Stripe key in your services.php configuration file. You can retrieve your Stripe API keys from the Stripe control panel:

'stripe' => [
    'model'  => App\User::class,
    'key' => env('STRIPE_KEY'),
    'secret' => env('STRIPE_SECRET'),
],

Documentation

You should be familiar with Laravel Cashier Installation Guide to see all of the methods and features available.

The following highlights the specific methods of Coderity Wallet.

Adding a Credit Card

You can add a credit card easily for a user by passing the addCard() method:

If you would like to set the new card as the default card, you can pass true as the second parameter:

If you already have a token generated, you can also pass a token as the first parameter:

Generate a Token

If you need to generate a token or even validate a credit card, use the generateToken() method:

Get all Cards

You can see all the cards for a user by passing the cards() method:

An array of cards will be returned. Note, the card ID ($card->id) will be a prefixed with card_, e.g. card_1BGBDfLBsAc3LtzZbIEQ8xpF. This is the ID you will need to use the card in other methods.

Get a Card

To get a specific card, you can pass the card ID to the getCard() method:

Charging with a Specific Card

The charge() method works the same Laravel Cashier with the following additional parameter:

This parameter will charge the specific card with $100 in this case.

Charging without a Subscription

Coderity Wallet also makes doing simple charging very easy. By passing two methods, you can easily make a one off charge (without needing the user to have signed up for a subscription):

Creating a Subscription with a Specific Card

You can create a subscription with a specific card, by including the useCard() method, before calling create() when adding a subscription.

Note that the currently functionality will actually set this card as the default card for all the user's subscriptions - this is how Stripe currently handles multiple subscriptions for a customer.

Update Default Card

Of course, you can update the default card at any stage by using the updateDefaultCard() method:

Get Default Card

If you want to get the users default card, simple use the getDefaultCard() method:

Delete a Specific Card

You can delete a specific card by passing the card ID to the deleteCard() method:

For more use cases, please refer to the Unit Tests.

Running Wallet's Tests Locally

You will need to set the following details locally and on your Stripe account in order to run the Wallet unit tests:

Environment

.env

STRIPE_KEY=
STRIPE_SECRET=
STRIPE_MODEL=User

Stripe

Plans

* monthly-10-1 ($10)

Contributing

Please read the Contributing Guide if you would like to make any suggestions for improvements to Coderity Wallet.

License

Coderity Wallet is open-sourced software licensed under the MIT license


All versions of wallet with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.9
cartalyst/stripe-laravel Version 7.0.*
laravel/cashier Version ~7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package coderity/wallet contains the following files

Loading the files please wait ....