Question

I want to send customers and invoices to the quickbooks online account using the consolibyte quickbooks php devkit. I've managed to do that, but i can't set up my custom IDs for the customers and invoices because the library unset them from objects.

Does anybody know if this is achievable or if quickbooks API allows this?

The alternative would be to store a quickbooks_id in my database, which i was trying to avoid.

Thanks!

Edit: some code

$IPP->version(QuickBooks_IPP_IDS::VERSION_3);

$CustomerService = new QuickBooks_IPP_Service_Customer();

$Customer = new QuickBooks_IPP_Object_Customer();
$Customer->setId(101); // this is the ID i want to set
$Customer->setTitle('Mr');
$Customer->setGivenName('John');
$Customer->setFamilyName('Doe');
Was it helpful?

Solution

This is definitely not do-able:

$Customer->setId(101); // this is the ID i want to set

You can't just invent your own Id values. These are QuickBooks's Id values - essentially their primary key within QuickBooks Online itself.

If you do a query for objects, you'll get back Id values for all of them. If you create a new object, you'll get back an Id value from Intuit for the newly created object. Think of it just like an SQL database's AUTO_INCREMENT PRIMARY KEY. You do an insert, you get back a unique Id value.

This is not a limitation of the PHP code itself - it's how the actual QuickBooks API works. The Id values are not your Id values, they are QuickBooks' Id values. They are not set-able values.

You should be storing the Id values in your own database. Even if you could set those Id values, you have to remember that you're not the only one with access to the QuickBooks data - if you could set them, then so could any other app that connects to QuickBooks essentially overwriting any value you set.

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