How can I add a promocode to an Invoice?


(Alexander Anich) #1

I’m creating a blank invoice via XML-RPC InvoiceService.createBlankOrder and would like to apply a promocode to it before charging the invoice.


(John Borelli) #2

The promo code should be provided as an xml parameter to the createBlankOrder call

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


(Alexander Anich) #3

What you linked to is the OrderService.placeOrder call. Does this have a similar convention to the InvoiceService.createBlankOrder call?

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

Otherwise, I think I’m still in the same situation.


(John Borelli) #4

So, invoices and orders are different things, even though the naming of the methods make this confusing. Generally, using the order object, you would create an order (which is just a template for invoices but not a billable entity). The order is where the promo code is assigned. This allows for recurring invoicing based on the same order for things like subscription products. The invoice is where the payment is applied (an order cannot have a payment). So the order is created (and an initial invoice record is also created at the same time). To find invoices created with that order you would look on the invoice table and query for the JobId which is the old terminology for the order id.


(Alexander Anich) #5

Firstly, I appreciate you taking the time to respond to my questions.

What I’m gathering from your response, is that I’m unable to add a promotional code directly to the Invoice object via the InvoiceService. Correct?

I would have to add it to an order object, then find the invoice it created through the JobId field?


(John Borelli) #6

Yes, that’s correct. Note that, although it’s not a guarantee, the first invoice created when the order is created is usually the same. ie the order id and invoice id are normally the same. I would still look it up to be certain though. So yes, create the order with the promo code, then look up the invoice by the order id (jobid) and you can then see the result of the promo code in the invoice.


(Jon Smith) #7

To clarify @John_Borelli is correct about the whole invoice thing. The OrderId and InvoiceId that are created from the create an order API call will be returned. The Ids might not be the same though. Making sure that the correct Id is being used from the response body is the key.