0
votes

step 1: create a subscription for a plan 2 qty.

subscription = Stripe::Subscription.create(
          customer: @customer,
          items: [
            {
              price: @price,
              quantity: 2,                  
            }
          ],
         
        )

step 2: upgrade with qty 4:

item = subscription.items.first
::Stripe::SubscriptionItem.update(item.id, { price: @price, quantity: 4 })

Invoice in stripe Dashboard: enter image description here

It is giving the error:

Refund amount ($140) is greater than charge amount ($88.00) when I try to cancel and refund to the customer proration amount refund unused amount after subscription cancellation

Stripe dashboard events: enter image description here

1
That sounds bad...jvillian

1 Answers

0
votes

This error indicates that your own code is trying to refund a Charge for an amount that is larger than the original amount. My guess here is that you are using the upcoming invoice API endpoint to calculate how much you owe the customer back and you are not taking pending proration invoice item into account properly.

Based on the screenshot, this increase in quantity caused proration invoice items to be created but the customer hasn't been charged for those yet. So when you calculate the refund you owe them you need to ignore those pending invoice items to calculate the correct amount.

This is a guess as you didn't share your code but you'd have more luck with Stripe's support team