Created
December 11, 2017 15:46
-
-
Save jaredk2g/4ea9a2152bc00a61f06a4d5187ca54c8 to your computer and use it in GitHub Desktop.
Creating a credit note on Invoiced in Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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