#bscrypt_api

1 messages ยท Page 1 of 1 (latest)

bitter hatchBOT
#

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

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

blazing yew
#

Hi ๐Ÿ‘‹

When updating Subscription Schedules, you need to pass all current and future phases. Can you share a request ID for a request where you create a Subscription Schedule?

twilit sluice
#

Hi!

But when sending the updates for the phases themselves, what are the required fields to send back? Sorry, where can I get that if I'm just using a throwaway Node app to test?

blazing yew
twilit sluice
#

For example, when I create a new schedule, this is what the two phases look like:

  {
    add_invoice_items: [],
    application_fee_percent: null,
    billing_cycle_anchor: null,
    billing_thresholds: null,
    collection_method: null,
    coupon: null,
    currency: 'usd',
    default_payment_method: null,
    default_tax_rates: [],
    description: null,
    discounts: [],
    end_date: 1744184704,
    invoice_settings: null,
    items: [ [Object] ],
    metadata: {},
    on_behalf_of: null,
    proration_behavior: 'create_prorations',
    start_date: 1741592704,
    transfer_data: null,
    trial: true,
    trial_end: 1744184704
  },
  {
    add_invoice_items: [],
    application_fee_percent: null,
    billing_cycle_anchor: null,
    billing_thresholds: null,
    collection_method: null,
    coupon: null,
    currency: 'usd',
    default_payment_method: null,
    default_tax_rates: [],
    description: null,
    discounts: [],
    end_date: 1746776704,
    invoice_settings: null,
    items: [ [Object] ],
    metadata: {},
    on_behalf_of: null,
    proration_behavior: 'create_prorations',
    start_date: 1744184704,
    transfer_data: null,
    trial_end: null
  }
]```
#

As you can see, the first phase has trial set to true

#

But if I don't send trial: true back when updating it, it will remove the trial and set it to active immediately.

blazing yew
#

Can you please try and find some request IDs for this flow? They should be available in your dashboard logs.

twilit sluice
#

Yes, let me look for the creation one first.

blazing yew
#

Great, thanks!

twilit sluice
#

Ok, here is where I created the schedule: req_QvtAkOynEG2dvg

bitter hatchBOT
twilit sluice
#

Here, I update the quantity for all phases and I do include the trial: true flag: req_pYktPjIqNiTFfV

blazing yew
#

Alright and the phases that are returned are what you want, right? Form the first request

twilit sluice
#

Yes, basically, that is all fine. But when I make an update to the phases, and I don't pass the trial: true property back for the first phase, the trial is immediately removed. req_VGTGzXvSqXYVAN

#

I guess I'm confused as to what phase properties I have to send back so that they remain unchanged.

blazing yew
#

Schedules overwrite the Phases array

#

So your update is ovewriting your existing settings

twilit sluice
#

Okay, so I'm assuming that means that everything has to be passed back.

blazing yew
#

Correct

#

This is what is in your update request:


  phases: {
    0: {
      end_date: 
"1744184704"
,
      items: {
        0: {
          price: "price_1Pm2yGF2rxYbdwMe3E7jkmck",
          quantity: "10",
        },
      },
      start_date: 
"1741592704"
,
    },
    1: {
      end_date: 
"1746776704"
,
      items: {
        0: {
          price: "price_1QzsVYF2rxYbdwMeReJHOIjY",
          quantity: "10",
        },
      },
      start_date: 
"1744184704"
,
    },
  },
#

You can see you are overwriting the first phase without the trial: true param

twilit sluice
#

Okay, so if I don't pass in any other properties for phases when I initially created them, can I just not pass any of those properties when updating?

#

Or is there some other process that could add data to those properties without my intervention that I would need to make sure are not overridden?

blazing yew
#

Correct. I recommend making a copy of the current phase array and then adding/changing what you want in your NodeJS code. Then passing it all back in the Update request.

twilit sluice
#

Okay, great. I will do that moving forward then. Thanks for your help today!