stripity_stripe v1.6.0 Stripe.Invoices

Main API for working with Invoices at Stripe. Through this API you can: -create -update -retrieve single -list (paged, 100 max/page) -count

All calls have a version with accept a key parameter for leveraging Connect.

(API ref:https://stripe.com/docs/api#invoices)

Summary

Functions

Changes Invoice. See Stripe docs as to what you can change

Count number of invoices.

Example

Count number of invoices. Using a given stripe key to apply against the account associated.

Example

Create invoice according to Stripe’s invoice rules. This is not the same as a charge

Create invoice according to Stripe’s invoice rules. This is not the same as a charge. Using a given stripe key to apply against the account associated

Retrieves a given Invoice with the specified ID. Returns 404 if not found. Using a given stripe key to apply against the account associated.

Example

Lists invoices with a default limit of 10. You can override this by passing in a l imit

Lists invoices with a default limit of 10. You can override this by passing in a limit. Using a given stripe key to apply against the account associated

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

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

Retrieve the upcoming invoice for a customer that 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. NOTE: this is a preview, not a created invoice

Retrieve the upcoming invoice for a customer that 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. NOTE: this is a preview, not a created invoice Using a given stripe key to apply against the account associated

Functions

change(id, params)

Changes Invoice. See Stripe docs as to what you can change.

Example

  {:ok, invoice} = Stripe.Invoices.change("invoice_id", [closed: true])
change(id, params, key)
count()

Count number of invoices.

Example

{:ok, cnt} = Stripe.Invoices.count
count(key)

Count number of invoices. Using a given stripe key to apply against the account associated.

Example

{:ok, cnt} = Stripe.Invoices.count key
create(customer_id, params)

Create invoice according to Stripe’s invoice rules. This is not the same as a charge.

Example

params = [
  subscription: "subscription_id"
  metadata: [
      app_order_id: "ABC123",
      app_attr1: "xyz"
  ]
]
{:ok, invoice} = Stripe.Invoices.create "customer_id", params
create(customer_id, params, key)

Create invoice according to Stripe’s invoice rules. This is not the same as a charge. Using a given stripe key to apply against the account associated.

Example

params = [
  subscription: "subscription_id"
  metadata: [
      app_order_id: "ABC123",
      app_attr1: "xyz"
  ]
{:ok, invoice} = Stripe.Invoices.create "customer_id", params, key
get(id)
get(id, key)

Retrieves a given Invoice with the specified ID. Returns 404 if not found. Using a given stripe key to apply against the account associated.

Example

{:ok, cust} = Stripe.Invoices.get "customer_id", key
list(starting_after, limit \\ 10)

Lists invoices with a default limit of 10. You can override this by passing in a l imit.

Examples

{:ok, invoices} = Stripe.Invoices.list(starting_after,100)
list(key, starting_after, limit)

Lists invoices with a default limit of 10. You can override this by passing in a limit. Using a given stripe key to apply against the account associated.

Examples

{:ok, invoices} = Stripe.Invoices.list(key,starting_after,100)
pay(invoice_id)

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

Example

{:ok, invoice} = Stripe.Invoices.pay “invoice_id”

pay(invoice_id, key)

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

Example

{:ok, invoice} = Stripe.Invoices.pay “invoice_id”, key

upcoming(customer_id, params)

Retrieve the upcoming invoice for a customer that 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. NOTE: this is a preview, not a created invoice

Example

{:ok, upcoming_invoice} = Stripe.Invoices.upcoming "customer_id", [subscription: "sub_id"]
upcoming(customer_id, params, key)

Retrieve the upcoming invoice for a customer that 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. NOTE: this is a preview, not a created invoice Using a given stripe key to apply against the account associated.

Example

{:ok, upcoming_invoice} = Stripe.Invoices.upcoming "customer_id", [subscription: "sub_id"], "key"