#MaxFx2-setup-intent

1 messages · Page 1 of 1 (latest)

candid tiger
#

Hi there, how are you retrieving the client_secret from the created SetupIntent?

sacred jetty
#

<input type="hidden" name="client_secret" value="<?php echo $client_secret;?>">

#

after var client_secret = block.find('[name="client_secret"]').val();

#

const options = {
clientSecret: client_secret,
appearance: appearance,
};
console.log(options);

#

{clientSecret: 'seti_1Jw0f1LR0r9LBiMUaGJqx9oP_secret_KbD5yhOSGOV5wrKb9VLxchBpMHd', appearance: {…}}

candid tiger
#

This looks correct to me, and after you have created the element and mounted the Payment Element:
const elements = stripe.elements(options);

// Create and mount the Payment Element
const paymentElement = elements.create('payment');
paymentElement.mount('#payment-element');

#

The listener then listens to the 'submit' button to confirmSetup?

const {error} = await stripe.confirmSetup({
//Elements instance that was used to create the Payment Element
elements,
confirmParams: {
return_url: 'https://test.com',
}
});

sacred jetty
#

the form was not initialized.

#

after that:

#

const paymentElement = elements.create('payment');
paymentElement.mount('#add_card_form');

vernal pilot
#

@sacred jetty sincere apologies for the delay in our response, I'm stepping in and getting caught up on this thread.

sacred jetty
#

thank you.

vernal pilot
#

So it looks like you're working on integrating the Payment Element in conjunction with a PHP backend. Can you clarify exactly which step of the flow is executing when you receive the mentioned error?

vernal pilot
#

Hm, sorry I'm trying to wrap my head around what might be happening. It's odd because creating the payment element is the first time in the flow that you should use the client secret, so I'm not sure how it could not match as it's not being compared to anything at that point.

sacred jetty
#

var stipe_public = block.find('[name="stipe_public"]').val(); //pk_test_51JKQlBLR0r9LBiMU26AvsBWetcSzKhjy4E34C3YrLyOjJBPy4dLlnqnuzej5S8BAZeEeFGn8lOPT9yq6HoZoBPbD001p1RPn4T

#

var client_secret = block.find('[name="client_secret"]').val(); //seti_1Jw0f1LR0r9LBiMUaGJqx9oP_secret_KbD5yhOSGOV5wrKb9VLxchBpMHd

#

const stripe = Stripe(stipe_public);

#

const appearance = {
theme: 'stripe'
};

#

const options = {
clientSecret: client_secret,
appearance: appearance,
};

    const elements = stripe.elements(options);
#

that all js code

#

if I place this strings: const paymentElement = elements.create('payment'); paymentElement.mount('#stripe_form');

#

<div id="add_card_form">
<input type="hidden" name="stipe_public" value="<?php the_field('stipe_public_key','option');?>">
<input type="hidden" name="client_secret" value="<?php echo $client_secret;?>">
<div id="stripe_form"></div>
<button>send</button>
</div>

vernal pilot
#

Do you have the ID of the Setup Intent handy? (seti_XXX)

sacred jetty
#

what is it?

#

where i can get it?

vernal pilot
sacred jetty
#

Sorry, I don't have access to this account right now, it will only be tomorrow.

#

Can we continue tomorrow when I have the log?

vernal pilot
#

Sure thing, we'll be here! Note the name of the thread, and when you write in tomorrow start by asking if we can unarchive and continue this thread.

sacred jetty
#

ok, thank you. have a good day.

vernal pilot
#

Thanks, same to you 😄