#macarouns_best-practices
1 messages · Page 1 of 1 (latest)
đź‘‹ Welcome to your new thread!
⏱️ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime!
đź”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1212370922485452800
📝 Have more to share? You can add more detail below, including code, screenshots, videos, etc.
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question. Thank you for your patience!
Hi
The problem comes when cancelling a subscription. I want to end it on a set date and either take no further payments
You can update the Subscription and set a cancelation date:
https://docs.stripe.com/api/subscriptions/update#update_subscription-cancel_at
Hi, I think my message might have been cut-off. I can set the cancellation date just fine.
The problem comes when cancelling a subscription. I want to end it on a set date and either take no further payments or one more full payment.
No matter when I set the date, it attempts to pro-rata the amount.
I have attempted to update the Subscription object by passing the parameter “proration_behavior” with a value of “none”. This doesn’t seem to do anything.
Likewise, even if I switch off proration through the GUI, there seems to be no cancellation date I can set for the subscription that will charge the full price and not a pro-rata.
Ah I see
in this case you need to implement a cron on your Side, and call the cancel API
With proration_behavior: none
at the desired date
That is where I have got stuck, I have been trying that but it doesn't seem to affect the proration
$stripe->subscriptions->update($subs->data[0]->id, ['cancel_at' => $d->getTimestamp(), 'proration_behavior' => 'none']);
When I do this, the cancel_at date goes through fine, but the proration doesn't change
It wouldn't be anuthing to do with the version of the API I am using would it?
No.
I'm talking about the cancel API and not the update API
Ah okay
and don't forget to pass the proration_behavior: none
I see what you mean now about using a cron. So it doesn't take a future date to cancel, it would just cancel immediately?
yes
Great thanks. So if say the subscription payment would normally come out on the 1st of the month, if I cancelled it on the day before, then that payment then wouldn't take?
Appologies for my late reply
But I invite you to do some tests and simulations using Stripe Test Clock:
https://stripe.com/docs/billing/testing/test-clocks
if I cancelled it on the day before, then that payment then wouldn't take?
Unless the invoice of the next period wasn't generated, there'll be no payment yes
Brilliant, thank you for the help, it is much appreciated!