#tellelelele

1 messages · Page 1 of 1 (latest)

vapid shellBOT
raw acorn
#

The error message seems to be fairly clear. Do you have a specific question?

brazen coral
#

But when I make this update request:

{
  "phases": {
    "0": {
      "end_date": "1684431367",
      "start_date": "1681839367",
      "proration_behavior": "create_prorations",
      "automatic_tax": {
        "enabled": "false"
      },
      "currency": "usd",
      "items": {
        "0": {
          "quantity": "2",
          "plan": "price_XXX",
          "price": "price_XXX"
        }
      }
    },
    "1": {
      "end_date": "1687109767",
      "proration_behavior": "always_invoice",
      "start_date": "1684431367",
      "currency": "usd",
      "items": {
        "0": {
          "quantity": "2",
          "plan": "price_XXX",
          "price": "price_XXX"
        }
      }
    }
  }
}

I'm getting "You can not update a phase that has already ended. Trying to update phase 0."

#

I don't seem to be making any changes to phase 0? What can I be missing?

raw acorn
brazen coral
#

Yep here you go: req_VG3iNMsUf92YoB

#

Thank you!

raw acorn
#

It seems like you are indeed sending this in your POST request:

phases: { 0: { end_date: "1684431367" , start_date: "1681839367" , proration_behavior: "create_prorations", automatic_tax: { enabled: "false", }, currency: "usd", items: { 0: { quantity: "2", plan: "price_1LPrVPHtd7BvEtxkrPqon6FX", price: "price_1LPrVPHtd7BvEtxkrPqon6FX", }, }, },

#

So you are updating Phase[0]

vapid shellBOT
brazen coral
#

Is there a way to update phase 1 without having to add phase 0 in the request?
In this request req_qhsfGbVUKgnHG0
I got an 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."

unkempt granite
#

No - you need to pass them all

brazen coral
#

Hmm, that's what I'm trying to do with req_VG3iNMsUf92YoB but I'm getting the "You can not update a phase that has already ended. Trying to update phase 0." error even if I checked and was not making any changes to phase 0.

For additional context, I'm also retrieving the subscription schedule first, finding phase 1 (through the start date) and only updating the quantity on phase 1.

unkempt granite
#

What happens if you send those two phases as an array, instead of with the 0/1 indexes?

#

Can you try that?

brazen coral
#

I tried this but it seems like the ruby SDK adds it automatically when I do

::Stripe::SubscriptionSchedule.update(subscription_schedule_id, { phases: phases })

phases is passed without the 0/1 indexes

unkempt granite