Error for $infusionsoft->invoices()->createBlankOrder()

Hi i was testing following request and got error:

$infusionsoft = new \Infusionsoft\Infusionsoft(array(
'clientId' => CLIENT_ID,
 'clientSecret' => CLIENT_SECRET,
 'redirectUri' => REDIRECT_URL,
 ));
$infusionsoft->refreshAccessToken();
$infusionsoft->invoices()->createBlankOrder($contactID, $name, $orderDate, $leadAffiliateID, $saleAffiliateID)

Error:
‘No method matching arguments: java.lang.String, java.lang.Integer, java.lang.String, java.lang.String, java.lang.Integer, java.lang.Integer’

You’re missing a number of fields:

https://developer.infusionsoft.com/docs/xml-rpc/#order-create-an-order

im creating blank invoice https://developer.infusionsoft.com/docs/xml-rpc/#invoice-create-an-invoice the link you shared is of order creation?

thanks

i think the $orderDate is causing issue, in isdk.php using API Key method i used datetime as $app->infuDate(date(‘Ymd\TH:i:s’)); but in accesstoken method described above im using $date = date(‘Ymd\TH:i:s’); not sure whats the correct method, IS support says that the code is sending datetime as string, it should send as dateTime.iso8601, $date = date(‘Ymd\TH:i:s’); do echo as dateTime.iso8601

I don’t know about the date but I can tell you that you have to create a blank order first. If an invoice were a house then the order is the blue prints for the house. It goes in this order:

  1. create a blank order
  2. add order items
  3. create an invoice using the order id
  4. (optionally) add an invoice payment

Can you confirm:

  1. create a blank order ($infusionsoft->invoices()->createBlankOrder())
  2. add order items ($infusionsoft->invoices()->addOrderItem())
  3. create an invoice using the order id (which method is this in developer site?)
  4. (optionally) add an invoice payment ($infusionsoft->invoices()->chargeInvoice())

ok i used $datetime = new \DateTime(‘now’,new \DateTimeZone(‘America/New_York’)); and it worked wooossssh

1 Like

Hi PageDesigner, your comment saved me.
Can I ask how did you find this out?
Where is it documented?
This is the code that worked for me:
$datetime = new DateTime(‘now’,new DateTimeZone(‘America/New_York’));

it took me very long time to figure out that it was this date variable issue in creating invoice, also did very very long discussion with developer at support section and after 3-5 days i got the solution, its on GIThub and packagist page of IS https://packagist.org/packages/infusionsoft/php-sdk

1 Like