#linas-invoice-revision

1 messages · Page 1 of 1 (latest)

pseudo gustBOT
dim gulch
#

@teal prawn what

#

what's the URL of that doc?

#

linas-invoice-revision

dim gulch
#

thanks I'll get the docs fixed, but mostly it's just a normal create with those parameters

teal prawn
#

let me quickly try it

#

thank you, i think it now works.

primal wedge
#

Great to hear! Let us know if you have any other questions

teal prawn
#

One more question about JS part :

#

// Create and mount the Address Element in billing mode
const addressElement = elements.create("address", {
mode: "billing",
defaultValues: {
name: 'Your Full Name...',
address: {
// line1: 'Address...',
city: 'City...',
state: 'CA',
postal_code: '',
country: 'US',
},
},
fields: {
phone: 'always',
},
validation: {
phone: {
required: 'always',
},
},
});

#

I was reading in documentation, that it is possible to hide adress1 or any unwanted field.

#

But i cannot find again

primal wedge
#

Gotcha, looking in to this

#

Might be worth testing to see if that works though obviously that is a bit of a roundabout way of doing it. I will add feedback to allow this through the address element itself

teal prawn
#

I used like this:

#

const paymentElement = elements.create("payment", paymentElementOptions);
paymentElement.mount("#payment-element");

        // Create and mount the Address Element in billing mode
        const addressElement = elements.create("address", {
            mode: "billing",
            defaultValues: {
                name: 'Your Full Name...',

/* address: {
line1: 'Address...',
city: 'City...',
state: 'CA',
postal_code: '',
country: 'US',
},*/
},
fields: {
phone: 'always',
},
validation: {
phone: {
required: 'always',
},
},
});
addressElement.mount("#address-element");

#

If i comment out this part:

#

address: {
line1: 'Address...',
city: 'City...',
state: 'CA',
postal_code: '',
country: 'US',
},

#

it hides me some fields, but somehow it also hides me a phone number.

primal wedge
#

Interesting, so they will show when you provide default values but are otherwise hidden?

#

Ah, do you want to hide these fields because you already have the user's address?

#

I assumed your use case was hiding them to present your own custom address form. If you have the details already, you may want to just pass them in to the billingDetails hash when confirming the payment

teal prawn
#

i want to hide just a few and others show.

#

i have jsut tried different approach:

#

const paymentElementOptions = {
layout: "tabs",
billingDetails: {
phone: "never",
email: "never",
}
};

        const paymentElement = elements.create("payment", paymentElementOptions);
#

to use Only payments. But phone field is not shown.

#

Actually, i changed "never" to "auto"

primal wedge
#

Ah, that may be because the specific payment method you are working with doesn't require a phone number.

#

As you noted, we currently have never and auto as options now but we don't have always at the moment.

#

To have something always show, we actually recommend setting it to never and displaying your own input field for it.

teal prawn
#

Then i'm forced to use "addressElement" instead of paymentElement.

#

But then it is displaying too many fields. and i'm not able to hide.. 😄

primal wedge
#

For now, I don't think we have a Stripe.js Element that will always collect the phone number like that. You may have to code your own custom phone number field here.

dim gulch
#

@teal prawn did you have more questions?