#naveed-web3auth_code

1 messages ¡ Page 1 of 1 (latest)

prisma novaBOT
#

👋 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/1293068699863093321

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

balmy nymph
#

Hi there, is it to update the customer's address or the address of payment method's billing_details

hard edge
#

most probably payment methods billing details because i actually prefill customers stripe element with his saved credit card address

#

this the code mounting to DOM with default values that I fetched from my own backend API

mountStripeElement() {
  const addressElement = this.stripeElements.create("address", {
    mode: "billing",
    defaultValues: {
      ...this.creditCard.billingDetails,
      name: "naveed@tor.us",
    },
  });
  addressElement.mount("#address-element");
},
balmy nymph
hard edge
#

So what about the address prefilling aspect

#

like generating all those dynamic address fields

#

which is country specific

#

I can just use it as a listener for values without have to call any sort of confirm setup on an intent on stuff?

#

Like those html address fields that stripe gives me with AddressElement, do I continue using it like I've been doing?

#

Only difference is iin the end I do somethign like

const updateAddress = async () => {
  if (!stripeElements.value) {
    return;
  }

  const addressElement = stripeElements.value.getElement("address");

  const { complete, value } = await addressElement.getValue();

  if (complete) {
    try {
      await billingModule.updateCustomerAddress({ teamId: props.selectedTeamId, address: value.address });
    } catch (e) {
      log.error("Failed to update customer stripe address", e);
      error.value = `Error: Failed to update address`;
    }
  }
};
#

On completion get the value of the element and submit them to my backend API

#

basically do i still need to create the setup intent and get the client secret to initialise my stripe address element?

#

e.g.

const setupIntent = await billingModule.createSetupIntent({ teamId: props.selectedTeamId });
clientSecret.value = setupIntent.client_secret;
#

and then

const stripeElements = computed(() => {
  if (clientSecret.value) {
    const stripeClient = getStripeClient();
    return stripeClient.elements({
      clientSecret: clientSecret.value,
    });
  }
  return null;
});
balmy nymph
#

No you don't need a clinet secret to init address element