#JacquesVivi

1 messages · Page 1 of 1 (latest)

fast capeBOT
torpid lark
#

elements = stripe.elements(getElementsOptions());

paymentElement = elements.create('payment', getElementOptions());
await paymentElement.mount('#payment-element');

golden tapir
#

hi! well it works differently on the PaymentElement. Let me look...

torpid lark
#

Thanks

golden tapir
torpid lark
#

Hum. When I'm reading the documentation

#

I think I already do that

#

let elements: any = ''
let paymentElement: any = ""
async function setPayment() {

elements = stripe.elements(getElementsOptions());

paymentElement = elements.create('payment', getElementOptions());
await paymentElement.mount('#payment-element');

paymentElement.on('ready', () => isLoading.value = false)
}

#

function getElementsOptions() {
return {
appearance: {
theme: 'stripe',
fontFamily: "Roboto",
},
clientSecret: payment.keyClient
}
}

#

/*

  • PAYMENT
    */
    const isPaymentSubmited = ref(false)
    const isError = ref(false)
    async function pay() {

    isPaymentSubmited.value = true

    paymentElement.update({ readOnly: true });

    if (payment.amount > 0) {

    // CONFIRM PAYMENT
    const { error } = await stripe.confirmPayment({
    elements,
    confirmParams: getConfirmParams(),
    //redirect: 'if_required'
    });

    if (error) {
    const messageContainer = document.querySelector('#error-message');
    if (messageContainer) {
    messageContainer.textContent = error.message;
    isError.value = true;
    }
    }

    } else {

    // CONFIRM SETUP
    const { error } = await stripe.confirmSetup({
    elements,
    confirmParams: getConfirmParams(),
    //redirect: 'if_required'
    });

    if (error) {
    const messageContainer = document.querySelector('#error-message');
    if (messageContainer) {
    messageContainer.textContent = error.message;
    isError.value = true;
    }
    }
    }

    paymentElement.update({ readOnly: false });

    isPaymentSubmited.value = false
    }

#

Sorry its not lisible

golden tapir
#

that is not the deferred flow, since you have a PaymentIntent client secret immediately, in the deferred flow you would create the PaymentMethod first and then you can create the PaymentIntent after

golden tapir
#

we also have a beta for blocking the ability to enter certain card brands entirely in PaymentElement, but your account would need access to it, so without that beta this would be the best option

torpid lark
#

Ok. For the moment I don't understand. But I will sudy that

#

There no other easy options for me ?

#

I just want to block amex card, cause fees are too hight

#

(And I don't want to use Radar)

golden tapir
#

those are the options really : - the deferred/two-step integration ; - the beta for controlling allowed cards ; - Radar ; - not using PaymentElement and using CardElement

torpid lark
#

ok. Thanks

#

I sorry

#

"beta for blocking the ability to enter certain card brands entirely in PaymentElement,"

#

Do you know when its will be available ?

#

Approximately ?

golden tapir
#

no I do not

#

it has been in beta for over a year