Jump to content

API Usage


Corneliu

Recommended Posts

Hi,

 

We are currently trying to use the WHMCS API to integrate WHMCS with several accounting systems however we encounter issues with it.

 

1. The most critical issue is that in some (unknown) scenarios the API does not give us the payment details of an order.

We have an order with a payment attached (see attachment). When we ask the order via the API (with getinvoice as action) we get the following:

Call: username=*****&password=******&action=getinvoice&invoiceid=1574

Response:

<?xml version="1.0" encoding="utf-8"?>

<whmcsapi version="4.4.2">

<action>getinvoice</action>

<result>success</result>

<invoiceid>1574</invoiceid>

<invoicenum></invoicenum>

<userid>****</userid>

<date>2011-03-14</date>

<duedate>2011-03-14</duedate>

<datepaid>0000-00-00 00:00:00</datepaid>

<subtotal>2200.00</subtotal>

<credit>0.00</credit>

<tax>220.00</tax>

<tax2>0.00</tax2>

<total>2420.00</total>

<balance>1220.00</balance>

<taxrate>10.00</taxrate>

<taxrate2>0.00</taxrate2>

<status>Unpaid</status>

<paymentmethod>banktransfer</paymentmethod>

<notes><![CDATA[]]></notes>

<items>

<item>

<id>110</id>

<type></type>

<relid>0</relid>

<description>******* </description>

<amount>2420.00</amount>

<taxed>1</taxed>

</item>

</items>

</whmcsapi>

 

There is no date paid: http://wiki.whmcs.com/API:Get_Invoice

We also don't know the amount paid.

 

2. On top of that, if an order is paid with two methods (e.g. 50% deposit 50% paypal) we don't know that and there is no way to get that via the API. This is a major issue as we can't push the correct payment of the invoice into an accounting system as we don't know in which accounts the payments were made.

 

3. Now the last issue is that we can't request via the API all invoices (http://wiki.whmcs.com/API:Get_Invoices) that have been changes since a specific date (e.g. updated_from=2011-03-01) so the only way to get the changed invoices is to go and request for all invoices starting with the first one via the get them all which means we can get hundreds of invoices. On top of that the invoices returned from the GetInvoices call don't carry a lastupdated timestamp so to see if they were changed we then have to call GetInvoice on each one of them.

So all the process of pushing invoices into an accounting system becomes extremely intensive in terms of API calls.

 

It would be really great if the API could be updated to cater for the following scenarios:

1. Get updates (updated_since=[timestamp]) and get all the changes since that time

2. All entities (Invoices, Orders, Contacts) to have a LastUpdated field with a timestamp of the last change

3. GetInvoices should contain the LastUpdated for the Invoice

4. Support multiple payments on an Invoice via the API and return the complete details of _each_ payment on the invoice. (date of each payment, method, amount, transaction id, fees)

 

Thanks,

Corneliu.

WHMCS-MissingPaymentInApi.jpg

Link to comment
Share on other sites

  • WHMCS CEO

Hi,

 

1. There is a datepaid but it is empty because the invoice hasn't been paid yet: <datepaid>0000-00-00 00:00:00</datepaid>

 

2. An order cannot be placed with 2 methods so I don't know what you're referring to here. 2 transactions are possible, but not 2 invoices - look at GetTransactions for receiving the transactions.

 

3. It's not that the API doesn't include a lastupdated timestamp, it's that the database doesn't even store one so for the time being that is not possible unfortunately.

 

Matt

Link to comment
Share on other sites

Hi Matt,

 

Thanks for the answers. At no 2 I wanted to say:

 

2. If an invoice is paid with two methods (e.g. 50% deposit 50% paypal) we don't know that and there is no way to get that via the API. This is a major issue as we can't push the correct payment of the invoice into an accounting system as we don't know in which accounts the payments were made.

 

Thanks,

Corneliu.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated