#chronic-go-version

1 messages · Page 1 of 1 (latest)

junior urchinBOT
vague summit
#

Hello! Can you share the code that's throwing that error?

lilac nacelle
#

sure

#

`func CreatePaymentSubscription (customerID string, amount int64) (string, error) {
stripe.Key = PK

items := []*stripe.SubscriptionItemsParams{
{
Price: stripe.String(CREDIT_ID),
Quantity: stripe.Int64(amount),
},
}

params := &stripe.SubscriptionParams{
Customer: stripe.String(customerID),
Items: items,
}

s, err := sub.New(params)
if err != nil {
return "", err
}
subID := string(s.ID)
return subID, err
}
`

vague summit
#

If you do the parameters inline like the snippet in the docs above does that work?

lilac nacelle
#

same error

vague summit
#

Hm. Give me a few minutes...

#

What version of Stripe Go are you using?

lilac nacelle
vague summit
lilac nacelle
#

im guessing that defaults to current?

balmy nymph
#

👋 Hey @lilac nacelle ! Based on the way you integrate, you are likely on an old version

#

you don't seem to use go modules so you get the "most recent version before go modules" which is v71 which is almost 3 years old

#

and it's right before we added support for the Price APIs and parameters.

#

You need to change your code to reference the right major version. Currently it's v74. If you just started your integration then it's easy and you follow the steps to the readme
If your integration is already active then it's more work since there are regular breaking changes every time we release a major version so you'll need to read the migration guide(s): https://github.com/stripe/stripe-go/wiki

lilac nacelle
#

ill try it again with /74 but was having the same error when I did

balmy nymph
#

you don't just add /74 you also need to install the right version locally, using go modules

#

you are likely still having the old/cached version in your GOPATH

lilac nacelle
#

you just change it in the imports and do mod tidy right

balmy nymph
#

not sure, I usually start fresh. But I can tell you for sure it's your issue at least. So you need to remove the old stripe-go, add the right one to you module and make sure it pulls the right version

#

chronic-go-version

lilac nacelle
#

thanks, works now