#Flash-questions
1 messages · Page 1 of 1 (latest)
Flash-questions
Yo how do I make a checkout link with just payment ID
hello, can you clarify what you've integrated so far? like are you just getting started?
i am using the golang stripe library heres the code i have rn to create the payment intent
func createPaymentIntent(price int, serviceID int, link string, amount int) (*stripe.PaymentIntent, error) {
c := client.New(utils.StripeKey, nil)
params := &stripe.PaymentIntentParams{
Amount: stripe.Int64(int64(price)),
Currency: stripe.String("usd"),
}
intent, err := c.PaymentIntents.New(params)
if err != nil {
return nil, err
}
return intent, nil
}
then i got this code where im tryna return the payment url here so someone can make a payment
func HandleBuycommand(serviceID int, link string, amount int) *stripe.PaymentIntent {
price, ok := prices[amount]
if !ok {
return nil
}
s, err := createPaymentIntent(price, serviceID, link, amount)
if s == nil {
fmt.Println(err)
return nil
}
return s.ID
}```
rn i just have it returning the ID so how can i get a link to send out from it ig
so how can i get a link to send out from it ig
you're using the lower level abstractions ( PaymentIntents) , use Payment Links instead: https://stripe.com/docs/payment-links/api
alr
do i have to import a specific version of stripe-go cause payment links aint showin up
what version of stripe-go are you on
actually i found it i was on just github.com/stripe/stripe-go but when i imported /v74 it was good
yeah it is a typed language so the classes for Payment Links were introduced in a particular release (and you had the release before it presumably)
ah i see
one more question tho i see in the params of the payment link you need price id i was wondering how to get that cuz ive never used stripe
you create one using the API: https://stripe.com/docs/api/prices/create