#bassil-error
1 messages ยท Page 1 of 1 (latest)
hi! Id' suggest adding logging to your site to check what the actual value of client_secret you're passing to the function is.
Hmm.
i will add console.log to the client.js to see the value being passed as you mentioned
The full error is
9(index):1 Uncaught IntegrationError: Missing value for stripe.confirmCardPayment intent secret: value should be a client_secret string.
at V ((index):1:10210)
at J ((index):1:10280)
at u ((index):1:34894)
at (index):1:234074
at (index):1:59140
at e.<anonymous> ((index):1:267285)
at e.confirmCardPayment ((index):1:15314)
at payWithCard (client.js?version=15:75:10)
at HTMLFormElement.<anonymous> (client.js?version=15:60:21)
Oh Maybe it was the value amount
I had it at 1 AED for testing, maybe min is 2 aed thus throwing this error
the minimum is 2 yes https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts
maybe your backend doesn't handle the error correctly (the Stripe API will fail if you try to create a PaymentIntent like that)
I had some customer that tried to make a purchase online, payment shows as Incomplete but i can clearly tell she paid with card
Ah weird i will look into that
can i provide payment intent ID to check why her payment didnt go through, it didnt even say failed or anything
Just says incomplete.. how can it be incomplete if her card data is attached to the payment intent
pi_3KjK6WBStawTvwlL0EYt33rE
Also she tried again:
pi_3KjKSpBStawTvwlL0ZPxMsl7
She got redirected afterwards to my page that checks to see if payment went through as a double check to the webhook but it kept loading and she was struck, obvsiouly because system couldnt detect a payment.
My question is how come I see her card details and the payment is "incomplete"
it's because you updated the PaymentIntent after calling confirmCardPayment as far as I can tell.
so her money did not in fact go through?
you shouldn't update it once the customer has started the payment process, since it cancels the ongoing attempt.
here the customer started at this request (it's confirmCardPayment : https://dashboard.stripe.com/logs/req_ttuWDAwKmkFHkx
and at the same moment, you updated to add some metadata : https://dashboard.stripe.com/logs/req_rqaJhYY3oblLko
I'm not sure that's the issue but it could be
no charge was processed that I see
anyway this is not the right place
talk to https://support.stripe.com/?contact=true instead
Im just trying to figure out why my code did this
Yes she wasn't charged, hmm, yes I update my payment intent with meta data with customer info and order details.
And then it reupdates as they click pay now button with their email and such. Previously didnt have issues with this. hmm.
for now I would try to avoid doing that, updating the PaymentIntent can reset the payment state which I think is what happened here
Hmm interesting, so what do you suggest doing to attach customer information to the payment intent?
because I don't actually create the order until it is a confirmed payment through the webhook.
So thus rely on meta data to collect order info to make the order locally on my site database
you can use metadata but just don't update it at the same moment as calling confirmCardPayment
do it before and wait for that API call to finish, and then you can call confirmCardPayment on the frontend
I like that idea very much. Simple and doesn't require major reengineering
Thank you. I did have another question, though this issue has happened many times and its driving me insane.
Whenever someone uses a coupon code, they are still being charged the full amount. But in my code I have it update the payment intent reflecting the code, on my local server works fine
In production, the code entered isn't updating the payment intent, can I provide you with an example payment intent of a recent customer to see what happened?
Just to better understand where in my code I need to fix
pm_1KjIzpBStawTvwlLy16yq2cr
It appears no meta data was created for this order. Which is very weird.
I have to run but my colleague will take over
Ok thank you karl !
Hi! Sorry for the delay. Do you still need help with your question?
So you just shared a payment method that was created from a PaymentIntent (pi_3KjIuUBStawTvwlL0cfFvxyp). Everything seems to have worked properly, so can you clarify what is the issue here?
Where you expecting to se metadata? If so, where?
Erm so for pm_1KjIzpBStawTvwlLy16yq2cr there is no meta data
I had to recreate the order manually on my site, when this payment intent hit my webhook there was no meta data and also on the stripe dashboard this PI doesn't have emta data either
PM sorry
Hello ๐
Stepping in for soma here
while I catch up could you give me a quick summary of what you need help with? ๐
Yes absolutely, so essentially I had a customer who made an order on my site pm_1KjIzpBStawTvwlLy16yq2cr
Issue is there was no meta data that was attached to the payment intent. We require metadata such as customer info, order number, product id, etc, so that when stripe hits our webhook it creates the order in our database
Sometimes this happens where a payment intent has no meta data and its annoying because I don't know why and customer freaks out on us and i have to create it manually
Ah okay
So the Payment Intent that created this Payment Method didn't have the metadata in the original request
That is so weird...
Hmm.
It should have updated as soon as they clicked the pay stripe button
Maybe as previously mentioned, it might have called the paycard method before updating possibly
Does your system show any attempt to update the payment intent but a failure occured?
As in on the dashboard? You should be able to see failed requests in the logs
Very strange no sign of an update
means something happened in the front-end that made it fail to update the PI with metadata.
What i don't know lol. I might have to reengineer my stripe integration with better practices
We've processed over 300k AED approximately, this doesn't happen often but sometimes it does.
Ah I see. Good luck ๐ I hope you find the bug soon
Thank you.
Hi @urban gull
I noticed in my local debugger I get the following message when attempting to update payment intent before i pay
Request req_CtxhUEpOZB8keJ: This PaymentIntent's amount could not be updated because it has a status of requires_capture. You may only update the amount of a PaymentIntent with one of the following statuses: requires_payment_method,
requires_confirmation, requires_action.
What happened here is when a discount code is used, I attempt to update the payment intent with the new total
I am using the capture later model
When this occurs the meta data isnt being added to the order
Gotcha. so once you've authorized the intent, you can't update it with a new amount. You can capture it with less amount than the one that you've authorized.
Hmm but at this point i didnt click the pay now button or enter any card details
It just created the payment intent on the load of the page, and when you hit the apply code it attempts to update the payment intent
Reason I think this is the culprit because if no code is used no issues, only when code is used
You can just render the amount client-side before the pay now is clicked. And attempt to capture when the button is clicked.
I am confused, so we are currently using manual capture so that after the order we only capture when the product is shipped.
But we require a payment intent to be initially created so they see the stripe code at the bottom, its a 1 page checkout
Lets say your shopping on my site, you click add to cart, itll auto take you tot he checkout and create a payment intent for $500 for example.
Now customer wants to use a code for $100 off. When they click apply code, it should update the initial payment intent with the new amount, which is what is causing the error here because apparently you cannot update total amount for a manual capture object?
So when you set capture_method to manual, you're basically placing a hold on customers payment method.
That's the maximum amount that you can charge correct? but if you try and update the authorization now, that wouldn't work because you already have one hold on the payment method.
I see but I mean this is all before customer even clicked the pay now button before they entered card details apologies for the confusion
Can I maybe send a screenshot of our checkout to explain our flow?
Sure
Customer clicks buy now on a tyre and they reach this checkout, and on load the payment intent is created. They enter their details such as name, email, number, and if they have a discount code they will enter the code and click apply. When they click apply, it should update the payment intent so when they enter card details below it doesn't charge the original amount, but rather charge the updated amount
If I enter the code manually click apply it updates, but I had a code in my site where if they prompted to enter their email they get a code auto applied via session cookie, and so when they reach checkout it will auto enter the code via jquery and click the apply button via jquery, maybe what is happening is it is clicking the pay button via code by accident and then trying to update?
Strange.
That message only shows up when code is entered automatically by the front-end via jquery
You've created this checkout page correct?
Yes I am a programmer this is a completely custom website built in Django
Awesome! it looks great btw. what happens when you click on pay now?
you capture the funds correct?
{% if request.session.promo == '5%OFF' %}
$('#id_code').val('ZEROVAT');
$('#id_code_btn').trigger('click');
$('html, body').animate({scrollTop: $('.checkout').offset().top + 100}, 'slow');
{% endif %}
I think I found the issue
I think this code was running and updating payment intent before the original payment intent finished initializing
When I added a delay of 5 seconds via Jquery I can see the payment intent being updated to correct amount as such:
{% if request.session.promo == '5%OFF' %}
setTimeout(
function()
{
$('#id_code').val('ZEROVAT');
$('#id_code_btn').trigger('click');
$('html, body').animate({scrollTop: $('.checkout').offset().top + 100}, 'slow');
}, 5000);
{% endif %}
Ah cool! That's awesome. I'm glad you're unblocked.
Haha finally thank u Hanzo will play around with this new fix. Curious to know, is there a way to check if the payment intent was successfully created before I run this code?
Instead of setting a static 5 seconds to run the code.
Umm you can try to retrieve it
Ah smart, ajax call to my backend to keep retrieving parodically until its created
once detected, return true, execute code and exit loop
ty ๐
NP! ๐ Good luck