#stasiekz-schedule-invoice-li-metadata

1 messages ยท Page 1 of 1 (latest)

blazing terrace
#

Hey, it's not no. You'd need a pre-existing Subscription and use the from_subscription parameter

gilded socket
#

Ok I see, but using from_subscription option seems to be not suitable if the business requirement is to actually schedule a subscription - meaning the customer is charged in the future at start_date and as far as I know having a pre-existing sub means the customer has been already charged, is that right?

blazing terrace
#

Yep, it will bring an existing Subscription under the management of the schedule. But you could create the Subscription and defer payment with the schedule

gilded socket
#

Could you tell me how to defer the initial payment with the schedule? I've read the docs and couldn't find such option.

blazing terrace
#

Well you'd create the subscription, leave it in default_incomplete status (i.e. don't confirm the PI/SI) then create the schedule with the from_subscription parameter

gilded socket
#

Is it possible to create such sub via checkout session?

blazing terrace
#

It's not, no. But then you can't create a subscription schedule via Checkout either

gilded socket
#

Ok, true. Your tip with default_incomplete seems very helpful. I would need to research more then. Thank you.

#

And the very last question. As I was playing with sub schedules endpoint I discovered it's not possible to pass both from_subscription and start_date options, how to schedule a delayed start of the sub then? So that the customer is charged for the first time at given time.

blazing terrace
#

Why do you need a schedule in that instance? You can just do that on the subscription itself

gilded socket
#

We've been trying to delay the start with bot billing_cycle_anchor and trial_end but those come with limitations. I want to be able to start charging a customer for instance in 3 years from now.

#

Are there any other options to delay the sub?

half magnet
#

Hi ๐Ÿ‘‹ hopping in as my teammate needed to step away. No, subscription schedules are the only way to create a subscription that starts in the future.

gilded socket
#

Hi ๐Ÿ˜‰ Ok, suppose I have a subscription already created with payment_behavior=default_incomplete (hopefully it doesn't charge my customer once its created) and say I want to start it in the future via the schedule. How would subscription schedule creation request payload look like if both from_subscription and start_date are not allowed?

half magnet
#

Let's take a step back. Is the overall goal here to be able to get metadata onto the items within a subscription that is created by a schedule in the future?

gilded socket
#

Yes, the overall goal is to start a subscription in the future and to be able to set metadata in both subscription and its invoice line items during creation

#

so that once I receive corresponding webhooks, I can make use of metadata contents

half magnet
#

Would it work if you put the metadata directly on the schedule initially, then when listen for customer.subscription.created events. Once that happens you can check the subscription to see if it's schedule field is populated. If it is then you can check the schedule for the relevant metadata and at that point the subscription will exist so you can copy the metadata over to the subscription and its items if you want.

gilded socket
#

Yes, that's true be at the same time customer.sucription.created event is sent, the invoice.create is as well but with invoice line items lacking the metadata

#

the metadata I need to handle the event properly

half magnet
#

Ah gotcha. I honestly think it's going to be easiest to update your event handler to be able to look at other objects to find the necessary metadata.