Subsrciptions for Items with Item Variations not being set up

Our client has Items with multiple Item variations set up as Subscriptions. When these Items Variations are paid for on the hosted payment page the subscription is not being created. Do we need to do something else to create the subscription, or is it possible the Items are not set up correctly?

:waving_hand: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

https://developer.squareup.com/docs/app-marketplace/app-subscriptions
Pricing
Define Item Variations Using Options

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

To clarify. When running GET/v2/catalog/list for SUBSCRITION_PLANS, these items are not listed. I assume because they are Item Variations rather than Subscription Plan variations

Right, that’s expected. The items will be associated to the subscription itself that’s returned by the Subscriptions API. :slight_smile:

Is there a way to get the Subscription for these items to be set up when using the hosted payment page?

The plan_variation_id will be in the CreatPaymentLink request. Is that what your referring too? Otherwise the subscription itself isn’t create till the customer pays for it. :slight_smile:

The issue is that there is not a plan_variation_id for these item variations. When running GET/v2/catalog/list for SUBSCRITION_PLANS, these items are not listed. and when I list the catalog items there is a subscription_plan_ids, but this is the same for every item variation and throws an error if I use this.

What’s the API call that your using to make the subscription? What’s the request body your passing in? :slight_smile:

We can’t make the Subscription Plan Checkout call as there is not a plan_variation_id for these items. And if we use the Square Order Checkout passing in these Item Variations the sale completes but a Subscription is not set up for future payments.

Have you created the plan variations that you want to use with the Catalog API? For example:

{
    "idempotency_key": "UNIQUE_KEY",
    "object": {
      "type": "SUBSCRIPTION_PLAN_VARIATION",
      "id": "#1",
      "subscription_plan_variation_data": {
        "name": "Coffee of the Month Club",
        "phases": [
          {
            "cadence": "MONTHLY",
            "ordinal": 0,
            "periods": 1,
            "pricing": {
              "type": "STATIC",
              "price": {
                "amount": 1000,
                "currency": "USD"
              }
            }
          },
          {
            "cadence": "MONTHLY",
            "ordinal": 1,
            "pricing": {
              "type": "RELATIVE",
              "discount_ids": [
                "5PFBH6YH5SB2F63FOIHJ7HWR"
              ]
            }
          }
        ],
        "subscription_plan_id": "VVH3YXQSQATSL3XR4LIKD3QM"
      }
    }
  }'

:slight_smile:

These subscriptions were set up in the dashboard by the client, but we need to be able to sell them online using the Checkout API.

I only have limited access to the dashboard but as far as I can see they were set up as per the Create and Manage an Item Subscription Plan Manage item subscription plans | Square Support Centre - GB

I can see that a Subscription has been created and and an Item (that has 10 or so options/variations) has been assigned to it.

When I run GET/v2/catalog/list for SUBSCRITION_PLANS this subscription plan is not returned. Is there something else they need to do on the set up?

I found this on another thread. Is this still the case that you cannot use the Checkout API for Subscriptions of Catalog Items?

Hi Bryan

Hope you are doing well

Are you able to confirm if the above is still true. Or if not why are we unable to get Variation plan ID for subscriptions that have been set up in the dashboard, in fact the subscriptions do not show at all when running the GET for SUBSCRIPTION_PLAN. Does our client need to do something else when setting up the subscriptions?

What is the location_id that your trying to get the subscription from? :slight_smile:

Hi Bryan

Sorry I am confused, a Location_id is not required when running the GET.

We are running this in the API Explorer

use Square\SquareClient;
use Square\Environments;
use Square\Catalog\Requests\ListCatalogRequest;

$client = new SquareClient(
token: ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’,
options: [
‘baseUrl’ => Environments::Production->value,
],
);
$client->catalog->list(
new ListCatalogRequest([
‘types’ => ‘SUBSCRIPTION_PLAN’,
]),
);

But the Subscriptions that we need the variation_id for are not being returned. We are getting all the Subscriptions that are marked as Legacy in the Dashboard and are able to succesfully use the Checkout API to set up subscriptions for the legacy subscriptions, but need to be able to do this for the newer ones that are associated to catalogue Items.

How do we get the subscription_variation_id for each of the catalogue Item variations that are associated with the subscription plan?

Did you create the variations for the items? Also I need the location_id to get to your account so I can further help. :slight_smile:

Hi Bryan

Yes the Item variations were created in the Dashboard. When I do a Get of Catalouge Items I can see them. The location_id is LAYW1P936RC2M

With itemized subscriptions you are going to first create the itemized order with the catalog_object_ids. Then you’ll pass that in when creating the subscription. Each item variation in the catalog doesn’t have a unique subscription_variation_id.

You’ll want to follow the phases and order templates when creating itemized subscriptions. :slight_smile:

Ignore me responding, just found my answer :grinning_face: