#shreeharsha-subscriptions
1 messages · Page 1 of 1 (latest)
hi! hmm, can you give an example of the exact update you're doing? Maybe the subscription ID sub_xxxx
I'm trying to increase the quantity of a plan. To make payment for an updated subscription. I'm getting client secret which is already processed. How can I generate new client secret for the updated ones?
subscription, _ := sub.Get("sub_***", nil)
subscriptionParams := &stripe.SubscriptionParams{
CancelAtPeriodEnd: stripe.Bool(false),
Items: []*stripe.SubscriptionItemsParams{
{
ID: stripe.String(subscription.Items.Data[0].ID),
Price: stripe.String(subscription.Items.Data[0].Price.ID),
Quantity: stripe.Int64(6),
},
},
PaymentBehavior: stripe.String("default_incomplete"),
ProrationBehavior: stripe.String("always_invoice"),
}
subscriptionParams.AddExpand("latest_invoice.payment_intent")
// update subscription provide client secret which is already processed
s, err := sub.Update("sub_****", subscriptionParams)
I'm getting client secret which is already processed.
so that probably means the type of update you're doing is an immediate payment
https://stripe.com/docs/billing/subscriptions/upgrade-downgrade#immediate-payment like switching from a free plan to a paid one, hard to say with just the code. Can you share a sub_xxx ?
also it would help if you could explain what you mean by "already processed", was there some specific error message when you tried to use it that makes you think it's "processed"?
id : sub_1KQoNeAjGSqJ6vBZdOWnRa1h
This was specific error message message: "You cannot confirm this PaymentIntent because it has already succeeded after being previously confirmed."
cool
so yeah this is what I said, the type of update you're doing results in immediate payment (https://stripe.com/docs/billing/subscriptions/upgrade-downgrade#immediate-payment) which means the customers' saved payment method gets charged automatically during the API call.
How do I test in development mode to check it's charged automatically or not then update membership on my end?