#camel_tax-setup

1 messages ¡ Page 1 of 1 (latest)

oak craterBOT
#

👋 Welcome to your new thread!

⏲️ 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.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 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/1384682951807205476

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

woven wave
#

@outer ermine it wouldn't make sense to collect tax on a $0 payment

#

mode setup means there's no payment taken upfront, you just collect payment method details for later

outer ermine
#

It's not really a $0 payment. Let me explain

woven wave
#

camel_tax-setup

oak craterBOT
outer ermine
#

The flow is like this:

  1. Customer signs up for the app. We start a subscription on a 14 day trial.
  2. At any point in the trial, they can decide to choose a plan and "activate" their subscription. Activating in this context means the trial ends and they convert to a paid customer.

The way we do it is like this:

When the customer goes to the "choose plan" page and chooses a plan, we take them to a checkout page. This checkout page displays an embedded Stripe Checkout form. The only way we've been able to get this form to work is by setting the mode to 'setup'. The flow for that is like this:

  1. We create the checkout session on the server and pass the token to the frontend
  2. The frontend initializes the Checkout form.
  3. The customer enters their payment info and clicks "Save Card".
  4. Inside the onComplete callback, we make a server call.
  5. On the server, we get the setup intent, then from the setup intent we get the payment method.
  6. We attach that payment method to the customer's subscription as the default payment method, and add trial_end: "now" to activate the subscription. This charges the card the customer has provided.

What we're trying to do now: set up automatic tax collection.

pulsar dust
#

Hi, thanks for the details. Quick question here: once you created a Subscription with trial, you would have pending_setup_intent already, which can be used to collect the payment method of your customer. When you customer decide to choose a plan, why don't you reuse that setup_intent instead of creating a brand new Checkout in setup mode?

#

Maybe because you want to reuse Stripe Checkout UI?

outer ermine
#

We don't collect payment method from customers upon signup because that's generally very harmful to conversion

#

We advertise "no credit card required for trial signup"

#

During the trial we try to entice them to convert using things like discounts

#

When they go to choose a plan, that's the first time they see the Checkout form

pulsar dust
#

Yes, true, that's why it's "pending" setup_intent. You don't show to your customer until they decide to "choose plan", and at the time you can start using the pending_setup_intent

outer ermine
#

So POST /subscriptions returns a pending setup intent, which we store somewhere until the customer chooses a plan and starts a checkout?

pulsar dust
#

Yeah true. You can look at the Subscription object on response

outer ermine
#

I am there now and I see the pending_setup_intent. How is that used during checkout? Is there a guide somewhere?

pulsar dust
#

one moment

#

So normally you would use a PaymentElements and try to confirm it with that SetupIntent's client_secret

#

(not Checkout though)

outer ermine
#

I don't know anything about Payment Elements.

I saw that the subscription object has automatic_tax prop. I changed the code so that when updating the customer's subscription default_payment_method with the one they are providing through the Checkout (when they choose plan), I also set automatic_tax[enabled] to true. This seems to work to some extent. Viewing the subscription I see that it now has automatic tax calculated. Can you confirm? sub_1RbA3OKvt64dqObamgfYjxQx

#

I am seeing this on the page:

#

I basically added lines 85-87:

#

I need to head out for the day, but please post here and let me know if the above approach will work. Thank you. Will try to follow up tomorrow.