Pause and Resume Subscriptions

I am trying to understand the pause and resume subscription functions. I can pause the subscription and I’ve had luck resuming it, but I cannot understand the dates, etc.

Let’s say I want to pause the sub at the end of the billing period, but the customer decided to reactive/resume before the new billing period (effectively un-pausing it). Is this possible? Or does the user have to wait until the new billing period to resume? I am able to pause and resume over and over in the subscription dashboard but I fail in the API. I am guessing I need to set some other params.

Successful Pause:

{
“subscription”: {
“id”: “e250fbce-746c-4871-9c07-20f28ec86fff”,
“location_id”: “LVGD0T9AA9TNK”,
“plan_id”: “NM345WR6EQABUELTFTTKOFNU”,
“customer_id”: “42JSFC1ZVP5A0FS533WVRXBH14”,
“start_date”: “2022-12-16”,
“charged_through_date”: “2023-01-16”,
“status”: “ACTIVE”,
“invoice_ids”: [
“inv:0-ChA9Evr9XWxq2OlF5lGccqCQEJwJ”
],
“version”: 1,
“created_at”: “2022-12-16T20:18:06Z”,
“card_id”: “ccof:ICBTCq1S7XlckEG43GB”,
“timezone”: “UTC”,
“source”: {
“name”: “Sandbox for sq0idp-E_upU7EIGFrTaPqrcOKu3g”
}
},
“actions”: [
{
“id”: “99b2439e-63f7-3ad5-95f7-ab2447a80673”,
“type”: “PAUSE”,
“effective_date”: “2023-01-16”
}
]
}

Successful Resume:

{
“subscription”: {
“id”: “e250fbce-746c-4871-9c07-20f28ec86fff”,
“location_id”: “LVGD0T9AA9TNK”,
“plan_id”: “NM345WR6EQABUELTFTTKOFNU”,
“customer_id”: “42JSFC1ZVP5A0FS533WVRXBH14”,
“start_date”: “2022-12-16”,
“charged_through_date”: “2023-01-16”,
“status”: “ACTIVE”,
“invoice_ids”: [
“inv:0-ChA9Evr9XWxq2OlF5lGccqCQEJwJ”
],
“version”: 1,
“created_at”: “2022-12-16T20:18:06Z”,
“card_id”: “ccof:ICBTCq1S7XlckEG43GB”,
“timezone”: “UTC”,
“source”: {
“name”: “Sandbox for sq0idp-E_upU7EIGFrTaPqrcOKu3g”
}
},
“actions”: [
{
“id”: “18ff74f4-3da4-30c5-929f-7d6fca84f115”,
“type”: “RESUME”,
“effective_date”: “2023-01-16”
}
]
}

Unsuccessful Re-Pause

{
“errors”: [
{
“code”: “BAD_REQUEST”,
“detail”: “The provided subscription e250fbce-746c-4871-9c07-20f28ec86fff already has a pending pause date of 2023-01-16.”,
“category”: “INVALID_REQUEST_ERROR”
}
]
}

This results in me going back to the subscription dashboard to reactive the sub from there at which point I can repeat the process. Ideally, my customer will be able to pause/resume over and over the same way I can from the dashboard. That way there will be no errors.

I think I have tried every combination of pause and resume with no luck.

With the Subscriptions API you’ll need to call DeleteSubscriptionAction to remove the existing action before you add the new action. :slightly_smiling_face:

So that I am clear, delete sub action will delete the sub, then I will want to recreate the sub? What does this mean for a user who had 5 days left on subscription. When I recreate sub does it start the billing all over again or is the new sub prorated?

The DeleteSubscriptionAction endpoint only removes the action. It won’t delete the subscription. :slightly_smiling_face:

Ah… I see. It is quoted on the page I never went to :wink:
Deletes a scheduled action for a subscription

What would one put for the action_id?

$api_response = $client->getSubscriptionsApi()->deleteSubscriptionAction(‘e250fbce-746c-4871-9c07-20f28ec86fff’);

if ($api_response->isSuccess()) {
$result = $api_response->getResult();
} else {
$errors = $api_response->getErrors();
}

{
“errors”: [
{
“code”: “BAD_REQUEST”,
“detail”: “The provided action id {action_id} is invalid.”,
“category”: “INVALID_REQUEST_ERROR”
}
]
}

When you retrieve the subscription it will have the existing action_id that you’ll use to pass in the delete request. :slightly_smiling_face: