#7ckngMad
1 messages · Page 1 of 1 (latest)
hello! is there a difference in how you're planning to handle the payment for a subscription that has a trial or doesn't have a trial?
Not really, I have no problem checking out the user of the different types, its just I need it because of webhooks, im trying to send events to mixpanel based on some logic, if i explain in brief, we are trying to differentiate which users has subscribed or purchased a subscribtion through an influencer URL
our plan is sending a key-pair value to metadata when creating a customer then use that to differentiate that this user has subscribed using an influencer url then send an even to mixpanel
as we have both types of subscription, one with trial and one which starts immediately, thats why i wanted to know the above informations
both will generate an invoice.paid event
when you create the subscription, like you mentioned, you can pass in the metadata which should allow you to differentiate between them
thanks for confirming that invoice.paid event is the one i should listen to , now I wanted to ask one more thing which is when the as the metadata value does not get passed to other types of objects, like if i add them to a subscription object it will persist through all of the subscription related events but it won't be available on the invoice.paid event which makes it hard to know if the invoice which is getting paid right now is a user who subscribed or purchased through influencer url
now to tackle this i thought of retreiving the customer/subscription object when i listen to the invoice.paid event and check for the metadata value
this guide might be helpful if you haven't seen it yet : https://stripe.com/docs/billing/subscriptions/webhooks
you wouldn't need to retrieve the subscription again - the invoice item would already contain it : https://stripe.com/docs/api/invoices/line_item#invoice_line_item_object-metadata
for line items with type=subscription this will reflect the metadata of the subscription that caused the line item to be created.