Suspend a Subscription (Amendment)
Use the Suspend amendment to suspend an active subscription.
Suspending a Subscription (WSDL 76.0 and higher)
In version 76.0 and greater, you can use the amend() call to create a suspend amendment. This call also allows you to preview the invoices before amending the subscription.
Set the following fields to suspend an active subscription:
- Specify the following fields in the Amendment object:
- Specify a name for the amendment.
- Specify the Subscription ID.
- Set the
SuspendDate. This is the date when subscription suspension takes effect. See Suspend Date for more information.
ContractEffectiveDate. This is the date when the customer notifies you that they want to suspend their subscription.
- PreviewOptions: Set
EnablePreviewModeto true if you want to preview what the invoice would be, including the amount and charges after the amendment, without creating the amendment. This is useful when calculating prorations and complex charges.
<api:amend> <api:requests> <api:Amendments> <obj:ContractEffectiveDate>2019-03-01</obj:ContractEffectiveDate> <obj:Description>Suspend a subscription amendment</obj:Description> <obj:SuspendDate>2019-05-01</obj:SuspendDate> <obj:Name>Suspend a subscription</obj:Name> <obj:Status>Completed</obj:Status> <obj:SubscriptionId>402892c42ce80787012ce80ea1aa0014</obj:SubscriptionId> <obj:Type>SuspendSubscription</obj:Type> </api:Amendments> <api:PreviewOptions> <api:EnablePreviewMode>true</api:EnablePreviewMode> </api:PreviewOptions> </api:requests> </api:amend>
Suspending a Subscription at the End of the Last Invoice Period
You may generate a negative invoice if the subscription is suspended in the middle of a billing period that has been invoiced. To avoid undesired credits being issued back to the customer, you can suspend the subscription at the end of last invoice period. See End Of Last Invoice Period for more information.
In the SOAP API, there is no option to suspend a subscription at the end of last invoice period. The earliest suspend date you can use without creating a negative invoice (credit) is the same date as the date until when the charge was billed. So you can query the rate plan charge to find the latest charge through date (
ChargedThroughDate) of all charges and then set the suspend date to be the latest charge through date.
Get the Latest Charged Through Date
Perform the following steps to get the latest
- Query the RatePlan object with the subscription Id. This will return the
rateplanIdfor each charge.
select Id,Name,ProductRatePlanId from RatePlan where SubscriptionId='8a8082c4539c5bcc0153baff7c0d0c3a'
- Query the
RatePlanChargeobject for each charge with
IsLastSegment = 'true'. This will return the value of the
ChargedThroughDatefield for each charge. If the charge is not billed through the subscription term, the charge does not have a value in
select Id,Name,ProductRatePlanChargeId,ChargeModel,ChargeType,UOM,Quantity,ChargedThroughDate FROM RatePlanCharge WHERE RatePlanId='8a8082c4539c5bcc0153baff284b0c33' AND IsLastSegment=true
- Compare the values of the
ChargedThroughDatefield of all the charges, get the latest