PHP Trait Laravel\Cashier\Billable

Show file Open project: laravel/cashier-braintree

Public Methods

Method Description
applyCoupon ( string $coupon, string $subscription = 'default', boolean $removeOthers = false ) : void Apply a coupon to the billable entity.
asBraintreeCustomer ( ) : Customer Get the Braintree customer for the user.
charge ( integer $amount, array $options = [] ) : Transaction Make a "one off" charge on the customer for the given amount.
createAsBraintreeCustomer ( string $token, array $options = [] ) : Customer Create a Braintree customer for the given user.
downloadInvoice ( string $id, array $data, string $storagePath = null ) : Response Create an invoice download Response.
findInvoice ( string $id ) : Invoice | null Find an invoice by ID.
findInvoiceOrFail ( string $id ) : Invoice Find an invoice or throw a 404 error.
hasBraintreeId ( ) : boolean Determine if the entity has a Braintree customer ID.
invoiceFor ( string $description, integer $amount, array $options = [] ) : Transaction Invoice the customer for the given amount.
invoices ( boolean $includePending = false, array $parameters = [] ) : Collection Get a collection of the entity's invoices.
invoicesIncludingPending ( array $parameters = [] ) : Collection Get an array of the entity's invoices.
newSubscription ( string $subscription, string $plan ) : SubscriptionBuilder Begin creating a new subscription.
onGenericTrial ( ) : boolean Determine if the user is on a "generic" trial at the user level.
onPlan ( string $plan ) : boolean Determine if the entity is on the given plan.
onTrial ( string $subscription = 'default', string | null $plan = null ) : boolean Determine if the user is on trial.
subscribed ( string $subscription = 'default', string | null $plan = null ) : boolean Determine if the user has a given subscription.
subscribedToPlan ( array | string $plans, string $subscription = 'default' ) : boolean Determine if the user is actively subscribed to one of the given plans.
subscription ( string $subscription = 'default' ) : Subscription | null Get a subscription instance by name.
subscriptions ( ) : Illuminate\Database\Eloquent\Collection Get all of the subscriptions for the user.
taxPercentage ( ) : integer Get the tax percentage to apply to the subscription.
updateCard ( string $token, array $options = [] ) : void Update customer's credit card.

Protected Methods

Method Description
updateSubscriptionsToPaymentMethod ( string $token ) : void Update the payment method token for all of the user's subscriptions.

Method Details

applyCoupon() public method

Apply a coupon to the billable entity.
public applyCoupon ( string $coupon, string $subscription = 'default', boolean $removeOthers = false ) : void
$coupon string
$subscription string
$removeOthers boolean
return void

asBraintreeCustomer() public method

Get the Braintree customer for the user.
public asBraintreeCustomer ( ) : Customer
return Braintree\Customer

charge() public method

Make a "one off" charge on the customer for the given amount.
public charge ( integer $amount, array $options = [] ) : Transaction
$amount integer
$options array
return Braintree\Transaction

createAsBraintreeCustomer() public method

Create a Braintree customer for the given user.
public createAsBraintreeCustomer ( string $token, array $options = [] ) : Customer
$token string
$options array
return Braintree\Customer

downloadInvoice() public method

Create an invoice download Response.
public downloadInvoice ( string $id, array $data, string $storagePath = null ) : Response
$id string
$data array
$storagePath string
return Symfony\Component\HttpFoundation\Response

findInvoice() public method

Find an invoice by ID.
public findInvoice ( string $id ) : Invoice | null
$id string
return Invoice | null

findInvoiceOrFail() public method

Find an invoice or throw a 404 error.
public findInvoiceOrFail ( string $id ) : Invoice
$id string
return Invoice

hasBraintreeId() public method

Determine if the entity has a Braintree customer ID.
public hasBraintreeId ( ) : boolean
return boolean

invoiceFor() public method

Invoice the customer for the given amount.
public invoiceFor ( string $description, integer $amount, array $options = [] ) : Transaction
$description string
$amount integer
$options array
return Braintree\Transaction

invoices() public method

Get a collection of the entity's invoices.
public invoices ( boolean $includePending = false, array $parameters = [] ) : Collection
$includePending boolean
$parameters array
return Illuminate\Support\Collection

invoicesIncludingPending() public method

Get an array of the entity's invoices.
public invoicesIncludingPending ( array $parameters = [] ) : Collection
$parameters array
return Illuminate\Support\Collection

newSubscription() public method

Begin creating a new subscription.
public newSubscription ( string $subscription, string $plan ) : SubscriptionBuilder
$subscription string
$plan string
return SubscriptionBuilder

onGenericTrial() public method

Determine if the user is on a "generic" trial at the user level.
public onGenericTrial ( ) : boolean
return boolean

onPlan() public method

Determine if the entity is on the given plan.
public onPlan ( string $plan ) : boolean
$plan string
return boolean

onTrial() public method

Determine if the user is on trial.
public onTrial ( string $subscription = 'default', string | null $plan = null ) : boolean
$subscription string
$plan string | null
return boolean

subscribed() public method

Determine if the user has a given subscription.
public subscribed ( string $subscription = 'default', string | null $plan = null ) : boolean
$subscription string
$plan string | null
return boolean

subscribedToPlan() public method

Determine if the user is actively subscribed to one of the given plans.
public subscribedToPlan ( array | string $plans, string $subscription = 'default' ) : boolean
$plans array | string
$subscription string
return boolean

subscription() public method

Get a subscription instance by name.
public subscription ( string $subscription = 'default' ) : Subscription | null
$subscription string
return Subscription | null

subscriptions() public method

Get all of the subscriptions for the user.
public subscriptions ( ) : Illuminate\Database\Eloquent\Collection
return Illuminate\Database\Eloquent\Collection

taxPercentage() public method

Get the tax percentage to apply to the subscription.
public taxPercentage ( ) : integer
return integer

updateCard() public method

Update customer's credit card.
public updateCard ( string $token, array $options = [] ) : void
$token string
$options array
return void

updateSubscriptionsToPaymentMethod() protected method

Update the payment method token for all of the user's subscriptions.
protected updateSubscriptionsToPaymentMethod ( string $token ) : void
$token string
return void