#sushbhat

1 messages · Page 1 of 1 (latest)

torpid creekBOT
little reef
#

Where's the code that sets defaultValues on the Payment Element?

radiant urchin
#

this.stripeService
.confirmPayment({
elements: this.paymentElement.elements,
confirmParams: {
payment_method_data: {
billing_details: {
name: this.checkoutForm.get('name').value,
email: this.checkoutForm.get('email').value,
address: {
line1: this.checkoutForm.get('address').value,
postal_code: this.checkoutForm.get('zipcode').value,
city: this.checkoutForm.get('city').value,
country: 'US'
},
},
},
},
redirect: 'if_required',
})

#

country is set to 'US' but it still shows india

little reef
#

You're not setting a default value for the Element there, you're just passing billing details on confirmation

#

They're 2 separate concepts

radiant urchin
#

ok, any idea where to set it? Also, what exactly does this above code do? It simply hardcodes to US irrespective of what user selectes is it?

radiant urchin
#

ok, is it possible to prefill and freeze it?

little reef
#

It's not, no

radiant urchin
#

how about just prefill?

little reef
#

I'm not sure how the defaultValues parameter on the Payment Element maps to that ngx-stripe lib

#

Trying to figure it out from their docs

radiant urchin
#

ok

little reef
radiant urchin
#

oh ok, let me try thanks

#

and to hide it, I can set it to 'never' right?

little reef
#

Maybe like this:

<ngx-stripe-payment
  [appearance]="appearance"
  [clientSecret]="elementsOptions?.clientSecret"
  [options]="options"
 ></ngx-stripe-payment>
#

Where options is:

options: StripePaymentElementOptions = {
  defaultValues: {
    billingDetails: {
      address: {
        country: 'IN'
      }
    }
  }  
};
little reef
radiant urchin
#

ok