#MaxFx2-setup-intent
1 messages · Page 1 of 1 (latest)
<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: {…}}
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',
}
});
the form was not initialized.
after that:
const paymentElement = elements.create('payment');
paymentElement.mount('#add_card_form');
@sacred jetty sincere apologies for the delay in our response, I'm stepping in and getting caught up on this thread.
thank you.
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?
const elements = stripe.elements(options);
with this error: The client_secret provided does not match the client_secret associated with the SetupIntent
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.
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>
Do you have the ID of the Setup Intent handy? (seti_XXX)
If you have the object in memory, then you should be able to print it and grab the ID. You can also find it by locating the creation request within your logs:
https://dashboard.stripe.com/test/logs?method[]=post&method[]=delete&direction[]=connect_in&direction[]=self
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?
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.
ok, thank you. have a good day.
Thanks, same to you 😄