How to add Promo code to invoice

(Page Designer) #1

Hello, im trying to add promo code to an invoice, im using PHP iSDK

following is methos to add item to blank order:


i tries this method: but this gives error that method not available?


(John Borelli) #2

First, you must create the blank order with ->placeOrder. This is where you would assign the promo code. Then, where you wish to add order items using ->addOrderItem, you must find and use the invoice id that is also created with the blank order (not the order id). While they ‘usually’ are the same the first time you create it, the can be different so it is best practice to query the invoice table by the JobId field (which is the order id)

(Page Designer) #3

this never works for me gives error that this call method is not available

(John Borelli) #4

That would indicate the wrong number of parameters or the parameter types don’t match…the method does work.

(Page Designer) #5

im using the method as below

$carray = array(


where $appkey is my IS secret key.

Is this correct method?

(John Borelli) #6

Are you using legacy (isdk) or current api (oauth)

(Page Designer) #7

Im using legacy iSDK

(John Borelli) #8

so you don’t put the api key in your self. you have to setup credentials with the ->cfgCon method

Your fields for the isdk will be contact id, order description, order date, lead affiliate id and sales affiliate id…if you want to assign the promo code you will have to either update the newly created order on the Job table or just directly create a row on the Job table with the field data you need.

(Page Designer) #9

also tried that method but same error :frowning:

(John Borelli) #10

because your params are wrong

(John Borelli) #11

you’re using the isdk but going off of current api documentation

(Page Designer) #12

So the correct code will be?

$carray = array(

(John Borelli) #13

Once again, if you’re using the isdk then cfgCon is where you would register your credentials. You do NOT use the api key in the call yourself. Nor do you use the CC id or product id etc etc…again, as i already said, you’re using the wrong documentation for the isdk…you’re looking at the current api not the legacy documentation (which is no longer available). You will be best off using an ide that has code complete to show you the correct parameters for any isdk api calls.

(Page Designer) #14

sorry for this, if im wrong, im not expert in IS API, i found this public function in isdk.php

public function placeOrder($contactId, $creditCardId, $payPlanId, $productIds, $subscriptionIds, $processSpecials, $promoCodes, $leadAff = 0, $saleAff = 0)
    $carray = array(
    return $this->methodCaller("OrderService.placeOrder", $carray);

and im using the example code to call this function explained here :

$app = new iSDK();
// perform authorization tasks

$carray = array(
array($productId1, $productId2),
array($subscriptionPlanId1, $subscriptionPlanId2),
array($promoCode1, $promoCode2)) // array of strings


i always get this error:

ERROR: -1 - No method matching arguments: java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Integer, java.lang.Integer

also can you guide me how to add new CC to IS contact and return ID of that card?

thanks for your replies and great help i appreciate alot.

(John Borelli) #15


You don’t put the api key into the call yourself. no method match… message is a java message telling you that the parameters are not matching up.

(Page Designer) #16

i’ve also removed the key variable, same error occurs, im not sure where im going wrong. thanks

(Page Designer) #17

i assume the example code written is wrong

(John Borelli) #18

(Page Designer) #19

yes i’ve used this method and im successfull with that, but i was testing $app->placeOrder() method to add promocode, with we can not add promocodes, right? can you tell me how to add new credit card to a contact via API?

(Jon Smith) #20

I know that you mentioned that you are on a Legacy version of the SDK however can you try doing this what is described there:
Also if you could get the request body that is sent to Infusionsoft we could see what Infusionsoft is actually receiving since we are receiving it in XML. This will help identify the issue a lot quicker.