Change a contact subscription

Hello guys, I’m trying to change a contact subscription using xmlrpc but the problem is I can’t find any api in xmlrpc that will help me in updating the subscription. Can anybody help me out thanks

You would need to use the data object to access the RecurringOrder table. You would have to query the table by contact id and then determine which you want to work with or query the table by the Id specifically if you have that. You would then be able to use the update method to make changes.

I’m doing it like this

$this->infusionsoftService->data()->update(‘RecurringOrder’, $recurringOrderId, [
‘ProductId’ =>$productId,
‘SubscriptionPlanId’ => $subscriptionId

but it is not updating the amount

Do I need to update the amount too ?

You may need to modify the order item instead. When you use the product id it’s going to use what it has as data for the product that is existing. When creating/modifying orders, you can add an item based on product id but override the value at that time so you should be able to do the same while modifying it. I doubt that you want to change the product itself as that would affect any orders using the same product.

John this is my use case

I have two packages /products. I have also created subscription for these products

  1. test1
  2. test 2

I have created a contact subscription for a user for test1 . Now a user can change his subscription to test2 . If a user changes then rather then creating a new subscription I want to edit the previously created contact subscription and change the productId in such a way that the next time the user is billed he is billed for test2 product rather then test1

can you please tell me how can I achieve it

this is my whole code with which I’m creating a recurring invoice

$sub_id =  $this->infusionsoftService->invoices()->addRecurringOrder($contactID, false,
                              $subscription['id'], 1, $subscription['PlanPrice'], false, 3, $creditCardID, 0, 0);
 $invoiceID =  $this->infusionsoftService->invoices()->createInvoiceForRecurring($sub_id);
 $result = $this->infusionSoftService->chargeInvoice($invoiceID, "", $cardID);

So what I would do then is to use the api to simply change the product id to the one you want. If that’s all you need then you should just be able to change the product id number.

@Rohan_Jalil, I believe you will have to manually update the billing amount and any other fields that are automatically set when creating a subscription.