#andrew_code

1 messages ¡ Page 1 of 1 (latest)

compact moonBOT
#

👋 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/1328517780487667865

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

crystal sapphire
#

Hello! Not sure what you mean by it not being async? Can you show me the code you're using to handle that event?

finite fern
#

Yeah one moment

crystal sapphire
#

Okay, and how exactly isn't this working as expected?

finite fern
#

The call to this.updateCart seemingly isn't awaited... that's what I meant by maybe the callback function is not allowed to be an async function

#

So the console prints the same thing before and after... whereas with paymentRequest, that call to updateCart is awaited, and the tax_total on the cart changes between the two console logs

#

This was the paymentRequest version

crystal sapphire
#

You're specifying it as an async function, so it should be awaiting that. I don't see how we could be preventing that from happening.

finite fern
#

Okay, so it does support an async function there the same as paymentRequest

crystal sapphire
#

It should, yeah.

finite fern
#

Is there something wong with event.resolve vs event.updateWith?

#

Just looking for differences... another dev left me with this overnight so I am trying to figure it out

crystal sapphire
finite fern
#

Okay, so that seems okay

#

I guess the crux of the issue is that the Google Pay (in this case) dialog doesn't update to reflect updated tax info

#

So the user doesn't see that they have to pay tax after they enter their shipping address

crystal sapphire
#

You're trying to add the tax as a line item?

finite fern
#

Yeah it's in lineItems in the first screenshot. And previously it was in displayItems (for payment request)

crystal sapphire
#

Seems like it should be working. Are you certain the line items being set there are what you expect?

#

Or, wait, are you saying your updateCart function is supposed to calculate tax, but it's not, so your second console.log shows the same tax value as the first one?

finite fern
#

No I misspoke on that -- the console logs the correct tax value, but it's not reflected on the Google Pay dialog

#

The first two logs show it going from 0 to 15.26.

#

And that value is sent in event.resolve

crystal sapphire
#

Can you log the actual line items you're passing in and make sure those are correct?

#

Are you seeing the same incorrect behavior with Apple Pay as well?

finite fern
#

Yeah the only difference is the conversion from dollars to cents I guess... let me revert back to the expressCheckout version and log, and also try Apple Pay... will be a few

#

Okay I got this console error: Unhandled Promise Rejection: IntegrationError: The amount 8597 is less than the total amount of the line items provided.

So it actually seems like it's updating the lineItems with the new tax amount now. But that means the sum of all the lineItems together is greater than the original total that was sent. Can the total also be updated in the lineItems?

crystal sapphire
finite fern
#

Aha... okay that is different from how paymentRequest worked I guess. I'll try that.

compact moonBOT