#Khalid Al-Awady
1 messages · Page 1 of 1 (latest)
Hey there
When you say "fails to process the transaction" you mean how do you handle an async failure?
not exactly, though if that is the proper way to do it I am open ears. The main issue I have is something similar to the following serverside
func (c *client) UpdateSubscription(
subscriptionID string,
subItemsParams []*stripe.SubscriptionItemsParams,
alwaysInvoice bool,
endTrial bool,
) (*stripe.Subscription, error) {
params := &stripe.SubscriptionParams{Items: subItemsParams}
params.ProrationBehavior = stripe.String(string(stripe.SubscriptionSchedulePhaseProrationBehaviorNone))
if alwaysInvoice {
params.ProrationBehavior = stripe.String(string(stripe.SubscriptionSchedulePhaseProrationBehaviorAlwaysInvoice))
}
if endTrial {
params.TrialEndNow = stripe.Bool(true)
}
callTimer := c.metrics.CreateStripeCallTimer(SubscriptionUpdate)
sub, err := subscription.Update(subscriptionID, params)
callTimer.StopTimerAndSend()
if err != nil {
return nil, fudge.Wrap(err)
}
return sub, nil
}
the main issue here is the subscription.Update(subscriptionID, params)
because the returned object may not always return a status that isn't active causing the I have to return 200s for failed account transactions
if the proper way to handle it is client-side using async payment intent requests I can do that
lets say I want to update a subscription be it regular or a trial using a us bank account. The account obviously fails for whatever reason, I want to be able to handle this such that on failed transaction I don't return a 200