Swap Subscription Events?

Hi:
I created a form for subscribers to “swap subscriptions” to different versions.

A disgruntled subscriber wrote to complain to me. She said she’d swapped to a downgraded, less expensive subscription on 1 August, but had been billed at the original expensive rate on August 4.

I checked her subscription, and saw she was subscribed to the expensive plan.

{
  "subscription": {
    "id": "xxxxxxx",
    "location_id": "xxxxxxx",
    "customer_id": "xxxxxx",
    "start_date": "2023-07-04",
    "charged_through_date": "2023-09-04",
    "status": "ACTIVE",
    "invoice_ids": [
      "inv:0-xxxxxxx",
      "inv:0-xxxxxxx"
    ],
    "version": 1,
    "created_at": "2023-07-04T07:11:26-04:00",
    "card_id": "ccof:xxxxxxxxxxxxxx",
    "timezone": "America/New_York",
    "source": {
      "name": "My Company"
    },
    "plan_variation_id": "Expensive Subscription code here"
  }
}

I then manually tried to change it to the cheaper plan.
Response follows:

{
  "errors": [
    {
      "code": "BAD_REQUEST",
      "detail": "The subscription is already pending a plan change.",
      "category": "INVALID_REQUEST_ERROR"
    }
  ]
}

So I checked subscription events and saw only this:

{
  "subscription_events": [
    {
      "id": "xxxxxxxxxxxx",
      "subscription_event_type": "START_SUBSCRIPTION",
      "effective_date": "2023-07-04",
      "plan_variation_id": "Expensive Subscription code here"
    }
  ]
}

Is the “swap subscription” event recorded somewhere?

When a plan is swapped it won’t take effect till the existing billing cycle is completed. Were they expecting the swap to take effect immediately? :slight_smile:

I understand how it’s supposed to work.

I am asking if there is any record of when the swap request was made. I expected a “subscriber event” to be created. I’d like to explain with specifics what I suspect – the swap request was made after the invoice. I hoped there was a record.

Have you checked your API Logs for that particular subscription? The logs go back 28 days so you can see when the request was made. Otherwise you can use RetrieveSubscription and add include actions to see all the actions for the subscription. :slight_smile:

Thanks for the suggestions.
I checked actions for the subscription – none shown

curl https://connect.squareup.com/v2/subscriptions/xxxxxxxx?include=actions 

I checked the API log. I know that there have been some user initiated subscription swaps within the past 3 weeks, but the only thing in the API logs is my own POST of the Swap Plan that returned - “the subscription is already pending a plan change”

400 Subscriptions POST /v2/subscriptions/xxxxxxx/swap-plan
2023-08-15 17:40:33 GMT-4

Maybe the short answer is - “Square doesn’t record Swap Plan events” ?

If that’s the case, I can stop looking. I assumed there would be a record I could check if needed – but if there isn’t, that’s cool. I’ll add the data to my databased records when the user initiated swaps occur. It is what it is – but since square does a pretty decent job of tracking data, I assumed swaps would be tracked as well.

We do record the events and if the endpoint was called then there should be a record of it in the logs. When did the customer say they swapped the plan? :slight_smile:

The customer says this was done on 1 August, but I’m doubtful. Mainly wants a refund today.

What I do not understand is my inability to find the event in the logs (which seems to have happened sometime, since subscription records shows the swap is pending). Maybe I’m looking in the wrong place?

I can provide my company info and subscription id if you want to have a look. I just don’t see it, but I have a reputation for being an idiot 9 times out of 10.

I can try to take a look. What’s your application ID and the subscription_id? :slight_smile:

I don’t see a direct message link for you? Can I send via email:
Bryan-Square via Square Developer Forums [email protected]

Or email me: [email protected]
and I’ll reply with the secret data.

The application ID and subscription_id are safe to share. I or anyone on our team will never ask for something that can’t be shared publicly without providing instructions on how to share the value safely. :slight_smile:

Please verify that I’m doing this right:
App ID:
sq0idp-XX6UWAX013YgL8UN-wNg8w

Subscriber id:
a3310aa9-8f52-45dd-ad10-b9e1dba4b524

Perfect, thank you! :slight_smile:

This subscription a3310aa9-8f52-45dd-ad10-b9e1dba4b524 doesn’t have an action to SWAP_PLAN associated with it. Also in the last 28 days the only subscription that called SwapPlan was this subscription abeef59a-e10f-4cb8-a4f1-ff03401129ad. That’s the subscription that returned the error.

The subscription is already pending a plan change.

:slight_smile:

Let me try this again, this time double-checking my work as I go.

I was asking if there is some API record of a swap plan event – to be precise, a record of the date and subscription plan ids of the swap.
In your answer you retrieved for me subscriptionid abeef59a-e10f-4cb8-a4f1-ff03401129a
which contains this content:

    "actions": [
      {
        "id": "f0a1dfdc-675b-3a14-a640-99f7ac1cee83",
        "type": "SWAP_PLAN",
        "effective_date": "2023-08-20",
        "new_plan_variation_id": "HCJ4BXF2XANYPIKL55OUCPTH"
      }

Note that this info doesn’t include the date the swap was initiated, only the date that it’s scheduled to take effect.
Also, I think that even this sort of response may only exist in a pending but uninitiated swap? (note I retrieved this info on 19 August; swap is scheduled for 20 August – but I will definitely check back tomorrow to see how this record looks after the effective swap date).

As a counter example, please retrieve subscription [including actions]
b7bf9d78-f7e8-4a85-b852-8f70c3b444b
(or search subscriptions for customer VM1JA3416CT8V1TPPZH941AG98 [including actions]
You may need to know locationid 91F1VEX85751A

I know this customer swapped her subscription. It is apparent from her changing invoices, which you can search (you may need locationid: 91F1VEX85751A)

It appears these invoices get returned in reverse chron order.

You can see that the newest invoice ( inv:0-ChBKS4qZv_ppXRvzIYtvr0YRELsJ ) is for $47, Live+4 Subscription. 2023-07-29

The customer’s previous invoice (inv:0-ChBHxgDRMGv9RYVxkBZNJgglELsJ) is for $25,
LIVE (bronze) Subscription, 2023-06-29

My conclusion is that this customer did a swap plan between June and July 29. I don’t know the date.

However, I cannot find the swap plan as an action on that subscription record.
Also I cannot find a swap plan in the logs.

This swap plan was initiated using a form on the website, which is using the Square swap plan code - all I change in my curl code are the correct variables in the subscription id and new plan variation id.

This customer’s swap data doesn’t appear in the API logs – it was probably initiated more than 28 days ago. (Also, the logs don’t show anything for subscriptionid abeef59a-e10f-4cb8-a4f1-ff03401129a, which does currently show a swap-plan action – but that may also have been initiated more than 28 days ago.)

So back to my question; let me ask more precisely –
in the event that a customer requests info about a swap plan action, and asks me about it 28+ days after the swap occurred, is there any record anywhere of the swap’s initiation date and new plan info-- knowing that it will not appear in the API log?

Or is the only option to do some sort of line by line search of invoices?

If there was an action to swap a plan that is older then 28 day then there isn’t any additional logs. If you do need to track when a customer actually swaps a plan you can subscribe to webhook events to log the event associated to a subscription. That way when a customer asks you’ll have a record in your system of the event. :slight_smile: