-
-
Notifications
You must be signed in to change notification settings - Fork 290
Open
Description
Steps to reproduce
- Create a payment with
total=30.00usingStripeProviderV3 - Complete the Stripe Checkout session (payment status becomes
confirmed) - Call
payment.refund()
The refund succeeds on Stripe's side, but captured_amount ends up as -3000 instead of 0.
Cause
convert_amount converts a payment amount to the smallest currency unit for the Stripe API (e.g. 30.00 becomes 3000). This is used correctly when calling stripe.Refund.create().
The problem is that refund() returns that same converted value:
def refund(self, payment, amount=None) -> int:
to_refund = amount or payment.total
# ...
stripe.Refund.create(
amount=self.convert_amount(payment.currency, to_refund), # 3000 correct for Stripe
)
# ...
return self.convert_amount(payment.currency, to_refund) # 3000 returned to BasePaymentBut BasePayment.refund() treats the returned value as currency units:
amount = provider.refund(self, amount)
self.captured_amount -= amount # subtracts 3000 instead of 30.00
i think refund() here should return to_refund directly, not the Stripe-converted value.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels