Emailing receipts(purchase orders) through api

Discussion in 'Developers Forum' started by robgoodliffe, May 19, 2011.

  1. robgoodliffe New Member

    Could anybody confirm if it's possible to email receipts/purchase orders through the api? I presumed that you would be able to do this using the EmailInvoice method but i get a "The Invoice could not be found" error returned. I'm using the receipt number returned from the insertReceipt method as below.

    EmailInvoice($receipt_number, $vendor_email, $from_name, $subject_line, $body, $supplier_email);

    Thanks
  2. robgoodliffe New Member

    Well I've had a good look through the API manual and tested my code with some invoice numbers and it appears that this feature isn't available. Seems like a strange omission as it's a feature of Kashflow when logging in directly?

    Will have to create my own pdf using the GetReceipt method.
  3. knu New Member

    Hello Rob,

    Are you sure you want to email a Receipt? Not an invoice? And if so, to whom?

    I would usually expect that it would be your suppliers who would be sending you this information - which you would then add to Kashflow as a receipt.

    I've never used EmailInvoice, but calling the EmailInvoice method with a receipt number would, I imagine, email the invoice that had that particular receipt number (if it existed). Though by the sound of your second post, that didn't work - did you get a "The Invoice could not be found" error again?

    Mark
  4. knu New Member

    I just had a quick go with EmailInvoice and it seems to work for me as I would expect.
  5. knu New Member

    Though to docs do contain a minor mistake:

    FromEmail - The name of the sender
    FromName - The email address that the invoice should appear to have been sent from

    should obviously read:

    FromEmail - The email address that the invoice should appear to have been sent from
    FromName - The name of the sender
  6. robgoodliffe New Member

    Thanks for replying

    I'm not the accountant but as i understand it, as well as receiving purchase orders for our services we also raise purchase orders for companies that we would like to buy something from etc, this acts as a legally binding document and represents our intent to purchase goods from them at said price and quantity, this can be then married up with the invoice by the way of a purchase order number to check we have been invoiced at the correct rate. With this in mind, we need our staff to be able to create a purchase order and email it as an attached pdf to our suppliers. With our business model this a pretty common occurrence and, as Kashflow dosen't support permissions, we've had to set it up through the api.

    And that was a receipt and not an invoice? Was the receipt number that you sent to the api entirely numerical or was it prefixed with #kf?

    I have actually managed to generate my own pdf using fpdf and the using the GetReceipt method but i'd still be interested to know if this works. I actually tested on the PrintInvoice method, which also didn't work for receipts but did when i tested with an invoice number. I made the assumption, because both methods(EmailInvoice and PrintInvoice) were in the invoices section of the documentation and omitted from the receipt section of the document that both methods were only applicable to invoices, which seemed to be confirmed by my tests on the print invoice method.

    Thanks for your time
  7. knu New Member

    OK. I understand now. We don't used purchase orders, or even have the option enabled, so I wasn't at all familiar with the notion!

    There are a number of methods that aren't documented on the kashflow api manual pages herehttps://securedwebapp.com/api/service.asmxamongst which is EmailPurchaseOrder - I think that's what you want. It looks to me much like EmailInvoice except it takes a ReceiptNumber parameter instead of InvoiceNumber. It might be a bit late now, but I hope that works for you.
    It was an invoice, with no #KF.
  8. robgoodliffe New Member

    blimey, cheers for that knu! Nice of them to put it into the documentation for us all...Yea, that looks to be the ticket. Oh well, i've done the work now and to be fair i wanted to be able to customize the invoices and receipts as we have a number of brands under one umbrella company.

    I'm going to email support and suggest they update their documentation to show all methods available through their api, might save people some work.
  9. Lee David Painter New Member

    It would also be very useful if the API email facility was extended to Quotes. As far as I can tell this is not possible atm.
  10. robgoodliffe New Member

    I haven't tried it but just try using the emailInvoice method and use the quote number, as i am presuming quotes are essentially the same as Invoices in terms of how Kashflow stores them in their databases. This is just a guess based on the fact that you can convert a quote to invoice / when you getQuote an object of type Invoice is returned etc.
  11. Lee David Painter New Member

    I have already tried using EmailInvoice. It reports that it the invoice cannot be found for any quote number it is given.
  12. robgoodliffe New Member

    yep, there are a few strange omissions from the api, that's for sure.
  13. robgoodliffe New Member

    the only other thing i can suggest is to dynamically create the URL that kashflow uses when you print a quote and then attach that to an email created by you application. It's something along the lines of " /InvoicePDF.asp?inpage=0&est=1&id=56783", with the id being their database id. Again i haven't tried this and it might require the user to be logged in to kashflow but it's just a possible work around. Personally i think it might be quicker just to create your own pdf using fpdf etc.

Share This Page