#Th3FalleN

1 messages · Page 1 of 1 (latest)

static cedarBOT
wide pawn
#

Can you share an example of what you mean?

#

If you have already collected a payment method and saved it for future use, you should not need to use any Elements again to complete a payment

bitter sun
#

we want to allow them to update their billing information when checking out though

#

so for example...

#
        <LinkAuthenticationElement className="email-field" onChange={ event => {
          if (event.complete) {
            setBillingEmail(event.value.email);
          }
        } } />
        <AddressElement options={ {
          mode: 'billing',
        } }
        onChange={ event => {
          if (event.complete) {
            setAddressData(event.value);
          }
        } }
          // options={ {
          //   mode: 'billing',
          //   defaultValues: {
          //     name: account.credit_name,
          //     address: {
          //       line1: account.billing_address,
          //       line2: '',
          //       city: account.billing_city,
          //       state: account.billing_state,
          //       postal_code: account.billing_zip,
          //       country: 'US',
          //     },
          //   },
          // } }
        />
      </Fragment>```
#

would i need to provide those default values or is there a way to tell it to use a payment method id and it gets the details?

#

and also this applies for when we want to update their billing info which would require the same thing

wide pawn
#

Ah I see, you're trying to prefill an address based on billing details of a payment method? I think you've got the right idea already using the default values -- but consider you could omit the address element UI entirely if the customer wanted to use an address you already have.

bitter sun
#

but when they go to edit that information i want it to already have their current info

wide pawn
#

Got it -- then I think you're already doing this well!

bitter sun
#

well that's a first 🤣

#

thanks so much for your help

wide pawn
#

NP 🙂

bitter sun
#

so that works fine for the address field but not for the payment one, what would be the best way to offer the option to use the saved method or create a new one?

wide pawn
#

You would choose the UI for this based on the customer attached payment methods, you could eg present the last 4 digits of cards & brand

bitter sun
#

that's a fair point because my setup intent has the payment method on it already....

#

you are a wise man

wide pawn
#

But if the customer wants to use a new payment method, you reveal the Payment Element or whatever ELements you prefer for collection and confirm using the Element (instead of the PM id)

bitter sun
#

thanks!

#

so in that picture i sent... since their subscription information can be changed after a payment-intent is created, i would need to

  1. update their payment-intent.
    2.then update the subscription,
  2. then confirm a card payment. right?
wide pawn
#

YOu're asking about payment intents and subscriptions. Are you referring the the payment intent associated with a previously failed subscription invoice payment, or separate payments from the subscription?

bitter sun
#

in this flow they are updating their subscription

wide pawn
#

So if there is no pending payment (say replacing mid-cycle) you'd update the subscription default_payment_method or Customer invoice_settings[default_payment_method] and that would get used for the next invoice payment

bitter sun
#

gotcha

#

thanks