#dbjpanda
1 messages ยท Page 1 of 1 (latest)
Hi ๐
Hi
What do you mean "custom events"?
Sorry I meant custom functions
This extension is AFAIK, set up to handle the Stripe webhook events
Yes. Right
As stated in my question, I want to add e.g token balance once the customer has paid successfully. On the extension page, it says events are logged on Eventarc. But I don't find any docs for that.
๐ Yeah the only installation/setup docs that are specific for our extension are here (https://github.com/stripe/stripe-firebase-extensions/blob/master/firestore-stripe-payments/PREINSTALL.md#events)
Honestly, we don't know a ton about firebase here - we know generally how our specific extension works, but in terms of incorporting eventarc we don't know a ton
I do see these docs https://firebase.google.com/docs/functions/beta/custom-events#handle-events but not sure how helpful that is
The docs says
This extension emits events, which allows you to listen to and run custom logic at different trigger points during the functioning of the extension. For example you can listen to events when a product has been added via the product.created event, or whenever a payment has succeeded through the invoice.payment_succeeded event.
Where can I find a list of events where I can hook my custom logic. Any idea?
Let me try and dig around for that - give me a few mi nutes
I believe this list (https://github.com/stripe/stripe-firebase-extensions/blob/785d8a78bf03db4c252cf9173a70df3555137221/firestore-stripe-payments/extension.yaml#L261) should reflect all the events we emit from the extension
Yeh. that is right. I think it needs to be updated on the doc.
So @tough pilot what could be a recomended way to add token field. E.g
I want to add some token balance for the user's subscription.
Should I add a custom meta field per price or product?
Basic Plan - 5USD / Month - 2000 Token
Premium Plan - 19 USD/ Month - 50000 Token
Yeah the simplest thing would just be to include it as metadata on the Price
Well, I am just confused for one last thing. Which event should I hook to add/update the token balance to a customer object.
**com.stripe.v1.payment_intent
**
processing: Occurs when a PaymentIntent has started processing
succeeded: Occurs when a PaymentIntent has successfully completed payment
canceled: Occurs when a PaymentIntent is canceled
payment_failed: Occurs when a PaymentIntent has failed the attempt to create a payment method or a payment.
**com.stripe.v1.customer.subscription
**
created: Occurs whenever a customer is signed up for a new plan
updated: Occurs whenever a subscription changes (e.g., switching from one plan to another, or changing the status from trial to active)
deleted: Occurs whenever a customer's subscription ends
Is it com.stripe.v1.payment_intent.succeeded or com.stripe.v1.customer.subscription.created
Hi there. Karbi had to step out
What exactly are you trying to achieve? payment_intent.succeeded is sent each time a payment intent is successfully paid, while subscription.created is only sent when a subscription is created
I want to add some token balance for the user's subscription.
Basic Plan - 5USD / Month - 2000 Token
Premium Plan - 19 USD/ Month - 50000 Token
And you want to do that when they first subscribe only?
I am confused about subscription and payment. Of course I want to add token balance only when I got the payment into my stripe account.
ah ok. so use payment_intent.succeeded
Read that above doc
That should clear things up
customer.subscription.created - Occurs whenever a customer is signed up for a new plan. Isn't it mean he/she is a paid subscriber?
From the above linked doc
So it could be sent if they haven't paid
Recommend reading that whole doc
But payment_intent.succeeded is likely what you want
I am reading the docs you shared. I could come up with a new question. Thank you for your help and patience.