#marco_code
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1414562419510087810
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
To confirm, you're using our ECE product? https://docs.stripe.com/elements/express-checkout-element/accept-a-payment
Unclear from the code
Yes we're using those elements
And you're listening to the shippingratechange event? Sorry I didn't look at all your code
Yes in attachEventListeners()
this.expressCheckoutElement.on('shippingratechange', async (event) => {
this.log('๐ STRIPE EXPRESS: SHIPPING RATE CHANGE event triggered:', event.shippingRate);
await this.handleShippingRateChange(event);
});
OK and I assume handleShippingRateChange updated the Payment Intent server-side?
Exactly
In updataShippingCarrier, we do that :
$updatedPaymentIntent = \Stripe\PaymentIntent::update($paymentIntentId, [
'amount' => $newStripeAmount,
'metadata' => [
'last_update' => date('Y-m-d H:i:s'),
'carrier_id' => $carrierId,
'carrier_name' => $carrier->name,
'shipping_cost' => $shippingCost,
]
]);
I suspect that as you're doing intent creation first (as opposed to deferred), you're probabaly missing this call: https://docs.stripe.com/js/elements_object/fetch_updates
That will update the Elements group to reflect the latest intent state (amount, currency, etc)
You got it rightn we don't have any call to fetchUpdate in our js
I'd try adding that after the Payment Intent update resolves
Thanks for the information, I'm gonna add it
Unfortunately, this does not seems to resolve my issue
What's strange is that in my logger, I can see that the payment intent has been updated, that the new carrier is correctly selected and the new amount is correct, but that does not reflect in the klarna popup
hi! I'm taking over this thread.
Hello, thank you
To give you more detail, that's what I get on the cart (with a 12โฌ carrier)
But onece I open Klarna, if I change to a free shipping carrier, the amount is still the same (but it should be 208 instead of 220)
On the server side, everything seems correct and the change take effect if I reload the cart page, but as soon as I'm changing the carrier inside of the klarna popup, the popup itself does not take the new shipping fee
can you share the PaymentIntent ID (pi_xxx) with this issue?
pi_3S532KBFRILdnFje1Ex1JLur
that PI was created with amount: 20800. then later updated to amount: 20800. so the maount never actually changed.
I see, but the thing I don't get is why does the popup show's up with an amount of 22000 if it's been created with an intent of 20800
based on the screenshot you shared, the amount is 208โฌ, and there's an additional 12โฌ for shipping. so the total is 220โฌ.
does not "amount" include product + shipping ?
which "amount" are you talking about exactly? the one you set on the PaymentIntent?
Yes, the one that is sent on the paymentIntent creation
I get that on my case, the amount sent on the creation is 20800
could you share a link where I can reproduce the issue?
or a quick video of the flow?
but this is the Klarna UI, so not really related to Stripe?
So it's not on your support that we can have help if it's related to klarna ui ? Sorry for the question
I tought it would be on your support cause it's all related to strip-express
You got any info on where I could contact someone that can help me ?
๐ taking over for my colleague. Let me catch up.
Hello, thank you
would you mind sharing a url where we could test this ourselves?
in that case please create a ticket here https://support.stripe.com/contact/email?topic=api_integration
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Okay thank you
in this case we will continue investigating your ticket asynchronously. so please add as much details as possible. code snippets, url, credentials if necessary, steps to reproduce, etc.