Question

I have a rails app where I have a model invoice. It interacts with quick books through api and I want to export my local invoices to quick books. I can't figure out how to export them to quick books.

According to this link http://ippdocs.intuit.com/0025_QuickBooksAPI/0050_Data_Services/030_Entity_Services_Reference/Invoice , "Creating an Invoice" section, I have to do this:

current_user.invoices do |invoice|
  data = { 
    "Line" => [
      {
        "Amount" => 100.00, 
        "DetailType" => "SalesItemLineDetail", "SalesItemLineDetail" => {"ItemRef" => {value: 1, name: "Services"}}
      }
    ],
    "CustomerRef" => {value: 21}
  }

  consumer = create_consumer
  response = consumer.post "https://quickbooks.api.intuit.com/v3/company/#{my_company_id}/invoice", data
  p "-------response:-------", response
end

But it never prints anything to console and there is no error either. What did I do wrong?

Was it helpful?

Solution

You may want to try adding the CustomerName. In the version 2 API the CustomerName was required for invoices even though the documentation said otherwise. I am not sure if this has been corrected in the new version 3 API.

Update and Correction: CustomerName xml node does not exist on the v3 API for the Invoice entity.

Also, let me highly suggest the quickbooks-ruby gem. It is rapidly becoming mature, is very active with 14 contributors, and has rich tutorials and screencasts.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top