#danboyle8637 - CLI Trigger

1 messages ยท Page 1 of 1 (latest)

wraith tundra
#

Hi ๐Ÿ‘‹

#

danboyle8637 - CLI Trigger

#

What events are you triggering?

uncut falcon
#

Thanks! I am doing both a customer.subscription.created and a payment_intent.succeeded

wraith tundra
#

Well I don't know about subscriptions, because you can have multiple items, but for payment_intent.succeeded you could pass the --add payment_intent:amount=39999 or something similar to change the amount charged

uncut falcon
#

Ok... so I can't really attach a test product to my trigger as if I had signed up for that product. I guess I have to do that in dev mode... but I don't think webhooks work in dev mode...

wraith tundra
#

Yes they do

#

My test account has fired off 6 events since this conversation started

#

I've got a lot of test subscriptions ongoing

uncut falcon
#

@wraith tundra How do you determine which product they purchased through a webhook. The payment_intent gives the amount but no indication of the product name

#

ok... I will have to do that then and to get the actual event data because I can't seem to find the param that contains the product that was purchased.

wraith tundra
#

The Payment Intent doesn't have a product associated with it. What are you charging the customer for?

uncut falcon
#

Sorry I feel like I'm a pain. I have a subscript product with three different prices. Each price just changes the billing period.

I found in the subscription created object I can get the product name but I can't seem to find the specific price that was chosen.

#

Not price... price name or id

wraith tundra
#

The price ID should be what is associated with the subscription. In the subscription.items.data.price property

uncut falcon
#

Okay... I haven't gone down into that object yet. Yes. I see this has all the data I need though. Thanks for the help today!

wraith tundra
#

Hooray ๐ŸŽ‰

uncut falcon
#

One mnore last question... haha... where can I get the correct types of the data objects

wraith tundra
#

The API reference doc I linked specifies the properties types (e.g. hash, boolean, string, etc). If that is not what you are looking for can you specify the "type" you are referring to?

uncut falcon
#

I guess this is where I am still a little confused. I am switching on event.type like the docs say.

And I am console logging the event.data.object

And I'm getting different objects for each event... customer.subscription.created and payment_intent.succeeded.

But my console.log for customer.subscription.created does not match up with the Subscription object in the docs

wraith tundra
#

But we don't return all the properties associated with a subscription object. It depends on the context in which the subscription is created. Can you share which properties don't seem to match what you're looking for?

uncut falcon
#

Are there Typescript definitions I can cast the data.object to?

It's not that they don't match what I'm looking for... it's just confusing when what my terminal shows doesn't match up with the docs.

wraith tundra
uncut falcon
#

For example... It the docs say customer.subscription.create is a Subscription.

But in my terminal there is a property plan but this is not showing in the docs on a Subscription object

#

Cool I'll check that out... thanks

wraith tundra
#

Oh, yeah. Don't sweat that. plan was an old version of the price record

#

we keep the plan property around in the object so we don't break old integrations but we don't want people to use them so it's not in the docs

uncut falcon
#

okay cool... so refer only to the docs. That helps a lot

#

thanks for all the help... I really appreciate it