#RubyDev - Cancel Sub
1 messages · Page 1 of 1 (latest)
Hi 👋
You can cancel a subscription at any time using the Cancel API and specify whether or not to prorate the remaining balance>
https://stripe.com/docs/api/subscriptions/cancel
btw I run this subscription = Stripe::Subscription.delete(stripe_subscription_id, {prorate: true})
Okay, so what about that isn't getting you the behavior you want?
How do you initiate the refund?
We see a pending item that is negative and has no credit balance in the dashboard
this is the event ID
evt_1KxvmQCEgURHX8Wq67QPrdlX
You will need to initiate the refund yourself. Subscription prorations create credit balances.
but we see a zero dollar credit balance and Pending invoice items of negative (29.94)
also can we refund via API?
cause we don't wanna manually refund
If you have the Charge ID, you can create a refund via the API
https://stripe.com/docs/api/refunds/create
Okay, but we only want to refund the prorated amount, not the entire charge.
You can specify the amount when you create the refund
How do we know the exact prorate amount?
You can use the Upcoming Invoice API and set the subscription_cancel_at timestamp to the current time and the API result will show the prorated amount. Then use this to determine how much to prorate the user.
https://stripe.com/docs/api/invoices/upcoming#upcoming_invoice-subscription_cancel_at