#Gregg

1 messages ยท Page 1 of 1 (latest)

grizzled badgerBOT
placid warren
#

I'm not sure if there is already a phase 0 or not, but the error seems to imply you'll need to start at index 0 regardless

stiff pulsar
#

@placid warren I tried that using the subscription schedule update endpoint but it then says "You can not modify the start date of the current phase.",

#

If I have an existing subscription, but no schedule, I read that I first need to create the schedule from the subscription. That part worked. I see one schedule now with 1 phase (current subscription details). Now I want to add another phase to the schedule to change the price and quantity at a future date.

placid warren
#

Can you provide request IDs for (a) the request that surfaced the error "You can not modify the start date of the current phase." and (b) for the request that gave you the error "If passing an array with explicit keys (e.g. foo[0]=a&foo[1]=b) instead of as an array (e.g. foo[]=a&foo[]=b), the keys must be numeric and sequential starting from 0. You passed the keys 1, we expected to have a key with the value 0."?

stiff pulsar
#

@placid warren The phase 0 error is found in this request
req_wFmJiBnXNYL3Re and start date error found in
req_stT5yEdQnnz3SE

placid warren
#

Can you try not passing start_date: "now" on the 0 phase? That won't work, since that phase has technically already started.

stiff pulsar
#

Yeah let me try

#

@placid warren This one I did without start date but used phase[0] for the price and quantity. req_Blct6K6jCezOct

placid warren
#

I believe you have to pass in the same data that the Phase already has on it for phases that have already started, so in this case try omitting the quantity and passing in the Price that's already being used price_1KteRDCiGnwRdCOXxA1aSpWX

I still think there might be a bug here, but I want to try and unblock you if possible

stiff pulsar
#

ok @placid warren I tried that here req_3yzeXdD5UY2gXB Phase[0] has just the old price. Also, I set the start date to now for phase[1], along with price and quantity.

placid warren
#

Did you try specifying an end_date? or iterations?

stiff pulsar
#

no because I saw that the "release" was acceptable there

#

let me try passing iterations instead

#

@placid warren seems it's getting closer req_U5UZygZF2JMMl4. I can play with this. So the trick is to match the price in phase 0 to the existing price, then I can do phase 1 with the updates as long as the start date starts when the period of phase 1 ends.

devout zealot
#

Hi ๐Ÿ‘‹ I'm stepping in as @placid warren needs to go. Can you describe why you are creating overlapping phases for this subscription schedule?

stiff pulsar
#

Hi @devout zealot I have a customer that is getting billed every 3 months but after the first 3 months I want to change the price to a 12 month period. I would like to create a new schedule that has this update planned for 3 months from now. I assume that means phase 0 has the first price with 1 interval that started already. Then phase 1 would be the start date that matches the end date of phase 0.

devout zealot
#

Wait, I'm confused. The price used has an annual interval. How is the customer being billed every 3 months?

stiff pulsar
#

sorry I was trying to give the original scenario and I see that the price was annual. Let me submit a new request that matches my comment above

devout zealot
#

Okay well here is the basics and we can discuss particulars when you have a concrete example request.

  • Phase 0. will need to be a copy of the existing phase but with iterations set to 1.
  • Phase 1. Don't specify either start_date or end_date. Use a different Price ID corresponding to the 12 month price.
stiff pulsar
#

@devout zealot OK here's the latest test req_KZrzFU2Hj8aXxu. Besides Price ID, what has to be sent again for Phase 0? I tried sending the same start_date as what phase 0 has but it rejected it saying I can't update the phase 0 start.

devout zealot
stiff pulsar
#

I do see a start_date on phase 0 but I can't pass it again

devout zealot
#

Wait wait wait.... Lemme test something. I swear that is exactly what I do in my tests with Subscription Schedules.

stiff pulsar
#

It would make sense to leave start_date empty in phase 1 if I want to follow the phase 0 end_date

devout zealot
#

Yeah, that's how it's designed

stiff pulsar
#

@devout zealot it seems like the bug here (I think) is that the schedule is initially created from an existing subscription. So I'm not explicitly setting the start_date in phase 0.

devout zealot
#

That doesn't matter. There is a start_date and an end_date set for that phase.

stiff pulsar
#

ok do you know if there's another identifier that has to be passed in to match phase 0 along with price_id?

devout zealot
#

When I have done it in the past I have copied the phase 0 exactly in my code from the array of phases returned by the API. I'm trying to test that again but it got busy just now.

stiff pulsar
#

No problem. When you say copy phase 0 exactly, is it everything in the phases block since there's just one?
"phases": [
{
"add_invoice_items": [
],
"application_fee_percent": null,
"automatic_tax": {
"enabled": true
},
"billing_cycle_anchor": null,
"billing_thresholds": null,
"collection_method": null,
"coupon": null,
"currency": "usd",
"default_payment_method": null,
"default_tax_rates": [
],
"description": null,
"end_date": 1671575552,
"invoice_settings": null,
"items": [
{
"billing_thresholds": null,
"plan": "price_1LkEz0CiGnwRdCOXTZA8PWXI",
"price": "price_1LkEz0CiGnwRdCOXTZA8PWXI",
"quantity": 10,
"tax_rates": [
]
}
],
"metadata": {
},
"proration_behavior": "create_prorations",
"start_date": 1663713152,
"transfer_data": null,
"trial_end": null
}
],

devout zealot
#

Right, sorry, phases.items is what I would copy (the whole array) to a variable and then add either an end_date or a number of iterations to the phase[0] item as well as a new item representing the price you wish to use after the first phase completes

stiff pulsar
#

OK gotcha. I'll try that. If it doesn't work, I'll start a new thread. Thanks again!