API to create orders

Hi,

Below is the link for creating manual orders in infusion.

https://help.infusionsoft.com/userguides/sell-online/create-an-order/create-a-manual-order

Can anyone please let me know how to create these orders through API, because in API documentation there are some fields that are missing.

Thanks

Hi @Max_Rubin,

The way you would create an order through the API is by first creating a blank order using InvoiceService.createBlankOrder. Then you would use InvoiceService.addOrderItem to add items to the order. The last step would be to apply a payment either by using InvoiceService.chargeInvoice or InvoiceService.addManualPayment if you are taking payment in an external system.

What are the specific fields that you need that are missing?

Hi,

Thanks for the reply, actually what exactly we are trying to acheive is to import complete order detail which was processed in our external e commerce application.

in https://developer.infusionsoft.com/docs/xml-rpc/#invoice-create-an-invoice, we does not have field available for order id, shipping details, billing details, can you please help me out with this.

Thanks

Hi @Max_Rubin,

In order to set those additional fields, you will need to use DataService.update to update a record in the “Job” table (see Job section in the table schema docs). The “Job” table represents an order and should contain all of the fields you need to update.

@Max_Rubin,

The details you’re mentioning are actually recorded on separate tables and are not created specifically with the order (some of them anyway). The order id cannot be written. It is created as an AUTO_INCREMENT value in the apps database. You can store the original order id in a custom field on the order table if you really need it. Shipping details really don’t exist in Infusionsoft. Shipping address is recorded on Address2Street1, Address2Street2, City2…and so forth but actually shipping data (like what carrier, delivery dates, instructions etc) do not exist, though the products table does contain a few fields (shippable, shipping time and weight). Billing details are similar. Billing address is StreetAddress1, StreetAddress2, City, State etc but the rest will be in a couple of tables (Payment, CreditCard, CCharge, InvoicePayment, PayPlan, PayPlanItem and SubscriptionPlan may all be helpful to look at). The table schema documentation can be found here:

https://developer.infusionsoft.com/docs/table-schema/

Pardon the necro but I don’t want to create a new topic as the context is entirely in your post…

Should I use the flow you outlined for creating subscriptions? Or should I specifically go through the createInvoiceForRecurring first and then I skip the InvoiceService.addOrderItem step and go straight to InvoiceService.chargeInvoice?

The flow for subscriptions is a bit different. First you would need to create a RecurringOrder record using DataService.add. Then you would use InvoiceService.createInvoiceForRecurring which will create an invoice for subscription record. Lastly you would call InvoiceService.chargeInvoice to collect payment on the subscription invoice.

Should I be using the id (integer) that is returned from calling DataService.add against the RecurringOrder table insert in my subsequent calls?

is it the value I should use the subscriptionID field when calling InvoiceService.createInvoiceForRecurring?

@Ray_Farias, apologies for the delayed response but you’re correct that the id that’s returned from creating the RecurringOrder should be used when calling InvoiceService.createInvoiceForRecurring.

Alternatively, you could also use InvoiceService.addRecurringOrder to add the subscription rather than using DataService.add.

@Nicholas_Trecina Hi all, again sorry for the long bump. Now that the REST API is available, is it better to create orders with this, or use the XML RPC one?

Also, is it possible to POST variables like “cost price”? This doesn’t appear in the order endpoint as a parameter but is visible on the response sample. https://developer.infusionsoft.com/docs/rest/#!/E-Commerce/createOrderUsingPOST