#[LBG] India - sub field
1 messages · Page 1 of 1 (latest)
What's the default one ?Latest ?
Nah it'll depend when you join
It will say here: https://stripe.com/docs/api/versioning
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Also on the dashboard
So that field was added as backwards compatibility. You can read about it here: https://stripe.com/docs/upgrades#2019-12-03
Since you are on an earlier version than 2019-12-02, it is appearing
No need to upgrade though unless you want to
I also noticed another difference for a subscription object created from a Checkout Session in subscription mode VS a subscription created via API call : the "billing" field
Is that a field for backward compatibility as well?
Hm can you share an example id?
sub_1KnNMILJLkeHRLt1u8fDfPId
"billing": "charge_automatically",
sub_1KkdXQLJLkeHRLt1egrRIdS2 is a sub id from live mode created via https://stripe.com/docs/api/subscriptions/create
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Hello! I'm taking over and catching up now...
Hi
Can you provide the request ID showing the billing property? Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
evt_1KnOerLJLkeHRLt1PzfkaZCs
Thanks! It looks like you're seeing that in the event data itself at the top, but that's not what was actually sent to your webhook endpoint. If you look at the event data that was sent to your endpoint below you can see the field has been renamed to "collection_method": "charge_automatically",
This is likely due to a mismatch between your default API version 2019-05-16 and your webhook endpoint's API version 2020-08-27
I'll upgrade the API version to the latest tomorrow
You don't need to upgrade your API version, and doing so can be dangerous. I recommend you read through this section before you attempt an upgrade: https://stripe.com/docs/upgrades#how-can-i-upgrade-my-api
Ok, I think it's time to upgrade as we are updating all our Stripe workflows
Other question : we are currently migrating the subscription creation from an API call to a Session in subscription mode. For a subscription that is active (after a trial of X days), we cannot adjust the trial end, that is logic, so how can we offer customers a subscription ? Let's say I want to offer a month, for free, to a customer that has an active sub
What would be the best way ?
So you're saying a Susbcription started with a trial, the trial ended so now the Subscription is active, and now you want to give them another trial period?
Usually we would recommend using a trial for that, but you could also use a Customer credit balance or a coupon/discount for it as well.
You can create a new trial period for an existing and active subscription ? 😮
Yep!
You can update the Subscription with a new trial_end: https://stripe.com/docs/api/subscriptions/update#update_subscription-trial_end
So let say a customer as an active subscription and paid 4 months of subscription already. The trial started January 1st and ended the 10th of January (10 days). The billing cycle would be on the 10th of the month then. He paid for 4 months, Jan-Feb, Feb-Mar, Mar-Apr and Apr-May. If I want to offer him a month for free, I can update the trial that started the 1st of January to end the 10th of June ? So the customer does not pay May-June
Seems weird as it breaks the trial "history" no ?
Yes, it would overwrite the previous trial history. When you set trial_end on an existing Subscription it begins the trial immediately and sets it to end at the trial_end timestamp you specify. If you want to keep track of historial trial information I recommend you store that information in your own system.
So in your example you would likely want to update the Subscription with a new trial_end timestamp on May 1st and set the trial_end timestamp to be on June 1st.
Really clear, noted
What if I want to use Credit Balance ?
Does a subscription created through a Session would first check if a Credit Balance > 0 and first pay this balance ?
An integer amount in cents that represents the customer’s current balance, which affect the customer’s future invoices. A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice.
If a customer has -10€ in Credit Balance and has to pay a subscription 34,80€ (including vat), will he pay 24.80€ ?