#idhruv

1 messages ยท Page 1 of 1 (latest)

jagged iglooBOT
jagged laurel
#

i am also trying to retrieve subscription object from subscription schedule object via subscription = await stripe.subscriptions.retrieve(subscriptionSchedule.subscription); but this also results in null

fossil wing
#

๐Ÿ‘‹ happy to help

#

so your schedule isn't bound to a subscription

jagged laurel
#

let me check plz

fossil wing
#

sure

jagged laurel
#

it basically says Migrate an existing subscription to be managed by a subscription schedule but i don't have a subscription to begin with. In our case when user choose to go with monthly payment, we create subscription schedule

fossil wing
#

why do you need a Subscription Schedule?

#

if you don't mind me asking of course

jagged laurel
#

sure, for our particular scenario subscription schedule suits very well. I had asked plenty of questions regarding subscriptions here and as far as I roughly remember there were certain things subscription object was not supporting us and hence we decided to go with subscripton schedules

#

i dont exactly remember exact details but subscription was not supporting us with some extended features that we currently use

fossil wing
#

ok I see

jagged laurel
#

i vaguely remember right now that it was regarding start_Date and end_Date

fossil wing
#

but why do you need the subscription id then?

jagged laurel
#

in subscription we are not able to custom choose the start_date

#

something related to this we had faced problems

jagged laurel
#

and ultimately, we finalize that invoice by calling the api

fossil wing
#

you can fetch the invoice from the Schedule

#

actually let me go back at this maybe you can't I'm double checking

jagged laurel
#

nope i cannot:

{ subscriptionSchedule: { id: 'sub_sched_1Ls3vtGdNldKu1zm98HIxcR7', object: 'subscription_schedule', application: null, canceled_at: null, completed_at: null, created: 1665577269, current_phase: null, customer: 'cus_M080M5PhdKNibp', default_settings: { application_fee_percent: 7.74, automatic_tax: [Object], billing_cycle_anchor: 'automatic', billing_thresholds: null, collection_method: 'charge_automatically', default_payment_method: 'pm_1LI7kHGdNldKu1zmacV0AJsB', default_source: null, description: null, invoice_settings: null, transfer_data: [Object] }, end_behavior: 'release', livemode: false, metadata: { bookingId: 'xxx' }, phases: [ [Object] ], released_at: null, released_subscription: null, renewal_interval: null, status: 'not_started', subscription: null, test_clock: null } }

#

this has never happened with any other users, its completely new for us.

fossil wing
#

your subscription schedule is suppose to start in December

#

that's why the subscription hasn't been created yet

jagged laurel
#

that's not possible coz start date is mentioned as october 12 i.e. today in my case

#

and from date is december, so this subscription is for 2 months starting today

#

if you check the code object above, created date has the timestamp as per the pic:

fossil wing
#

no actually the subscription starts on December

#

created date isn't the phase startDate

#

it was created today I agree but you meant it to start in 8 weeks time

jagged laurel
#

no i want it to start today actually, i am not passing any future date param in phases

#

let subscriptionObj:any = {
customer: userData.stripeCustomerId.toString(),
start_date: fromDateSec,
// start_date: 'now',
end_behavior: 'release',
default_settings: {
application_fee_percent: adminPercentWithTax,
collection_method: "charge_automatically",
default_payment_method: payload.cardId,
transfer_data: {
destination: hostStripeAccId?.stripeAccountId
}
},
metadata: {'bookingId': String(bookingArr[i]?._id)},
phases: [
{
items: [
{
price: price.id,
quantity: 1,
}
],
iterations: monthlyIterations,
proration_behavior: 'none'
},
]
}`

fossil wing
#

in your creation request you mentioned start_date : 1670610600

jagged laurel
#

where exactly are you seeing 1670610600? see i marked the created date in red

#

okay i found it, this figure is in post body

#

thats just not possible

#

let me check again plz

fossil wing
#

it's not the created timestamp it's the start_date

#

these are 2 different values

#

created is the timestamp when you sent the request to Stripe to create the Subscription Schedule

#

start_date is the Start Date of the Schedule and could be in the future

#

this is basically why you needed Subscription Schedules in the first place

jagged laurel
#

but let me ask you one more thing

#

if we apply date in the future, how can we then get invoice for that subscription schedule?

#

i feel in that scenario my program will stop working completely as my further steps depend on finalizing the invoice

fossil wing
#

you won't be able to get an invoice that hasn't been created for a subscription that hasn't started yet

#

or even was created

#

you would have to wait until the subscription gets created to get the invoice

#

which is in 2 months time

jagged laurel
#

okay

fossil wing
#

let me know if you need any more help

jagged laurel
#

for now i need to investigate more internally

#

i feel. thanks a lot tarzan!!

fossil wing
#

let me know if you need any more help