Skip to content

Commit

Permalink
Fixes Stripe quantity of tokens to be bought
Browse files Browse the repository at this point in the history
  • Loading branch information
emmdim committed Nov 28, 2024
1 parent 77defb2 commit c094c7e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stripehandler/stripe.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (s *StripeHandler) CreateCheckoutSession(defaultAmount int64, to, returnURL
}
// calculate the price per token according to the package and
// round in order to fullfill the two decimals limits limitation of stripe
tempCalc := math.Round(float64(float64(closestRoundedPrice.UnitAmount) / float64(closestRoundedPrice.TransformQuantity.DivideBy) * float64(defaultAmount)))
tempCalc := math.Round(float64(float64(closestRoundedPrice.UnitAmount) / float64(closestRoundedPrice.TransformQuantity.DivideBy)))

checkoutParams := &stripe.CheckoutSessionParams{
ClientReferenceID: stripe.String(to),
Expand All @@ -118,7 +118,7 @@ func (s *StripeHandler) CreateCheckoutSession(defaultAmount int64, to, returnURL
Currency: stripe.String(string(closestRoundedPrice.Currency)),
UnitAmountDecimal: stripe.Float64(tempCalc),
},
Quantity: stripe.Int64(1),
Quantity: stripe.Int64(defaultAmount),
},
},
Metadata: map[string]string{
Expand Down

0 comments on commit c094c7e

Please sign in to comment.