I am trying to make my site do a one time payment and verify, /payment/confirm will verify the payment went through and add the item to the current user, and /pricing is just the page they were before being redirected to the stripe checkout, this is my code for the payment so far:
params := &stripe.CustomerParams{
Name: stripe.String(usr.Username),
}
newCustomer, err := customer.New(params)
if err != nil {
return nil, err
}
checkout := &stripe.CheckoutSessionParams{
Customer: &newCustomer.ID,
SuccessURL: stripe.String(host + "/payment/confirm"),
CancelURL: stripe.String(host + "/pricing"),
PaymentMethodTypes: stripe.StringSlice([]string{
"card",
}),
Mode: stripe.String(string(stripe.CheckoutSessionModePayment)),
LineItems: []*stripe.CheckoutSessionLineItemParams{
&stripe.CheckoutSessionLineItemParams{
Price: stripe.String(PriceID),
Quantity: stripe.Int64(1),
},
},
}
return session.New(checkout)
This is my code, For some reason this doesn't work... it says:
"cannot use checkout (variable of type *stripe.CheckoutSessionParams) as *stripe.BillingPortalSessionParams value in argument to session.New"