Hi,
I am trying to create an order with a subscription. When the standard IS order forms create an order for a subscription the RecurringOrder’s OriginatingOrderId field stores the ID of the order (Job).
Subscription renewal orders (Jobs) connect to the RecurringOrder through JobRecurringId.
This way you can find the initial order of a subscription through RecurringOrder.OriginatingOrderId and renewal orders through Job.JobRecurringId.
We use this in our data analytics to show which orders belong to which subscription.
Now we want to use the API to create upsell orders, but I can’t figure out how to create a subscription and correctly associate it with the originating order when using the InvoiceService.
Here’s what an order created using a standard IS order form looks like:
The subscription picks up the originating order and displays it in the subscription list.
But when you create the subscription through the InvoiceSergice, there isn’t a way to associate it…
Here’s my code:
isapi = Infusionsoft('app', 'key')
contact_id = 932817
invoice_id = isapi.InvoiceService('createBlankOrder', contact_id, 'Upsell: Test', datetime.now(), 0, 0);
isapi.InvoiceService('addOrderItem',
invoice_id,
120, # product id
9, #type Subscription Plan
995.00, # price,
1, #quantity
'Description',
'No note')
isapi.InvoiceService('addRecurringOrder',
contact_id,
True, # allow dupes
120, # subscription plan id
1, # quantity
995.00, #price
False, #taxable
13, # merchant account
113047, # credit card id
0, # affiliateID
0 # trialPeriod
)
Clearly it’s not working since the originating order id is not set anywhere. But in the API documentation that field is read only. So it’s not possible to change it either.
How can I properly create an order for a subscription?
I have tried reading all of the documentation and every psot about subscriptions here on the forum, but still couldn’t find anything.
Thanks, in advance.