#.juchom

1 messages · Page 1 of 1 (latest)

torn berryBOT
shut bluff
#

Hello! You can add the 4000000000000341 test card to the Customer, which will successfully attach, but payments will fail.

north shore
#

I didn't scroll enough sorry

shut bluff
#

No worries!

north shore
#

One last question, when I call the susbscription update endpoint, is there any transaction id returned so I can find all related events linked to the update request ?

shut bluff
#

Events as in Stripe Events?

north shore
#

yes

shut bluff
north shore
#

I was not clear sorry, I'm pretty new

#

What I want to achieve is when I call https://stripe.com/docs/api/subscriptions/update

My webhook will update my local db

And I want to poll it from my webapp so I can give a feedback to my user if payment succeeded or failed using this request id.

The update endpoint does not seem to send this information.

shut bluff
#

A couple of things...

#

First, you can listen for customer.subscription.updated Events to get webhooks when Subscriptions are updated.

#

Second, anything client-side, anything about your UI, anything in the customer flow... all of that should not involve webhooks in any way.

#

You should not need to poll or do anything with webhooks while the customer is in your payment flow.

#

You can do thing with webhooks separately, at the same time, but you should never be in a position where you're waiting for a webhook to update a customer-facing UI.

#

Can you tell me more about what exactly you're trying to do?

north shore
#

If my customer took a subscription for 2 seats and want to move to 3 seats, I want some sort of "synchronous payment".

If the card expired, or it needs 3DS he can do it immediately.

shut bluff
#

I'm still not certain I understand, can you explain more why webhooks would be involved here?

#

For the customer-facing side of things I mean?

north shore
#

I'm not sure Webhooks is the way to go for this.

I have no idea on how to use Stripe when the customer wants to take action on his subscription and give him feedback to do 3DS or add a new card or bypass everything if the payment succeeded.

Like in Session where you specify SuccessUrl and CancelUrl

shut bluff
#

The second step is to try this in test mode with the flow you want.

#

Then, if you run into issues or have specific questions you can ask us here in #dev-help

#

The core things to understand are that, when a Subscription requires payment, it generates an Invoice. That Invoice, in turn, generates a Payment Intent. That Payment Intent has a client secret you can use client-side for things like handling next actions.

#

For example, let's say you update a Subscription, a payment is required (so a new Invoice and Payment Intent are generated) and then authentication is required (a next action). You can take the client secret from the Payment Intent and use Stripe.js to call stripe.handleNextAction client-side so the customer can go through the authentication process: https://stripe.com/docs/js/payment_intents/handle_next_action

north shore
shut bluff
#

The Subscription will have a latest_invoice property. That Invoice will have a Payment Intent. That Payment Intent will have a client secret you can use client-side if needed.

#

You can expand all of those properties in the Subscription update request so you get the full Subscription, Invoice, and Payment Intent objects in the response instead of just the Subscription: https://stripe.com/docs/expand

north shore
#

Thanks Rubeus,

I'll continue to dig this !

shut bluff
#

Sounds good!