Square: Create Subscription
Square subscriptions.createSubscription: arguments, response, policy and SDK examples.
← Subscriptions operations · Get started
Operation square.createsubscription
Provider route: POST /v2/subscriptions. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/square with npm, or alter-sdk-square with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { SquareIntegration } from "@alter-ai/square";
async function execute(input: Parameters<SquareIntegration["subscriptions"]["createSubscription"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new SquareIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.subscriptions.createSubscription(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_square import SquareIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = SquareIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.subscriptions.create_subscription(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
body | Model | Required within parent | Expand Create Subscription — request body — body |
Referenced models: Create Subscription — request body — body
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Create Subscription — response body |
Referenced models: Create Subscription — response body
Schemas
Section titled “Schemas”8 more schemas are linked from the tables above, on the schema pages.
Create Subscription — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Defines input parameters in a request to the [CreateSubscription](api-endpoint:Subscriptions-CreateSubscription) endpoint. |
canceled_date | string | Optional | The `YYYY-MM-DD`-formatted date when the newly created subscription is scheduled for cancellation. This date overrides the cancellation date set in the plan variation configuration. If the cancellation date is earlier than the end date of a subscription cycle, the subscription stops at the canceled date and the subscriber is sent a prorated invoice at the beginning of the canceled cycle. When the subscription plan of the newly created subscription has a fixed number of cycles and the `canceled_date` occurs before the subscription plan completes, the specified `canceled_date` sets the date when the subscription stops through the end of the last cycle. |
card_id | string | Optional | The ID of the [subscriber's](entity:Customer) [card](entity:Card) to charge. If it is not specified, the subscriber receives an invoice via email with a link to pay for their subscription. |
customer_id | string | Required within parent | The ID of the [customer](entity:Customer) subscribing to the subscription plan variation. Minimum length: 1 |
idempotency_key | string | Optional | A unique string that identifies this `CreateSubscription` request. If you do not provide a unique string (or provide an empty string as the value), the endpoint treats each request as independent. For more information, see [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency). |
location_id | string | Required within parent | The ID of the location the subscription is associated with. Minimum length: 1 |
monthly_billing_anchor_date | integer | Optional | The day-of-the-month to change the billing date to. Maximum: 31 Minimum: 1 |
phases | array | Optional | array of phases for this subscription |
phases[] | Model | Each item | Expand Create Subscription — request body — body phases item |
plan_variation_id | string | Optional | The ID of the [subscription plan variation](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations#plan-variations) created using the Catalog API. |
price_override_money | Model | Optional | Expand Create Payment — request body — body tip money A custom price which overrides the cost of a subscription plan variation with `STATIC` pricing. This field does not affect itemized subscriptions with `RELATIVE` pricing. Instead, you should edit the Subscription's [order template](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#phases-and-order-templates). |
source | Model | Optional | Expand Create Subscription — request body — body source The origination details of the subscription. |
start_date | string | Optional | The `YYYY-MM-DD`-formatted date to start the subscription. If it is unspecified, the subscription starts immediately. |
tax_percentage | string | Optional | The tax to add when billing the subscription. The percentage is expressed in decimal form, using a `'.'` as the decimal separator and without a `'%'` sign. For example, a value of 7.5 corresponds to 7.5%. Maximum length: 10 |
timezone | string | Optional | The timezone that is used in date calculations for the subscription. If unset, defaults to the location timezone. If a timezone is not configured for the location, defaults to "America/New_York". Format: the IANA Timezone Database identifier for the location timezone. For a list of time zones, see [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). |
Referenced models: Create Payment — request body — body tip money, Create Subscription — request body — body source, Create Subscription — request body — body phases item
Create Subscription — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Defines output parameters in a response from the [CreateSubscription](api-endpoint:Subscriptions-CreateSubscription) endpoint. |
errors | array | Optional | Errors encountered during the request. |
errors[] | Model | Each item | Expand Get Shift — response body — errors item |
subscription | Model | Optional | Expand Swap Plan — response body — subscription The newly created subscription. For more information, see [Subscription object](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#subscription-object). |
Referenced models: Get Shift — response body — errors item, Swap Plan — response body — subscription
Create Payment — request body — body tip money
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents an amount of money. `Money` fields can be signed or unsigned. Fields that do not explicitly define whether they are signed or unsigned are considered unsigned and can only hold positive amounts. For signed fields, the sign of the value indicates the purpose of the money transfer. See [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts) for more information. |
amount | JSON | Optional | |
amount (anyOf 1) | JSON | Alternative | |
amount (anyOf 1) (anyOf 1) | integer | Alternative | The amount of money, in the smallest denomination of the currency indicated by `currency`. For example, when `currency` is `USD`, `amount` is in cents. Monetary amounts can be positive or negative. See the specific field description to determine the meaning of the sign in a particular case. Format: int64 Minimum: -9223372036854775808 Maximum: 9223372036854775807 |
amount (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^(?:-(?:1[0-9]{18}|[2-8][0-9]{18}|9(?:0[0-9]{17}|1[0-9]{17}|2(?:0[0-9]{16}|1[0-9]{16}|2(?:0[0-9]{15}|[1-2][0-9]{15}|3(?:0[0-9]{14}|[1-2][0-9]{14}|3(?:0[0-9]{13}|[1-6][0-9]{13}|7(?:0[0-9]{12}|1[0-9]{12}|20(?:0[0-9]{10}|[1-2][0-9]{10}|3(?:0[0-9]{9}|[1-5][0-9]{9}|6(?:0[0-9]{8}|[1-7][0-9]{8}|8(?:0[0-9]{7}|[1-4][0-9]{7}|5(?:0[0-9]{6}|[1-3][0-9]{6}|4(?:0[0-9]{5}|[1-6][0-9]{5}|7(?:0[0-9]{4}|[1-6][0-9]{4}|7(?:0[0-9]{3}|[1-4][0-9]{3}|5(?:0[0-9]{2}|[1-7][0-9]{2}|80[0-8]))))))))))))))))|-[1-9][0-9]{0,17}|0|(?:1[0-9]{18}|[2-8][0-9]{18}|9(?:0[0-9]{17}|1[0-9]{17}|2(?:0[0-9]{16}|1[0-9]{16}|2(?:0[0-9]{15}|[1-2][0-9]{15}|3(?:0[0-9]{14}|[1-2][0-9]{14}|3(?:0[0-9]{13}|[1-6][0-9]{13}|7(?:0[0-9]{12}|1[0-9]{12}|20(?:0[0-9]{10}|[1-2][0-9]{10}|3(?:0[0-9]{9}|[1-5][0-9]{9}|6(?:0[0-9]{8}|[1-7][0-9]{8}|8(?:0[0-9]{7}|[1-4][0-9]{7}|5(?:0[0-9]{6}|[1-3][0-9]{6}|4(?:0[0-9]{5}|[1-6][0-9]{5}|7(?:0[0-9]{4}|[1-6][0-9]{4}|7(?:0[0-9]{3}|[1-4][0-9]{3}|5(?:0[0-9]{2}|[1-7][0-9]{2}|80[0-7]))))))))))))))))|[1-9][0-9]{0,17})$(?!\n) |
amount (anyOf 2) | null | Alternative | |
currency | JSON | Optional | |
currency (anyOf 1) | Model | Alternative | Expand Create Location — request body — body location currency The type of currency, in __ISO 4217 format__. For example, the currency code for US dollars is `USD`. See [Currency](entity:Currency) for possible values. See [Currency](#type-currency) for possible values |
currency (anyOf 2) | null | Alternative |
Referenced models: Create Location — request body — body location currency
Create Subscription — request body — body source
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | The origination details of the subscription. |
name | JSON | Optional | |
name (anyOf 1) | string | Alternative | The name used to identify the place (physical or digital) that a subscription originates. If unset, the name defaults to the name of the application that created the subscription. Maximum length: 255 |
name (anyOf 2) | null | Alternative |
Get Shift — response body — errors item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents an error encountered during a request to the Connect API. See [Handling errors](https://developer.squareup.com/docs/build-basics/handling-errors) for more information. |
category | string | Required within parent | Indicates which high-level category of error has occurred during a request to the Connect API. The high-level category for the error. See [ErrorCategory](#type-errorcategory) for possible values Known values: API_ERROR, AUTHENTICATION_ERROR, INVALID_REQUEST_ERROR, RATE_LIMIT_ERROR, PAYMENT_METHOD_ERROR, REFUND_ERROR, MERCHANT_SUBSCRIPTION_ERROR, EXTERNAL_VENDOR_ERROR |
code | Model | Required within parent | Expand Get Shift — response body — errors item code The specific code of the error. See [ErrorCode](#type-errorcode) for possible values |
detail | string | Optional | A human-readable description of the error for debugging purposes. |
field | string | Optional | The name of the field provided in the original request (if any) that the error pertains to. |
Referenced models: Get Shift — response body — errors item code
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: square.createsubscription. Catalog operation: CreateSubscription. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Required provider scopes: ["CUSTOMERS_READ", "INVOICES_WRITE", "ITEMS_READ", "ORDERS_WRITE", "PAYMENTS_WRITE", "SUBSCRIPTIONS_WRITE"]
Pinned headers: {"Square-Version": "2026-11-18"}