Packages
stripity_stripe
0.3.0
3.3.2
3.3.1
3.2.0
3.1.1
3.1.0
3.0.0
2.17.3
2.17.2
2.17.1
2.17.0
2.16.0
2.15.1
2.15.0
2.14.1
2.14.0
2.13.0
2.12.1
2.12.0
2.11.0
2.10.0
2.9.0
2.8.0
2.7.2
2.7.1
2.7.0
2.6.0
2.5.0
2.4.0
2.3.0
2.2.3
2.2.2
2.2.1
2.2.0
2.1.0
2.0.1
2.0.0
2.0.0-alpha.11
2.0.0-alpha.10
2.0.0-alpha.9
2.0.0-alpha.8
2.0.0-alpha.7
2.0.0-alpha.6
2.0.0-alpha.5
2.0.0-alpha.4
2.0.0-alpha.3
2.0.0-alpha.2
2.0.0-alpha.1
1.6.2
1.6.1
1.6.0
1.4.0
1.3.0
1.2.0
1.1.0
0.5.0
0.4.0
0.3.0
0.2.0
A Stripe client for Elixir.
Current section
Files
Jump to
Current section
Files
lib/stripe/invoice_items.ex
defmodule Stripe.InvoiceItems do
@moduledoc """
The API for tacking on charges to subscriptions. See Stripe docs for more details.
"""
@endpoint "invoiceitems"
@doc """
Returns a list of InvoiceItems
"""
def list do
Stripe.make_request(:get, @endpoint)
|> Stripe.Util.handle_stripe_response
end
@doc """
Creates an InvoiceItem for a Customer/Subscription
"""
def create(params) do
Stripe.make_request(:post, @endpoint, params)
|> Stripe.Util.handle_stripe_response
end
@doc """
Retrieves the invoice item with the given ID.
## Arguments
- `id` - `String` - (required) - The ID of the desired invoice item.
## Returns
Returns an invoice item if a valid invoice item ID was provided. Returns
an error otherwise.
"""
def retrieve(id) do
Stripe.make_request(:get, @endpoint <> "/#{id}")
|> Stripe.Util.handle_stripe_response
end
@doc """
Updates the amount or description of an invoice item on an upcoming invoice.
Updating an invoice item is only possible before the invoice it's attached
to is closed.
## Arguments
- `amount` - `Integer` - (required) - The integer amount in cents of
the charge to be applied to the upcoming invoice. If you want to
apply a credit to the customer's account, pass a negative amount.
- `description` - `String` - (optional), default is `null` - An arbitrary
string which you can attach to the invoice item. The description is
displayed in the invoice for easy tracking.
- `metadata` - `Keyword` - (optional), default is `[]` - A set of
key/value pairs that you can attach to an invoice item object. It can
be useful for storing additional information about the invoice item in
a structured format.
## Returns
The updated invoice item object is returned upon success. Otherwise, this
call returns an error.
"""
def update(params) do
Stripe.make_request(:post, @endpoint <> "/#{params[:id]}", params)
|> Stripe.Util.handle_stripe_response
end
@doc """
Removes an invoice item from the upcoming invoice. Removing an invoice
item is only possible before the invoice it's attached to is closed.
## Arguments
- `id` - `String` - (required) - The ID of the desired invoice item.
## Returns
An object with the deleted invoice item's ID and a deleted flag upon
success. This call returns an error otherwise, such as when the invoice
item has already been deleted.
"""
def delete(id) do
Stripe.make_request(:delete, @endpoint <> "/#{id}")
|> Stripe.Util.handle_stripe_response
end
end