#plim3147_unexpected

1 messages ¡ Page 1 of 1 (latest)

potent warrenBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1219103184656793683

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

bright kiln
#

This request passed at 7:32 pm et:

{
  "metadata": {
    "dynamicOrganizationId": "3930c5e3-5d5e-4545-ad04-ddbd4d3206e9"
  },
  "items": {
    "0": {
      "price": "price_1MW2kRGC2agebJWXWr6A7GPi"
    }
  },
  "customer": "cus_PkzAPuG4jFgWd5",
  "collection_method": "charge_automatically",
  "payment_settings": {
    "save_default_payment_method": "on_subscription"
  },
  "trial_settings": {
    "end_behavior": {
      "missing_payment_method": "pause"
    }
  },
  "billing_cycle_anchor_config": {
    "day_of_month": "31"
  },
  "trial_period_days": "14"
}

while this one failed at 8:40 pm et:

{
  "metadata": {
    "dynamicOrganizationId": "eeba3482-bdce-4d92-bd31-ca1832382b16"
  },
  "items": {
    "0": {
      "price": "price_1MW2kRGC2agebJWXWr6A7GPi"
    }
  },
  "customer": "cus_Pl0HDM70QN17iZ",
  "collection_method": "charge_automatically",
  "payment_settings": {
    "save_default_payment_method": "on_subscription"
  },
  "trial_period_days": "14",
  "billing_cycle_anchor_config": {
    "day_of_month": "31"
  },
  "trial_settings": {
    "end_behavior": {
      "missing_payment_method": "pause"
    }
  }
}

the failure reason being:

{
  "error": {
    "message": "Trial end (1711932134) cannot be after billing_cycle_anchor (1711845734).",
    "param": "trial_end",
    "request_log_url": "https://dashboard.stripe.com/logs/req_VslsysxT3hWc3c?t=1710722534",
    "type": "invalid_request_error"
  }
}

even if clearly, i did not pass any specific billing_cycle_anchor

fleet sealBOT
elder ravine
#

Thanks for waiting! Looking into this now

elder ravine
#

The issue was due to: https://dashboard.stripe.com/logs/req_VslsysxT3hWc3c

  • The trial will end on 2024-04-01 00:42:14
  • However, your billing cycle anchor at 31, which will be 2024-03-31 00:42:14
  • The previous one works because those will end the trial the before the billing anchor date
  • After March 18, the error will start throwing since the trial ends after the billing cycle anchor
bright kiln
#

My understanding of billing_cycle_anchor_config is that Stripe will always attempt to set the end of the billing period to the last day of the month.

So for a new subscription whose trial ends on April 1, my expectation is that Stripe would have made the first billing period of the non-trial period to be April 1 to April 30. Is this not the case?

Based on this: https://docs.stripe.com/billing/subscriptions/billing-cycle#use

Learn how to set the billing date for subscriptions.

elder ravine
#

billing_cycle_anchor_config will take the billing cycle anchor of the month which the request is created if month is not specified.

bright kiln
#

I see. That part wasn't very clear about the order of operations (perhaps the doc should also include the example of the trial period, and how that plays into the billing_cycle_annchor_config)

So just so in understand, to do:

So for a new subscription whose trial ends on April 1, my expectation is that Stripe would have made the first billing period of the non-trial period to be April 1 to April 30.

I need to specify the calendar month of the non-trial which to follow the anchor config? In the example above, instead of just:

  "trial_period_days": "14",
  "billing_cycle_anchor_config": {
    "day_of_month": "31" <---- this anchors in the month of march, because month is not specified
  },

It should be this?

  "trial_period_days": "14",
  "billing_cycle_anchor_config": {
    "day_of_month": "31",
    "month": "4" <--------- start anchoring only in the month of april
  },
elder ravine
#

Let me double check on this!

#

billing_cycle_anchor_config is a new feature and putting it to month of 4 will not work too

#

Upon checking, there is no way to change the billing cycle anchor to 30 Apr with using billing_cycle_anchor_config