#ZeroThreeEight

1 messages · Page 1 of 1 (latest)

sly siloBOT
full sable
#

Can you expand on your use case?

gilded urchin
#

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

full sable
#

Did you check the URL I sent?

gilded urchin
#

Checking it right now

#

What I see is the billing cycle anchor

#

Which asks for a timestamp

full sable
#

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

gilded urchin
#

Amazing

#

Thanks

full sable
#

FYI, it's currently in beta but will be launching ~soon

#

You can request beta access at that URL

gilded urchin
#

The URL you sent didnt work. I had to look it up in the docs

#

Can you re try'?

full sable
#

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

gilded urchin
#

Oke I'll look into it

#

1 moment please

#

acct_1MLPloFM0KvL0X1J

full sable
#

Done! You should be able to use the docs (and parameters) now

gilded urchin
#

Thanks, just to clarify

#

Do I look into the createCheckOutSession

#

or the CreateSubscription method

full sable
#

You'd pass the new parameters to your Checkout Session creation call

#

It's all laid out on the docs

gilded urchin
#

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.

full sable
#

Correct, it won't work with trials

full sable
#

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?

gilded urchin
#

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

full sable
#

Then you can't use Checkout in that scenario if you want both a trial and to delay billing to a specific date

gilded urchin
#

Clear

#

Is there another way to delay the first payment to after 14 days?

full sable
gilded urchin
#

Since im using checkout

#

does this mean that I need to update the subscription?

#

With a webhook or something?

full sable
#

I guess you could potentially update the billing_cycle_anchor yes following completed Checkout

gilded urchin
#
        trial_period_days: 7,
        billing_cycle_anchor: 
      },

So here maybe calculate the current timestamp + 14 days?

#

This is in the createceckoutsession

full sable
#

It will error though because you're passing a trial too

#

You'll need to update the Subscription after the Checkout Session

sly siloBOT
gilded urchin
#

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

full sable
#

It's just the way we designed the feature – it adds a lot of complexity combining the two

gilded urchin
#

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?

frigid cosmos
#

Hi! I'm taking over this thread.

gilded urchin
#

Hey

frigid cosmos
#

checkout.session.completed means the payment was successful. So yes the Subscription was also created.

gilded urchin
#

Thanks

full sable
gilded urchin
#

So no need for a webhook?

#

oh sorry

#

LONG day

frigid cosmos
#

Let me know if you have any other questions!

gilded urchin
#
  // 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?

frigid cosmos
#

I think the best way is to actually try your code in test mode to see is it works as expected.

gilded urchin
#

thanks

gilded urchin
#

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?

frigid cosmos
gilded urchin
#

What is the best practice if I want to bill the customer after 14 days

frigid cosmos
#

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.

gilded urchin
#

Is that really the only way to charge customers after 14 days if I have a trial period ?

frigid cosmos
#

I mean free trials are made exactly for this: start a subscription without charging the user right away.

#

What exactly is your use case?

gilded urchin
#

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*

frigid cosmos
#

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?

gilded urchin
#

I understand

#

I want to charge the customer 14 days after the start of the subscription

#

Start, 7daytrial, secondweeksubscription, charge

frigid cosmos
#

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
gilded urchin
#

Yes, so this is the current situation indeed

sly siloBOT
gilded urchin
#

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

frigid cosmos
#

As soon as the free trial ends, the customer is charged. So you cannot delay the charge by an extra 7 days.