#lil_nasty_

1 messages · Page 1 of 1 (latest)

grizzled ravenBOT
languid compass
coral ocean
#

We're having a user pay for a subscription w/ automatic_tax enabled, but in order to do this I need an address (or atleast zipcode) already attached to the customer.

#

We don't collect these details until they get to the page where they'll be paying, so I can't attach the address to the customer prior to them getting to this page

#

Will I have to do the following or is there some other way?

  1. Render address element
  2. Send address result to server
  3. Attach address to customer/create customer w/ address
  4. Create subscription w/ the user who has an address attached
  5. Render payment element
#

From what I'm reading this is the way, but wondering if there's some other smoother way.

#

If not is there some way to get the address element to use the auto-complete w/o using our own key?

languid compass
#

You can render the payment element and address element together, then use addressElement.getValue() to get the address to create the customer/subscription

coral ocean
#

But can I render the payment element w/o a client secret?

languid compass
#

You can!

#

See here:

#

Actually, hmm, the subscription details are not there like I expected -- let me try to find that

#

Still looking for docs for you. But, generally speaking, you can follow the pattern there changing to mode=subscription in the config

#

and you collect payment details first and confirm the payment (for the first invoice) after

coral ocean
#

hmm this seems problematic for getting the calculated tax rate back from stripe before collecting payment details

languid compass
#

I actually worked through that exact flow very recently 🙂

#

You can collect the address and ayment details, then get your subscription including the calculated tax final amount to show the customer before finally calling confirm

coral ocean
#

I see, so collect the address, then attach that to the customer, then collect the payment method, then create the subscription, then when we get back the sub's payment details show the price + tax and let the user click confirm to finish, right?

#

This makes sense, but if possible I'd like to just call the api w/ the address and then make one more call to creat the sub and get all the info then be able to just confrm the payment from there.

The only barrier seems to be the need to have the address element within an element provider that also has a payment element to get the auto-completion. Is it possible to use the auto-completion outside of an element that has the payment element? Or is the only way to do that to use a google maps api key that we own?

languid compass
#

That's the only way, when not used with the payment element

coral ocean
#

Ok, makes sense! Thank you very much for the help

grizzled ravenBOT