#jacobfinn

1 messages · Page 1 of 1 (latest)

whole egretBOT
proven citrus
#

Did you refund too little or too much?

ornate ruin
#

too little I presume

proven citrus
#

So you should be able to create a second refund for the rest of the amount then

ornate ruin
#

how do I calculate the prorated amount

#
# Retrieve the current date and the subscription billing period end date
                    current_date = datetime.now().date()
                    billing_period_end = datetime.fromtimestamp(sub.current_period_end).date()

                    # Calculate the remaining days in the billing period
                    remaining_days = (billing_period_end - current_date).days
                    amount = (5 / 30) * invoice.amount_paid

                    # In case of 31 day proration of a sub <1 old
                    if amount > invoice.amount_paid:
                        amount = invoice.amount_paid
proven citrus
#

Are you using subscriptions?

ornate ruin
#

Yea

proven citrus
#

You shouldn't need to calculate this yourself

ornate ruin
#

Well how can I undo all my refunds now

proven citrus
#

You can't. If you've already refunded, money may be already on the way to their bank

#

Unless this just happened

ornate ruin
#

Theres no way for stripe to write a script that does it for me?

proven citrus
#

That would be up to you to write the script

#

We don't write code for devs

ornate ruin
#

how do I send a refund once I cancel the sub with prorated

proven citrus
#

How many subs are there?

ornate ruin
#

a few hundred

proven citrus
#

Ah ok. Because if you do this via the dashboard, it's easy to refund

#

Otherwise via code you have to look at customer balance adjustment for the proration

ornate ruin
#

oh yea now that their subscription is canceled I cant even do that

#

idk what to do

proven citrus
#

Oh you've already cancelled all the subs?

ornate ruin
#

yea

proven citrus
#

Did you prorate the cancellation? Can you share an example subscription id?

ornate ruin
#

sub_1OeAP8AmkPjkxT8Nz4QcfRCQ

#

Basically just canceled the sub and sent what I incorrectly calculated to be a prorated refund

proven citrus
#

Oh yeah you didn't prorate the cancellation

#

So your only option at this point is to calculate the correct prorated amount yourself

ornate ruin
#

Well how do I do that

proven citrus
#

How do you know that the amount you originally calculated is incorrect?

ornate ruin
#

Customers angry

proven citrus
#

Ah

ornate ruin
#

I figured it was remaining days * cost of sub per day

proven citrus
#

That seems right to me

#

Why are the customers saying that's incorrect?

#

That means you only charged them for the days they used

#

You can make the calculation more specific (ie prorate down to the second not day)

#

But your approach makes sense too. Really depends on how you want to do it

#

Our prorations are down to specific timestamps instead of the day

ornate ruin
#

Can I still make refunds with a negative balance?

#

Or do I need to wait for the funds to hit

proven citrus
#

They'll go into pending

#

And clear when balance is sufficient

ornate ruin
#

ok cool

#

How can I get the canceled subscription from retrieving a refund

#

I guess ill have to fetch all the refunds, and find the sub, calculate the correct proration, subtract the current refund and send another

whole egretBOT
proven citrus