#ZeroThreeEight
1 messages · Page 1 of 1 (latest)
Can you expand on your use case?
You keep asking questions and then disappearing, but I assume you mean something like: https://stripe.com/docs/payments/checkout/billing-cycle
Hey
Sorry about last time, I got a call
So in the current situation my customers are charged right after the trial period
Which is 7 days
I want to delay the payment, so that Stripe charges my customer after 14 days
For legal reasons in the Netherlands
Did you check the URL I sent?
Checking it right now
What I see is the billing cycle anchor
Which asks for a timestamp
Yep, so you can set the billing_cycle_anchor for the associated Subscription to be +14 days which delays initial payment until then, but the Subscription is created immediately
FYI, it's currently in beta but will be launching ~soon
You can request beta access at that URL
Ah, the docs are behind the beta flag. Without them you can't get access. Anyway:
Checkout billing_cycle_anchor and proration_behavior are in private beta and subject to change. If you have any questions or feedback, please contact checkout-billing-cycle-anchor-beta@stripe.com
Or I can add your account now if you share the acct_xxx ID
Done! You should be able to use the docs (and parameters) now
Thanks, just to clarify
Do I look into the createCheckOutSession
or the CreateSubscription method
You'd pass the new parameters to your Checkout Session creation call
It's all laid out on the docs
Cool. thanks
The docs say you cant use trials
I am using one atm
Would that be a problem?
What would be the difference between editing the create checkout session vs create subscription.
Correct, it won't work with trials
I don't understand the quesrion
I don't really understand your use case. You have a 7 day trial, and you want to postpone payment until 14 days after the trial? Or 14 days from when they subscribe?
So if im understanding correctly. the first option was adding the billing_cycle_anchor property to the createSubcription method
Let me clarify
In the netherlands people can dispute freely within 14 days
If im charging people after 7 days
some people will dispute, which costs me 7,50 euros per dispute.
If people made use of our services for at least 14 days though
before paying
I have some foot to stand on to collect our money
Hopefully that makes sense
Then you can't use Checkout in that scenario if you want both a trial and to delay billing to a specific date
Well you can do this with regular Subscriptions without Checkout, yes: https://stripe.com/docs/billing/subscriptions/billing-cycle
Since im using checkout
does this mean that I need to update the subscription?
With a webhook or something?
I guess you could potentially update the billing_cycle_anchor yes following completed Checkout
trial_period_days: 7,
billing_cycle_anchor:
},
So here maybe calculate the current timestamp + 14 days?
This is in the createceckoutsession
It will error though because you're passing a trial too
You'll need to update the Subscription after the Checkout Session
Allright
Than I will set up the webhook
thanks
Just out of curiosity
Why is the combination of those 2 paramaters failing?
trial_period_days and billing_cycle_anchor
It's just the way we designed the feature – it adds a lot of complexity combining the two
Allright
Thanks and have a nice day
One more
If I receive this event in my webhook:
checkout.session.completed
Does that also mean that the subscription was created?
Hi! I'm taking over this thread.
Hey
checkout.session.completed means the payment was successful. So yes the Subscription was also created.
Thanks
You can use the subscription field on the object in the event: https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-subscription
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Let me know if you have any other questions!
// Update subscription billing cycle anchor
const subscription = await stripe.subscriptions.retrieve(data.subscription);
const newBillingCycleAnchor = Math.floor(Date.now() / 1000) + 14 * 24 * 60 * 60; // 14 days from now
const updatedSubscription = await stripe.subscriptions.update(data.subscription, {
billing_cycle_anchor: newBillingCycleAnchor,
});
This is the code snippet I added to my webhook
Can you please review?
I think the best way is to actually try your code in test mode to see is it works as expected.
thanks
Allright
I tried updating in a webhook
invalid_request_error - billing_cycle_anchor
When updating an existing subscription, billing_cycle_anchor must be either unset, 'now', or 'unchanged'
Was this useful?
Yes
No
And get this error
Do you have any suggestions on how to fix this?
That's actually expected as mentioned here https://stripe.com/docs/api/subscriptions/update?lang=curl#update_subscription-billing_cycle_anchor
And you can learn more details about this here: https://stripe.com/docs/billing/subscriptions/billing-cycle
I thought that was meant here
What is the best practice if I want to bill the customer after 14 days
Well if you want to change the subscription, you do have to wait for the Checkout Session to complete. And you can update the billing_cycle_anchor, buy only to now or unchanged.
What is the best practice if I want to bill the customer after 14 days
Add a 14 days free trial: https://stripe.com/docs/api/checkout/sessions/create?lang=curl#create_checkout_session-subscription_data-trial_period_days
Is that really the only way to charge customers after 14 days if I have a trial period ?
I mean free trials are made exactly for this: start a subscription without charging the user right away.
What exactly is your use case?
Yes but a free trial is free
In the Netherlands peiple can dispute freely within 14 days
I want to do the payment after that treshold
charge*
Yes but a free trial is free
I'm sorry I'm confused about your requirement. You said "What is the best practice if I want to bill the customer after 14 days", that's why I assumed that the first 2 weeks were free.
So can you clarify exactly when you want to charge the customer?
I understand
I want to charge the customer 14 days after the start of the subscription
Start, 7daytrial, secondweeksubscription, charge
I'm sorry I still don't understand. Can you give a concrete example with specific dates and amounts? Something like:
- Create the subscription, no charges
- 7 days later: first charge
- Then 30 days later: second charge
Yes, so this is the current situation indeed
My desired situation is:
- Create the subscription, no charges
- 7 days later: start paid subscription (still no charge because risk of dispute)
- 7 days later: first charge (14 days are gone and people cannot freely dispute according to dutch law)
- Then 30 days later: second charge
The difference is that the second week is not free, only charged later
As soon as the free trial ends, the customer is charged. So you cannot delay the charge by an extra 7 days.