#djk3600

1 messages ยท Page 1 of 1 (latest)

versed falconBOT
hardy night
#

Hello there

#

Do you have a request ID I can look at?

sacred ruin
#

Yes one second please!

#

Status
400 ERR
ID
req_gIne04Fl1dStXF
Time
19/12/2022, 19:04:25
IP address
86.140.252.53
API Version
2022-08-01
Latest
Source
Stripe/v1 NodeBindings/11.2.0
Idempotency
Key โ€“ c533f617-0ce9-41cf-8e30-d4a80db987d1

hardy night
#

Thanks, looking

#

Is your code using a variable there?

#

It should just be receipt_email: "x@y.com"

sacred ruin
#

const { items, shipping, description, userEmail } = req.body;

// Create a PaymentIntent with the order amount and currency
const paymentIntent = await stripe.paymentIntents.create({
amount: calculateOrderAmount(items),
currency: "gbp",
automatic_payment_methods: {
enabled: true,
},
description,
shipping: {
address: {
line1: shipping.line1,
line2: shipping.line2,
city: shipping.city,
country: shipping.country,
postal_code: shipping.postal_code,
},
name: shipping.name,
phone: shipping.phone,
},
receipt_email: userEmail,
})

hardy night
#

I'd also recommend redacting your actual email address since this is a public server

#

Yep so looks like your userEmail is an object.

#

Try userEmail.customerEmail there instead

sacred ruin
#

I am pulling it via the request body

#

Okay trying now

#

one second ๐Ÿ™‚

#

nice one mate!

#

it worked, the automatic email didn't send though, would you be able to help me solve this issue please?

hardy night
#

We don't send those emails in test mode

#

So as not to spam folks

#

You can send it manually via the Dashboard to see what it would look like

#

You view the PaymentIntent and click "send receipt" on the Dashboard

sacred ruin
#

ahhhh!

#

Let me check now

#

ahhh it worked!!

#

So if it wasn't in test mode would it send automatically?

hardy night
#

Yep

sacred ruin
#

even with this?

hardy night
sacred ruin
#

Okay brilliant - mate you are really good I appreciate it so much ๐Ÿ™‚

#

last little question if I may...

hardy night
#

Sure

sacred ruin
#

I have been running into this error

#
parameter_invalid_integer - amount
Invalid integer: 14092.000000000002
#

What have you guys found to be the best way to solve it??

hardy night
#

Sorry for delay!

#

I missed your response!

#

My bad

#

You can't set decimals for amount @sacred ruin

#

Is your code calculating that amount?

#

You likely have some small rounding issue in your code that you will want to look into