#DamManc

1 messages · Page 1 of 1 (latest)

neon muralBOT
silver cedar
#

Hello, can you send me the code you are creating the subscription schedule with?

#

Metadata isn't automatically passed between most objects in Stripe so you may need to set it somewhere slightly different from where you currently have it

narrow heath
#

const schedule = await stripe.subscriptionSchedules.create({
customer: checkout_completed.metadata.customer,
start_date: 1663925574,
end_behavior: 'release',
metadata: {
don_id: donId
},
phases: [
{
items: [{ price: checkout_completed.metadata.price, quantity: 1 }],
},
],
}, {
stripeAccount: checkout_completed.metadata.stripeAccount
});

#

I'm setting, customer, start_date, end_behavior, metadata, phases

#

the data in checkout_completed.metadata are right 🙂 im listening the checkout.session.completed

#

but after that I have the case invoice.paid in which i need don_id. aaa im understand now

#

i pass donId null...its that for sure, let me try

silver cedar
#

Gotcha. So after looking in to this a bit, it looks like there isn't a way to have this metadata automatically go to the invoices here but there is a workaround that is pretty straighforward

#

Setting the metadata where you have it now will set the metadata on the schedule itself. If you set it in the phases, the metadata will be set on the subscription itself. If you do that, you can just listen for the invoice.created event on your webhook and then copy the metadata from the subscription to your invoice each time you get that event

narrow heath
#

ok thank you, but i need this metadata for invoice.paid and invoice.payment_failed case

#

a ok, you advice to try to pass metadata inside phases...ok I can try this. The problem is that 1hour its the time that the invoice is paid after subscription schedule so my test are slow

silver cedar
#

Yeah, the metadata would be on those events after you set it on the invoice itself.

#

They let you simulate time going by instead of having to wait