When creating a subscription with the Catalog API, is specifying the period mandatory?
Hello. I am developing a membership platform service using Square. I am creating a subscription plan with the following code.
client.catalog.upsert_catalog_object(
body: {
idempotency_key: generate_idempotency_key,
object: {
id: item_id,
type: 'SUBSCRIPTION_PLAN',
subscription_plan_data: {
name:,
phases: [
{
cadence: 'MONTHLY',
recurring_price_money: {
amount: price,
currency: 'JPY',
},
},
],
},
},
},
)
When I retrieve this subscription plan, I receive an object like the following. I would like to point out that data[:subscription_plan_data][:subscription_plan_variations][0][:subscription_plan_variation_data][:phases][0][:periods]
is set to 1.
{:type=>"SUBSCRIPTION_PLAN",
:id=>"xxx",
:updated_at=>"2024-09-16T04:39:24.755Z",
:created_at=>"2024-09-16T04:39:24.789Z",
:version=>1726461564755,
:is_deleted=>false,
:present_at_all_locations=>true,
:subscription_plan_data=>
{:name=>"xxx",
:subscription_plan_variations=>
[{:type=>"SUBSCRIPTION_PLAN_VARIATION",
:id=>"xxx",
:updated_at=>"2024-09-16T04:39:24.995Z",
:created_at=>"2024-09-16T04:39:25.035Z",
:version=>1726461564995,
:is_deleted=>false,
:present_at_all_locations=>true,
:subscription_plan_variation_data=>
{:name=>"xxx", :phases=>[{:uid=>"xxx", :cadence=>"MONTHLY", :periods=>1, :ordinal=>0, :pricing=>{:type=>"STATIC", :price=>{:amount=>300, :currency=>"JPY"}, :price_money=>{:amount=>300, :currency=>"JPY"}}}], :subscription_plan_id=>"xxx"}}]}}
According to the documentation at Subscription Plans and Variations, it states:
If no periods are provided, the phase never ends and the subscription plan has no end date.
I would like users to continue subscribing until the subscription plan is stopped, but in reality, only the first month is being charged. What should I specify for the period?