#arvindkgs

1 messages · Page 1 of 1 (latest)

simple wadi
#

heya @lament cedar, can you share the event id of that invoice.created event?

lament cedar
#

in_1JcjuYLqLSW4Y8iKDMidZZlD

#

@simple wadi its in_1JcjuYLqLSW4Y8iKDMidZZlD

#

@simple wadi sorry that's the invoice-id

#

@simple wadi event id : evt_1JcjuZLqLSW4Y8iK9VizzFaL

simple wadi
#

@lament cedar the subscription id is returned in that event, to clarify, is it that you are expecting other parameters for a subscription object?

lament cedar
#

@simple wadi I see subscription: null

simple wadi
#

you search for sub_

#

is it not there?

lament cedar
#

it's there, but there is also "subscription": null

#

you can search for that

#

the one's where I see subscription id is for individual subscription items

#

but overall subscription association for this draft invoice is null

simple wadi
#

If that value is not set, the created invoice will include all pending invoice items for the customer.

#

i would recommend you check the invoice line item subscription

#

not the invoice.subscription

lament cedar
#

so are you saying that invoice.subscription field can be null

simple wadi
#

yes, that's possible

lament cedar
#

I am storing subscription and invoices as one-to-many relationship in my db

simple wadi
#

as you mentioned "This only happens for events manually triggered via API. Automatic invoice generated by Stripe has this field populated."

lament cedar
#

meaning every invoice is associated with atleast one. subscription

#

I will not be able to make this association if an invoice is not associated with a subscription

#

is my understanding of subscription and invoice relationship incorrect?

simple wadi
#

sorry, i think i got a bit confused earlier. To summarize the problem :

i guess the main problem here is that you want to test the invoice.created webhook, and you're expecting the invoice.created event to contain a value in the subscription parameter. Unfortunately, if you attempt to trigger the invoice manually, you don't get a value in the subscription parameter.

lament cedar
#

okay, thank you for the clarification

simple wadi
#

give me a few moments to think about if there is any workaround here and get back to you

lament cedar
#

thank you

simple wadi
#

@lament cedar if you're attempting to test invoice.created upon renewal of the subscription. There really isn't a good way to test this - you could use a shorter subscription interval e.g. one day. Or if you are okay with testing invoice.created when a customer first subscribes to a subscription - it should trigger invoice.created event where it should contain the subscription object

lament cedar
#

@simple wadi thank you, that should work

#

can you tell me what are the events trigger created when a new subscription is created?

simple wadi
#

@lament cedar you can test this yourself by creating a new subscription in the Dashboard in test and looking at the timeline or events for that particular subscription