#drakonic_unexpected

1 messages ยท Page 1 of 1 (latest)

broken sigilBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1252728341371551745

๐Ÿ“ Have more to share? Add details, code, screenshots, videos, etc. below.

unreal python
#

Hi there

#

Do you have an event ID or webhook endpoint ID you can share?

#

After clicking resend api webhook
Does this mean you clicked "resend" somewhere on the Dashboard?

inner parrot
#

After clicking "resend" it triggered 108 times (fired every few seconds)

unreal python
#

Do you have an event ID you can share?

inner parrot
#

^That's the webhook ID

#

Which event ID are you looking to see?

unreal python
#

If possible, the event that was sent 100+ times

#

The ID should look like evt_...

severe wyvern
#

evt_3PT8u6Iqm66uISY237Qvniuk

#

๐Ÿฆ–

inner parrot
#

That was one of several event IDs

unreal python
#

I see we tried to deliver this event to two different webhook endpoints. One webhook received it, the other returned a 502 response

unreal python
#

Where do you see that this event was "triggered 108 times"?

severe wyvern
#

the event was designed to create a subscription within stripe, and 108 subscriptions were made

inner parrot
#

evt_3PT8u6Iqm66uISY237Qvniuk
evt_3PT8u0Iqm66uISY21aY2rqkl
evt_3PT8txIqm66uISY22suvTuEW

#

^that's 3 more of the 108

#

We only clicked the "resend" button one time - and it triggered 108 events (until we disabled the endpoint)

#

Is this happening because the other webhook listening on the same event is failing?

#

So it's auto-retrying both endpoints listening to the same payment_intent.succeeded event?

unreal python
#

Clicking "Resend" did not trigger the creation of these events

#

These events were created due to some Node code that made calls to /v1/subscriptions

#

All three requests were made within a few seconds of each other

inner parrot
#

The node code was triggered via the payment_intent.succeeded webhook event

unreal python
#

No, that's not how this works

inner parrot
#

?

#

We deployed an API that creates stripe connect customer subscriptions using node.js code

#

that api is set to be triggered via the payment_intent.succeeded event

#

where are we misunderstanding?

unreal python
#

I think you have this backwards. Yes, there's some Node code that calls the Stripe API to create Subscriptions. When you're creating a Subscription for this specific customer, we automatically attempt to charge the customer. Since the customer has a saved PaymentMethod (as a value for invoice_settings.default_payment_method), the first invoice is paid. This is what triggers the payment_intent.succeeded event.

#

Does that make sense?

inner parrot
#

What we want to do is to trigger the creation of a new subscription WITHOUT billing the card immediately - is that possible?

the payment_intent.succeeded event should remit payment for the pro-rated first month of service

Every month thereafter is billed monthy (using a separte product_id setup for recurring subscription billing)

We want to have the FIRST subscribed charge be the 1st day of the following month

#

Is this possible using subscriptions?

#

Or should we switch to creating invoices more manually on our server-side API code?

#

'more manually' = WITHOUT using Stripe subscription feature (and instead running a CRON job on our backend to generate invoice on the 1st of the month)

unreal python
#

I'm not sure I follow this: Every month thereafter is billed monthy (using a separte product_id setup for recurring subscription billing)

#

What are you trying to test exactly?

inner parrot
#

This is what we're looking to do:

  1. Charge $4.60/day for every day remaining the month buyer signs up

  2. On the 1st day of 2nd month, we want to charge $140 per month

  3. Every subsequent month, we want to charge $140 per month until buyer explictly cancels

#

We were trying to test creation of subscriptions using node.js

unreal python
#

So, for example, from now until June 30, charge $4.60/day, then on July 1, charge $140 per month?

inner parrot
#

The node.js endpoint that creates stripe subscriptions is triggered using the 'payment_intent.succeeded' Stripe event

inner parrot
#

what is the best way to structure that?

unreal python
#

You'd create a Subscription now for the monthly price, where billing_cycle_anchor is the day when you want the first full billing cycle to start, and you should pass proration_behavior: create_prorations. The first invoice will be the for the amount between now and the billing cycle anchor date. You should also pass payment_behavior: default_incomplete so we don't immediately try to charge the customer for the first invoice.

#

I recommend starting there and playing with that first