Error calling InvoiceService.deleteSubscription

Hi all,

I am calling InvoiceService.deleteSubscription API to remove a Subscription on InfusionSoft.

Here is my PHP code:

$result = $this->client->call('InvoiceService.deleteSubscription', [
                [API_KEY],
                [subscription-ID]
            ]);

It throws following exception:

[InvalidParameter]Only subscriptions without an originating id can be deleted. This subscription has an originating id of [some-ID]

can anyone please guide?

I haven’t seen that one before and I’m guessing that the wording of that message is probably less than helpful or indirectly non-specific. I mean, how else would someone delete a subscription without it having an original ID? Still, maybe someone like @Bradley_Booth might have an answer?

This exception is thrown when you attempt to delete a subscription that originated as a line item of an different order. The originating id is referring to the original order id.

Hey, @bradb,

Just so I have some understanding too, is this to say that a line item was re-assigned to a different order? Or just that it was an order with multiple lines, one of which is a sub?

Thanks @bradb so that means Subscriptions that were added as a line item of an Order can not be deleted? Is there any way I can delete / cancel that Subscription?

If I’m understanding Bradley correctly then it may be necessary to delete the actual order that the sub line was on but then you’d have to recreate any non sub items in a new order to keep a record of it? Not sure how they intended for that one to work but I can certainly see why canceling a sub might be needed. I know that with the SDK you can modify subs (but no delete) by using the data object on the recurring order table (subscriptions) but deleting, again, not sure how it would be done.

@John_Borelli thank you for sharing your thoughts… I agree, the fundamental question really is, how do we delete a Subscription that was added as a line item of an Order? Is there anything else to be deleted / adjusted before doing so? May be @bradb could shed some light on this?

You should be able to mark the subscription as Inactive See Table Schema Documentation - Keap Developer Portal RecurringOrder

Thanks Brad, I believe that should suffice.

$result = $this->client->call('DataService.update', [
                $this::API_KEY,
                'RecurringOrder',
                $subscriptionID,
                [
                    'Status' => 'Inactive'
                ]
            ]);