#danboyle8637 - CLI Trigger
1 messages ยท Page 1 of 1 (latest)
Hi ๐
You can try uusing the --add flag to add a specific product.
https://stripe.com/docs/cli/trigger#trigger-add
danboyle8637 - CLI Trigger
What events are you triggering?
Thanks! I am doing both a customer.subscription.created and a payment_intent.succeeded
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
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...
Yes they do
My test account has fired off 6 events since this conversation started
I've got a lot of test subscriptions ongoing
@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.
The Payment Intent doesn't have a product associated with it. What are you charging the customer for?
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
The price ID should be what is associated with the subscription. In the subscription.items.data.price property
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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!
Hooray ๐
One mnore last question... haha... where can I get the correct types of the data objects
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?
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
Okay so you can take a look at each type of Event and for each type it specifies what type of record will be in data.object:
https://stripe.com/docs/api/events/types
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?
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.
I'm not 100% sure about this, since I'm not familiar with Typescript, but I think we have the current API definitions here:
https://github.com/stripe/stripe-node/tree/master/types/2020-08-27
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