Create Subscription

Hi Support,

I am trying to Create a Subscription to a Plan for a Customer.
(not selling any phyisical product its just a fixed monthly payment for use of our services)
I have created a Plan in the dashboard, added an ‘item’ to the Plan, set the item price.
I have then set Frequency to Monthly - never ending.

I get stuck when using CreateSubscriptionRequest() trying to create a Subscription for a Customer to this Plan (customer/card already created successsfully):

    $body = new \Square\Models\CreateSubscriptionRequest(SQUARE_LOCATION_ID, $squareCustomerId);

I get the below error
ERROR: “Phases with RELATIVE pricing type must have phases on the subscription”

I then queried the SUBSCRIPTION_PLAN using:
$client->getCatalogApi()->listCatalog(null, ‘SUBSCRIPTION_PLAN’)

and noticed that there is a ‘Phase’ with pricing set to RELATIVE. I suspect this should be set to STATIC . However there is no option to set this value within the dashboard.
Is there a way to change this value to STATIC via the API? Is this even the correct solution or am I way off?

Much Appreciated,

Should I use the dashboard at all for creating the Plan itself? Or would it be better to create the Plan via API?
If via API, I would also really appreciate a code snippet of the whole Plan-creation process as I feel I have it incorrect (sorry for my lack of understanding).
I am not sure if I need to create an ‘item’ or not.
Is it enough to create a single Plan and a single Plan_Variation with one phase and pricing info ?
Would this be enough for customers to subscribe to, since i’m not selling an actual item, rather a subscription to the Plan itself?

I have same issue,
i created subscription plan and link article.

Doing this I have null $api_response = $this->client->getCatalogApi()->listCatalog(null, ‘SUBSCRIPTION_PLAN’);

and i can’t get subscription_plan_id …

That error is happening cause of the change in the subscription model that took place with the 2023-06-08 release. All subscription created in the Dashboard will be a RELATIVE subscriptions. If you’d like to create a STATIC subscription you’ll need to do it with the APIs. Also here is the Documentation on how to use the new subscription model with examples. :slightly_smiling_face:

Thanks Bryan - That documentation does not mention the creation of any ITEM, so I will skip this step and just apply STATIC PRICING to my PLAN_VARIATION_PHASE - I am guessing this will be enough for Customers to Subscribe to?
(Was just a little confused as the Dashboard forces you to create an ITEM which has its own PRICING - then attaches the ITEM to the PLAN), will try the documentation method instead:
Create Plan
- Create Plan Variation
- Create at least one Phase
- Create Pricing for Phase

This walkthrough does have you create the subscription with an ITEM similar to the Dashboard. An ITEM in your scenario is what they’re subscribing to. You’ll still use an existing or create create a new one to use for subscriptions. :slightly_smiling_face:

Each Phase of the SubscriptionPlanVariation contains data about the pricing of the item or service being sold:
*** The type of pricing can be RELATIVE or STATIC. If it’s STATIC, a price amount must be set, which overrides the price of any items subscribable through the subscription plan. If it’s RELATIVE, the price of the subscribable items is included in an order template on the subscription and the combined item prices are used for the price of the PlanVariation.**

above is from the documentation.
Looks like STATIC pricing on the SubscriptionPlanVariation PHASE will override any ITEMS pricing - so i’m just creating a ‘dud’ item for the sake of it, then overriding the price?

** UPDATE - I done as above (created a $0 item) - then set STATIC pricing on the PHASE. This did seem override the item price of $0 to my PHASE pricing as expected - But now the Plan is flagged as a’ Legacy Plan’ in my dashboard :smiley: . I suspect this is ok and will proceed

Great! Yes, this is still supported. :slightly_smiling_face: