Trying to create a subscription, can't find order_template_id

So I am trying to create a subscription using the API and I’ve already set up the products and created a plan with the items I want for the subscription.

It took a minute but I’ve figured out the plan_variation_id, but now when trying to set up the phases I can’t seem to find where the order_template_id is.

I’m using the PHP SDK in Laravel, here is my request:

$phase = new \Square\Models\Phase();

$phases = [$phase];
$body = new \Square\Models\CreateSubscriptionRequest('LYVWQAPT3VNTF', '82538KW06TYM5NXCEMWJ9YRABG');

$api_response = $client->getSubscriptionsApi()->createSubscription($body);

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

The order_templet_id will be in the plan. When you retrieve the plan you should see the ID. :slight_smile:

which API should I be using to retrieve the plan?
would it be in the Catalog API?

Yes, that’s correct. You’ll use the Catalog API to get the plan. :slight_smile:

So with Catalog API, i don’t see the order_template_id

In phases, I see the uid would that be it?

here is what i got from the response:

      "updated_at": "2023-08-28T01:09:07.444Z",
      "created_at": "2023-08-28T00:54:10.086Z",
      "version": 1693184947444,
      "is_deleted": false,
      "present_at_all_locations": true,
      "subscription_plan_variation_data": {
        "name": "Premium",
        "phases": [
            "uid": "EOQUTNBYLNVHJM2HCAMNTOJ7",
            "cadence": "MONTHLY",
            "ordinal": 0,
            "pricing": {
              "type": "RELATIVE"
        "configuration": {
          "buyer_allow_indefinite_pausing": true,
          "buyer_max_cycles_to_skip": 0
        "subscription_plan_id": "4IDDD4RKNNWYQ7DEEQLEYXEB"

Apologies, the order_templet_id is apart of the subscription. If you retrieve the subscription 95556a9a-307c-4b81-83b4-c8eb5cb04275 it will be in the response.

    "subscriptions": [
            "id": "95556a9a-307c-4b81-83b4-c8eb5cb04275",
            "location_id": "LYVWQAPT3VNTF",
            "customer_id": "82538KW06TYM5NXCEMWJ9YRABG",
            "start_date": "2023-08-28",
            "charged_through_date": "2023-09-28",
            "status": "ACTIVE",
            "invoice_ids": [
            "buyer_self_management_token": "EDCOCqkj6BqI0M7EporeCPa09ar79HcabojNyN6WapmapnKPiWgp9I7k15KHxPD-CAHcIy5dbX9FprhfkAF9iTqXaWf3Lcwrckj1Mo2aT88qMHDvi27OCKOy7bWL6cLqZw==",
            "version": 1,
            "created_at": "2023-08-28T02:27:56Z",
            "timezone": "UTC",
            "source": {
                "name": "Square Subscriptions Dashboard Web"
            "phases": [
                    "uid": "2192409f-d90b-436e-b228-7e7462a2189e",
                    "ordinal": 0,
                    "order_template_id": "qqY906nhrzW72OmDYzawSiS10PZZY",
                    "plan_phase_uid": "EOQUTNBYLNVHJM2HCAMNTOJ7"
            "plan_variation_id": "Z6CUCH7ORRZRMUUQLAXGF7OV"


so i’m trying to create a subscription with a new customer using the API

if I’m getting order_templete_id from other subscriptions its not working.

where do i get the order_templete_id for creating a new subscription?

so i’ve found the best solution for my situation, for anyone who finds this in the future.

the problem is when creating a plan using the web dashboard, there is no option to set the pricing type, it is automatically set to relative - which mean when using the API it forces the phases, which where i was stuck getting all the ids

what i did was create a catalog object using Upsert catalog object api (which is very confusing)
create a type of SUBSCRIPTION_PLAN
add subscription_plan_data
within that add subscription_plan_variations
within that add subscription_plan_variation_data
then within that add phases
and within that add pricing
set type to static
add recurring_price_money

this an out of date video but gives an idea of what is needed:

so now when using the Create subscription api - all i need is the plan_variation_id and it’ll add the customer to the plan without the need of phases

Thanks for sharing your findings. Yes, the subscription model did recently change and that video is now outdated. I’ll be sure to share this with the team. :slight_smile:

1 Like

Hi Bryan,

I have a quick question: if I wanted to use the new subscription model and features to tie into a product, what are the steps to do so?

Should i be creating the plan inside square dashboard or use the api to create the plan?

The problem i was having was trying to assign a plan to a customer

You can use the new subscription model to create subscriptions either way. Is the plan your trying to assign to the customer an old one or a newly created one? :slight_smile:

It is a newly created one, I’ve created it in the dashboard and I’m using the api from my app to look up the customer or create the customer then I’m assigning it to the plan but I can’t seem to find the order template id

Do I need to create an order first before adding it to a subscription?

If you retrieve the plan with the Catalog API it will have the order_templet_id in the plan. :slight_smile:

I finally figured it out!!

I’m going to lists my steps for anyone else that is stuck like me, hopefully it’ll save you some time and not have to spend days/weeks like me. Im using PHP/Laravel;

First you’ll need to create the items and subscription plan inside the Square dashboard and use the Catalog API to get the IDS, of the plan varaition and catalog item ids

  1. new SquareClient;
  2. new Address;
  3. new FulfillmentRecipient();

(Checks if the customer exists)

  1. new CustomerTextFilter();
  2. new CustomerFilter();
  3. new CustomerQuery();
  4. new SearchCustomersRequest();
    $searchResponse = $client->getCustomersApi()->searchCustomers($searchRequest);
  • if customer exists
  • if customer doesn’t exisit
    new CreateCustomerRequest();
    then set the name, address, email etc.

(Add Credit card to customer)

  1. new Card();
  2. new CreateCardRequest();

(Create the order) – HERE was where I was stuck

  1. new OrderLineItem(“1”);
    ->setCatalogObjectId() of the item in the subscription plan
  2. new Order();
  3. new CreateOrderRequest();
  4. new OrderFulfillment();

(Create the Subscription)

  1. new Phase();
    ->setOrderTemplateId($orderId); (ID from CreateOrderRequest(); )
  2. CreateSubscriptionRequest();

I do have a 1 question:

I want to give a free trail for the first month, do i create multiple freqencies in the plan? or would that be phases in the subscription plan variation?

Because in the dashboard there isn’t anything in the setup with phases

Thanks for sharing your findings. With the new subscription model you’ll have to offer a free trial by added multiple frequencies to the plan. At this time added a free trial to subscriptions created in the Dashboard isn’t currently available. You’ll have to do this with the API. :slight_smile: