class Invoice extends Resource implements InvoiceInterface

Invoices are statements of amounts owed by a customer, and are either generated one-off, or generated periodically from a subscription.

Traits

Retrieve.
Update.
List All.
Delete.

Properties

string $id A unique identifier for the resource. from Resource
protected mixed $response A response from Stripe. from Resource

Methods

string
getId()

Returns the unique identifier for this resource.

from Resource
mixed
getResponse()

Returns the raw Stripe response.

from Resource
void
setProperties()

Set the response data as properties on the class.

from Resource
retrieve(string $id)

Get a resource by the ID.

from Retrieve
update(string $id, array $data)

Update a resource.

from Update
listAll(array $arguments = [])

List all the resources.

from ListAll
delete(string $id)

Delete a resource.

from Delete
create(CustomerInterface $customer, SubscriptionBillingTypeInterface $type, array $arguments = [], string|null $key = null)

This endpoint creates a draft invoice for a given customer. The draft invoice created pulls in all pending invoice items on that customer, including prorations.

finalizeInvoice(string $invoiceid)

Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if you’d like to finalize a draft invoice manually, you can do so using this method.

pay(string $invoiceid)

Stripe automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your subscriptions settings. However, if you’d like to attempt payment on an invoice out of the normal collection schedule or for some other reason, you can do so.

sendInvoice(string $invoiceid)

Stripe will automatically send invoices to customers according to your subscriptions settings. However, if you’d like to manually send an invoice to your customer out of the normal schedule, you can do so. When sending invoices that have already been paid, there will be no reference to the payment in the email.

voidInvoice(string $invoiceid)

Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to deletion, however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found.

markUncollectible(string $invoiceid)

Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes.

retrieveLineItems(string $invoiceid, array $arguments = [])

When retrieving an invoice, you’ll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.

upcoming(CustomerInterface $customer, array $arguments = [])

At any time, you can preview the upcoming invoice for a customer. This will show you all the charges that are pending, including subscription renewal charges, invoice item charges, etc. It will also show you any discount that is applicable to the customer.

retrieveUpcomingLineItems(CustomerInterface $customer, array $arguments = [])

When retrieving an upcoming invoice, you’ll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.

void
stripe(string $method, $arguments, string $idempotencyKey = null)

No description

Details

in Resource at line 29
string getId()

Returns the unique identifier for this resource.

Return Value

string

in Resource at line 39
mixed getResponse()

Returns the raw Stripe response.

Return Value

mixed

in Resource at line 47
protected void setProperties()

Set the response data as properties on the class.

Return Value

void

in Retrieve at line 17
Retrieve retrieve(string $id)

Get a resource by the ID.

Parameters

string $id

Return Value

Retrieve

in Update at line 18
Update update(string $id, array $data)

Update a resource.

Parameters

string $id
array $data

Return Value

Update

in ListAll at line 21
ListAll listAll(array $arguments = [])

List all the resources.

This will list all of the resources from which this trait belongs to. It will then return itself, so you can method chain it, or reuse the same instantiation.

Parameters

array $arguments

Return Value

ListAll

in Delete at line 21
Delete delete(string $id)

Delete a resource.

Delete a resource associated with the class this trait is being used. You must pass in the ID of the resource that you wish to delete. Then it will return the same instance of the class from which it was called.

Parameters

string $id

Return Value

Delete

at line 38
InvoiceInterface create(CustomerInterface $customer, SubscriptionBillingTypeInterface $type, array $arguments = [], string|null $key = null)

This endpoint creates a draft invoice for a given customer. The draft invoice created pulls in all pending invoice items on that customer, including prorations.

Parameters

CustomerInterface $customer
SubscriptionBillingTypeInterface $type
array $arguments
string|null $key

Return Value

InvoiceInterface

See also

at line 58
InvoiceInterface finalizeInvoice(string $invoiceid)

Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if you’d like to finalize a draft invoice manually, you can do so using this method.

Parameters

string $invoiceid

Return Value

InvoiceInterface

See also

at line 79
InvoiceInterface pay(string $invoiceid)

Stripe automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your subscriptions settings. However, if you’d like to attempt payment on an invoice out of the normal collection schedule or for some other reason, you can do so.

Parameters

string $invoiceid

Return Value

InvoiceInterface

See also

at line 101
InvoiceInterface sendInvoice(string $invoiceid)

Stripe will automatically send invoices to customers according to your subscriptions settings. However, if you’d like to manually send an invoice to your customer out of the normal schedule, you can do so. When sending invoices that have already been paid, there will be no reference to the payment in the email.

Parameters

string $invoiceid

Return Value

InvoiceInterface

See also

at line 121
InvoiceInterface voidInvoice(string $invoiceid)

Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to deletion, however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found.

Parameters

string $invoiceid

Return Value

InvoiceInterface

See also

at line 140
InvoiceInterface markUncollectible(string $invoiceid)

Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes.

Parameters

string $invoiceid

Return Value

InvoiceInterface

See also

at line 162
InvoiceInterface retrieveLineItems(string $invoiceid, array $arguments = [])

When retrieving an invoice, you’ll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.

Parameters

string $invoiceid
array $arguments

Return Value

InvoiceInterface

See also

at line 184
InvoiceInterface upcoming(CustomerInterface $customer, array $arguments = [])

At any time, you can preview the upcoming invoice for a customer. This will show you all the charges that are pending, including subscription renewal charges, invoice item charges, etc. It will also show you any discount that is applicable to the customer.

Parameters

CustomerInterface $customer
array $arguments

Return Value

InvoiceInterface

See also

at line 204
InvoiceInterface retrieveUpcomingLineItems(CustomerInterface $customer, array $arguments = [])

When retrieving an upcoming invoice, you’ll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.

Parameters

CustomerInterface $customer
array $arguments

Return Value

InvoiceInterface

See also

at line 212
protected void stripe(string $method, $arguments, string $idempotencyKey = null)

Parameters

string $method
$arguments
string $idempotencyKey

Return Value

void