#harry_api

1 messages ยท Page 1 of 1 (latest)

gray ruinBOT
#

๐Ÿ‘‹ 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/1331952388021555230

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

steel parrot
#

hi there!

wicked fractal
#

Hi

steel parrot
wicked fractal
#

yes

#

check this req req_0bTmpkdfQXc6yj

steel parrot
#

your API request to update the schedule has this: end_date: "1737569739", which is 2025-01-22. So on the 22 the phase ended, and the above invoice was created

wicked fractal
#

What I am saying is according to this the plan should be changed on 3rd Feb, but according to event messages it got changed immediately

steel parrot
#

according to this the plan should be changed on 3rd Feb
no. your phase is ending on Jan 22, so a new invoice is created on Jan 22.

wicked fractal
#

Ok understood, my bad the first phase should have been the current plan attached to the subscription

gray ruinBOT
wicked fractal
#

?

steel parrot
#

I'm not sure I understand your question. but if you want the Invoice to be created on Feb 3rd, then one of the phase needs to end on Feb 3rd.

terse bluff
#

๐Ÿ‘‹ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!

wicked fractal
terse bluff
#

but all of your phases have the same start and end time

#

am I missing something here?

wicked fractal
#

I need to know what should I do If I am changing the plan from plan-a to plan-b for a particular subscription, and this change should happen at subscriptions next billing cycle, what should I sent?

#
{
  "proration_behavior": "none",
  "end_behavior": "release",
  "phases": {
    "0": {
      "end_date": "1737569739",
      "start_date": "1733143629",
      "items": {
        "0": {
          "quantity": "1",
          "price": "plan_RKbm8zuMp8c4xk"
        }
      },
      "collection_method": "charge_automatically"
    },
    "1": {
      "end_date": "1738558800",
      "start_date": "1737569739",
      "items": {
        "0": {
          "quantity": "1",
          "price": "plan_RKbm8zuMp8c4xk"
        }
      },
      "automatic_tax": {
        "enabled": "false"
      }
    },
    "2": {
      "end_date": "1738558801",
      "metadata": {
        "unpaid_invoices": "0"
      },
      "automatic_tax": {
        "enabled": "false"
      },
      "items": {
        "0": {
          "quantity": "1",
          "price": "plan_RGB50OUDizU5FD"
        }
      },
      "collection_method": "charge_automatically",
      "proration_behavior": "none",
      "start_date": "1738558800"
    }
  }
}
#

check last phase here

terse bluff
#

the start of each phase should be equal to the end of the previous phase

wicked fractal
#

See I just created this schedule in test mode
req_uzt47Hwp8W60NZ but no invoice was created in this case

#

this is the schedule id sub_sched_1QkPCoJ7XeRxWFUI3Fcb5gT8

terse bluff
#

can you describe what are you trying to achieve please?

#

you have a current ongoing subscription, what do you want to happen to it?

wicked fractal
#

I want to change the plan of that subscription, but the change should be such that the next invoice should be of the new plan. The change should happen at the current_period_end of subscription

terse bluff
#

so you only need 2 phases

wicked fractal
#

okay

terse bluff
#
 {
    end_behavior: 'release',
    phases: [
      {
        items: [
          {
            price: schedule.phases[0].items[0].price,
            quantity: schedule.phases[0].items[0].quantity,
          },
        ],
        start_date: schedule.phases[0].start_date,
        end_date: schedule.phases[0].end_date,
      },
      {
        items: [
          {
            price: '{{new price}}',
            quantity: 1,
          },
        ],
        iterations: 1,
      },
    ],
  }
wicked fractal
#

okay will this schedule be released as soon as the plan gets upgraded?

terse bluff
#

after 1 iteration from the new plan

wicked fractal
#

okay