Search code examples
phpapirecurly

Recurly - How to update subscription add on quantity?


$updateaddon = $subscription->subscription_add_ons[0];
$updateaddon->quantity = $extra_dashboard_count;
$subscription->subscription_add_ons[0] = $updateaddon;
try
{
    $subscription->updateAtRenewal();
}
catch(Exception $e)
{
    $error = $e->getMessage();
}

I'm getting an error message saying "Quantity must be equal to 1."

I'm following the PHP SDK example found here. They show updating existing add on quantity. Am I doing something wrong in code or why can I not have quantity greater than 1 for an add on?


Solution

  • I don't see this mentioned anywhere in API documentation, but usage based add ons can't have their quantity increased. Instead you need to log the usage of the add on. API docs for logging add ons is found here