2

Trying to add a manual payment to an order. First having difficulty showing the order item, when i hard code it - it works the order item displays.

The bigger issue is that the payment is not being applied to either?

if ($myApp->cfgCon("ds")) {
//$date = $myApp->infuDate(date("Y-m-d"));
$date = $myApp->infuDate(date('Ymd\TH:i:s'));

$invoiceId = $myApp->blankOrder($contactID,"Product A", $date, 0, 0);

$currentDate = date('Ymd\TH:i:s');
$odate = new DateTime($currentDate); 


$iresult = $myApp->addOrderItem($invoiceId, 60, 4, 9.95, 1, "Product A", "Product A");  

//$iresult = $myApp->addOrderItem($invoiceId, $infprodid, 4, $prodPrice, 1, $prodName, $prodName);  
//$pDate = $myApp->infuDate(date("Y-m-d"));
//  $presult = $myApp->manualPmt(intval($invoiceId),$prodPrice,$odate,'Credit Card','paid by Credit Card',false);

$presult = $myApp->manualPmt(intval($invoiceId),9.95,$odate,'Credit Card','paid by Credit Card',false);
Tal
  • 21
  • 1

1 Answers1

1

I was facing the same problem. I think its due to passing arguments with wrong datatypes.

In your case, I think your date format is not according to infusionsoft's date format. Well, this code worked for me.

$currentDate = date('Y-m-d H:i:s');
$now = new DateTime($currentDate);
$invoiceID=$infusionsoft->invoices()->createBlankOrder($contactID, 'New Test Order by Junaid', $d, 0, 0);
$re=$infusionsoft->invoices()->addOrderItem($invoiceID, 4, 4, 200.0, 1,   'This is New test item added by junaid', 'New testing by junaid','');
$infusionsoft->invoices()->addManualPayment((int) 160,(float) 200.0, $now, 'API', 'New Test Payment by juanid',true);

also best practice is to mention datatypes with arguments.

Usman Maqbool
  • 3,351
  • 10
  • 31
  • 48
Junaid Ahmad
  • 599
  • 1
  • 4
  • 15