PHP Class Laravel\Cashier\SubscriptionBuilder

Show file Open project: laravel/cashier-braintree

Protected Properties

Property Type Description
$coupon string | null The coupon code being applied to the customer.
$name string The name of the subscription.
$plan string The name of the plan being subscribed to.
$skipTrial boolean Indicates that the trial should end immediately.
$trialDays integer | null The number of trial days to apply to the subscription.
$user Illuminate\Database\Eloquent\Model The user model that is subscribing.

Public Methods

Method Description
__construct ( mixed $user, string $name, string $plan ) : void Create a new subscription builder instance.
add ( array $options = [] ) : Subscription Add a new Braintree subscription to the user.
create ( string | null $token = null, array $customerOptions = [], array $subscriptionOptions = [] ) : Subscription Create a new Braintree subscription.
skipTrial ( ) Force the trial to end immediately.
trialDays ( integer $trialDays ) Specify the ending date of the trial.
withCoupon ( string $coupon ) The coupon to apply to a new subscription.

Protected Methods

Method Description
addCouponToPayload ( array $payload ) : array Add the coupon discount to the Braintree payload.
getBraintreeCustomer ( string | null $token = null, array $options = [] ) : Customer Get the Braintree customer instance for the current user and token.
getSubscriptionPayload ( Customer $customer, array $options = [] ) : array Get the base subscription payload for Braintree.

Method Details

__construct() public method

Create a new subscription builder instance.
public __construct ( mixed $user, string $name, string $plan ) : void
$user mixed
$name string
$plan string
return void

add() public method

Add a new Braintree subscription to the user.
public add ( array $options = [] ) : Subscription
$options array
return Subscription

addCouponToPayload() protected method

Add the coupon discount to the Braintree payload.
protected addCouponToPayload ( array $payload ) : array
$payload array
return array

create() public method

Create a new Braintree subscription.
public create ( string | null $token = null, array $customerOptions = [], array $subscriptionOptions = [] ) : Subscription
$token string | null
$customerOptions array
$subscriptionOptions array
return Subscription

getBraintreeCustomer() protected method

Get the Braintree customer instance for the current user and token.
protected getBraintreeCustomer ( string | null $token = null, array $options = [] ) : Customer
$token string | null
$options array
return Braintree\Customer

getSubscriptionPayload() protected method

Get the base subscription payload for Braintree.
protected getSubscriptionPayload ( Customer $customer, array $options = [] ) : array
$customer Braintree\Customer
$options array
return array

skipTrial() public method

Force the trial to end immediately.
public skipTrial ( )

trialDays() public method

Specify the ending date of the trial.
public trialDays ( integer $trialDays )
$trialDays integer

withCoupon() public method

The coupon to apply to a new subscription.
public withCoupon ( string $coupon )
$coupon string

Property Details

$coupon protected property

The coupon code being applied to the customer.
protected string|null $coupon
return string | null

$name protected property

The name of the subscription.
protected string $name
return string

$plan protected property

The name of the plan being subscribed to.
protected string $plan
return string

$skipTrial protected property

Indicates that the trial should end immediately.
protected bool $skipTrial
return boolean

$trialDays protected property

The number of trial days to apply to the subscription.
protected int|null $trialDays
return integer | null

$user protected property

The user model that is subscribing.
protected Model,Illuminate\Database\Eloquent $user
return Illuminate\Database\Eloquent\Model