-
Notifications
You must be signed in to change notification settings - Fork 61
Invoice Items
Sometimes you want to add a charge or credit to a customer but only actually charge the customer's card at the end of a regular billing cycle. This is useful for combining several charges to minimize per-transaction fees or having Stripe tabulate your usage-based billing totals.
Godoc:
http://go.pkgdoc.org/github.com/bradrydzewski/go.stripe#InvoiceItem
Official Stripe Documentation:
https://stripe.com/docs/api#invoiceitem_object
Adds an arbitrary charge or credit to the customer's upcoming invoice.
stripe.SetKey("vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE")
params := stripe.InvoiceItemParams {
Customer : "cus_Lt6VFhU30fptWh",
Amount : 2000,
Currency : "usd",
Desc : "One-time setup fee",
}
item, err := stripe.InvoiceItems.Create(¶ms)
Input Parameters:
http://go.pkgdoc.org/github.com/bradrydzewski/go.stripe#InvoiceItemParams
Official Stripe Documentation:
https://stripe.com/docs/api#create_invoiceitem
Retrieves the invoice item with the given ID.
stripe.SetKey("vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE")
item, err := stripe.InvoiceItems.Retrieve("ii_LL5ruCWcwjqQIQ")
Official Stripe Documentation:
https://stripe.com/docs/api#retrieve_invoiceitem
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.
stripe.SetKey("vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE")
params := stripe.InvoiceItemParams {
Amount : 1500,
Desc : "Customer for [email protected]"
}
item, err := stripe.InvoiceItems.Update("ii_LL5ruCWcwjqQIQ", ¶ms)
Official Stripe Documentation:
https://stripe.com/docs/api#update_invoiceitem
Removes an invoice item from the upcoming invoice. Removing an invoice item is only possible before the invoice it's attached to is closed.
stripe.SetKey("vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE")
_, err := stripe.InvoiceItems.Delete("ii_LL5ruCWcwjqQIQ")
Official Stripe Documentation:
https://stripe.com/docs/api#delete_invoiceitem
Returns a list of your invoice items. Invoice Items are returned sorted by creation date, with the most recently created invoice items appearing first.
stripe.SetKey("vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE")
items, err := stripe.InvoiceItems.List()
Returns Invoice Items for the specified range:
// get a list of 10 invoice items, starting at position 40 in the list of invoice items
items, err := stripe.InvoiceItems.ListN(10, 40)
Returns Invoice Items for the specified customer:
items, err := stripe.InvoiceItems.CustomerList("cus_Lt6VFhU30fptWh")
Returns Invoice Items for the specified customer and range:
items, err := stripe.InvoiceItems.CustomerList("cus_Lt6VFhU30fptWh", 10, 40)
Official Stripe Documentation:
https://stripe.com/docs/api#list_invoiceitems