#dbjpanda

1 messages ยท Page 1 of 1 (latest)

hollow copperBOT
ruby nacelle
#

Hi ๐Ÿ‘‹

terse glacier
#

Hi

ruby nacelle
#

What do you mean "custom events"?

terse glacier
#

Sorry I meant custom functions

ruby nacelle
#

This extension is AFAIK, set up to handle the Stripe webhook events

terse glacier
#

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.

tough pilot
#

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

terse glacier
#

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?

tough pilot
#

Let me try and dig around for that - give me a few mi nutes

terse glacier
#

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

tough pilot
#

Yeah the simplest thing would just be to include it as metadata on the Price

terse glacier
#

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

strange lintel
#

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

terse glacier
#

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

strange lintel
#

And you want to do that when they first subscribe only?

terse glacier
#

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.

strange lintel
#

ah ok. so use payment_intent.succeeded

#

Read that above doc

#

That should clear things up

terse glacier
#

customer.subscription.created - Occurs whenever a customer is signed up for a new plan. Isn't it mean he/she is a paid subscriber?

strange lintel
#

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

terse glacier
#

I am reading the docs you shared. I could come up with a new question. Thank you for your help and patience.