Skip to content

Instantly share code, notes, and snippets.

@jaredk2g
Created December 11, 2017 15:46
Show Gist options
  • Save jaredk2g/4ea9a2152bc00a61f06a4d5187ca54c8 to your computer and use it in GitHub Desktop.
Save jaredk2g/4ea9a2152bc00a61f06a4d5187ca54c8 to your computer and use it in GitHub Desktop.
Creating a credit note on Invoiced in Ruby
require 'invoiced'
invoiced = Invoiced::Client.new('XXXXX', true)
customerId = 134523
invoiceId = 1213602
creditNote = invoiced.CreditNote.create(
:customer => customerId,
:invoice => invoiceId,
:items => [
{
:name => "Copy paper, Case",
:quantity => 1,
:unit_cost => 45
},
{
:catalog_item => "delivery",
:quantity => 1
}
],
:taxes => [
{
:amount => 3.85
}
]
)
print creditNote
# Retrieve the invoice to see the updated balance
print invoiced.Invoice.retrieve(invoiceId)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment