#shreeharsha-subscriptions

1 messages · Page 1 of 1 (latest)

hollow lynx
#

hi! hmm, can you give an example of the exact update you're doing? Maybe the subscription ID sub_xxxx

solar hull
#

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)

hollow lynx
#

I'm getting client secret which is already processed.

#

so that probably means the type of update you're doing is an immediate payment

#

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"?

solar hull
#

id : sub_1KQoNeAjGSqJ6vBZdOWnRa1h

#

This was specific error message message: "You cannot confirm this PaymentIntent because it has already succeeded after being previously confirmed."

hollow lynx
#

cool

solar hull
#

How do I test in development mode to check it's charged automatically or not then update membership on my end?

hollow lynx
#

not sure I follow

#

you update your membership generally by listening to webhooks like customer.subscription.updated, and those are fired the same way here regardless of if the payment was immediate or not.