#yogeshInvideo

1 messages · Page 1 of 1 (latest)

loud socketBOT
bronze canyon
#

that guide should still be relevant. I wasn't aware we had removed anything like that from the Go SDK, let me look(or if you have a link handy that would be useful too)

strange garden
bronze canyon
#

yeah it's just that now you pass a string instead of an enum.

#

that's all it means, the 'removed' part is the enum, not the functionality itself

strange garden
#

I'm passing string for now

updateSubscriptionParams := &stripe.SubscriptionParams{}

subItem := []*stripe.SubscriptionItemsParams{
    {
        Plan: stripe.String(planId),
        ID:   stripe.String(subscription.Items.Data[0].ID),
    },
}
updateSubscriptionParams.Items = subItem

updateSubscriptionParams.ProrationBehavior = stripe.String("always_invoice")
updateSubscriptionParams.PaymentBehavior = stripe.String("pending_if_incomplete")

updatedSubscription, err := stripeClient.Subscriptions.Update(subscription.ID, updateSubscriptionParams)

It's behaving weirdly. It creates a fail invoice and then creates another invoice with succeed when using 3DS cards

bronze canyon
#

do you have an example subscription sub_xxx where that happened?

strange garden
#

sub_1Ml5ccBQzictNbDFJJJQ0DXF

bronze canyon
#

what's the ID of this 'fail invoice' you mention? I don't see any failed invoices for that subcription.

strange garden
#

this is the invoice id : in_1Ml5dlBQzictNbDFoAiKeDCn
and event id : evt_1Ml5dpBQzictNbDFC8KXWWjQ

bronze canyon
#

that's not a failure really, it's just that the payment requires 3D Secure(as all payments do in India). We send the invoice.payment_failed event so that if you don't handle 3D Secure, you can treat this as a failure to pay(for legacy code that can't handle 3D Secure).

strange garden
#

Is there any way to identify this in webhook?
So I can ignore this

bronze canyon
#

invoice.payment_intent.last_payment_error

#

so when receiving that webhook event, you can retrieve the Invoice object and expand the PaymentIntent and check into the specific reason it failed, and ignore if the reason is an authentication_required decline.

strange garden
#

Is it possible that recurring payments can also have this error in case of failure?

bronze canyon
#

yes, recurring payments on a saved card might sometimes require 3D Secure if the bank decides to require it.

strange garden
#

Then I can't ignore this.

#

This is not related to API version, right?

cinder jacinth
#

Hey, taking over here. Let me know if there's any follow-up Qs I can answer!

loud socketBOT
cinder jacinth
strange garden
#

sending invoice.payment_failed event for 3DS flow

remote sage
#

Correct, that behavior shouldn't change between API versions

strange garden
#

Got it, Thanks for the responses guys 😃
I'll figure something to handle this.