We have orders that have a ‘trackingcode’ custom field and that is being populated correctly, but I’m unable to retrieve this tracking code custom field using the infusionsoft php sdk.
Example code that we’re using to fetch an order:
$order = $infusionsoft->orders()->find($id);
$order_attrs = $order->getAttributes();
… // Do something with $order_attrs below
I’m able to see custom fields when i call the following:
$order->model()
But it only lists the names of the custom fields and no values.
Unfortunately we have not yet had a chance to implement full custom field support on the REST Orders placement endpoints, but it’s possible to retrieve them via the DataService in the XMLRPC API still. The selectedField value should be the API name of the Custom Field as shown in the Admin UI inside Infusionsoft.
Thanks, Pav! I’m actually running into Infusionsoft/TokenExpiredException though I have a valid token. This could be because I already have a cron job for refreshing InfusionSoft (Keap?) the access token, which then gets stored in the database (as there are several places where this access token gets used). So when building the SDK object, I’m skipping out on the refreshToken part and directly supplying a new one like this (Laravel code):
After this when I try to test with something like $sdk->data()->query('Contact', 1, 1, ['id' => 10], $returnFields, null, null); I get Infusionsoft/TokenExpiredException. I think the SDK can’t be “fooled” like this. What would be the way to do this in my case?
I guess I didn’t explain myself correctly. Let me try again. I actually already have an OAuth flow in place, but it’s being handled by a different process. My question is that in the docs, the PHP example in the docs goes like this:
Is the $infusionsoft->refreshAccessToken(); part necessary? Because in my case, this will invalidate the access token other InfusionSoft jobs/processes have. Assuming I already have a valid access token, can it be used directly with the sdk without getting into the $infusionsoft->refreshAccessToken(); line?
You mentioned that you have another process handling the Access Tokens. Usually they would be stored in a database. So you could query that to get it back and use it.
Did you get any response for the above request? I am also looking to pull/read custom fields from orders rest API. Or Have you did any workaround to achieve it.?